feat: collection titleField

This commit is contained in:
chenos 2023-01-18 16:55:03 +08:00
parent aaf6718755
commit 3b7143a282

View File

@ -3,11 +3,11 @@ import { EventEmitter } from 'events';
import { default as lodash, default as _ } from 'lodash';
import {
ModelOptions,
ModelStatic,
QueryInterfaceDropTableOptions,
SyncOptions,
Transactionable,
ModelStatic,
Utils,
Utils
} from 'sequelize';
import { Database } from './database';
import { Field, FieldOptions } from './fields';
@ -62,6 +62,10 @@ export class Collection<
return this.options.name;
}
get titleField() {
return (this.options.titleField as string) || this.model.primaryKeyAttribute;
}
get db() {
return this.context.database;
}