mirror of
https://gitee.com/nocobase/nocobase.git
synced 2024-12-02 20:27:49 +08:00
fix(database): cannot read properties of null (reading 'constructor')
This commit is contained in:
parent
1764b53a9b
commit
7cfa939f63
@ -15,7 +15,7 @@ export async function get(ctx: Context, next) {
|
||||
context: ctx,
|
||||
});
|
||||
|
||||
ctx.body = instance;
|
||||
ctx.body = instance || {};
|
||||
|
||||
await next();
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
import lodash, { omit } from 'lodash';
|
||||
import lodash from 'lodash';
|
||||
import { SingleAssociationAccessors, Transactionable } from 'sequelize';
|
||||
import { Model } from '../model';
|
||||
import { Appends, Except, Fields, Filter, TargetKey, UpdateOptions } from '../repository';
|
||||
import { updateModelByValues } from '../update-associations';
|
||||
import { RelationRepository, transaction } from './relation-repository';
|
||||
import { handleAppendsQuery } from '../utils';
|
||||
import { RelationRepository, transaction } from './relation-repository';
|
||||
|
||||
export interface SingleRelationFindOption extends Transactionable {
|
||||
fields?: Fields;
|
||||
|
@ -1,6 +1,6 @@
|
||||
import crypto from 'crypto';
|
||||
import { Model } from './model';
|
||||
import { IdentifierError } from './errors/identifier-error';
|
||||
import { Model } from './model';
|
||||
|
||||
type HandleAppendsQueryOptions = {
|
||||
templateModel: any;
|
||||
@ -10,6 +10,10 @@ type HandleAppendsQueryOptions = {
|
||||
export async function handleAppendsQuery(options: HandleAppendsQueryOptions) {
|
||||
const { templateModel, queryPromises } = options;
|
||||
|
||||
if (!templateModel) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const primaryKey = templateModel.constructor.primaryKeyAttribute;
|
||||
|
||||
const results = await Promise.all(queryPromises);
|
||||
|
Loading…
Reference in New Issue
Block a user