fix(database): remove the setUpHooks method

This commit is contained in:
chenos 2022-02-11 14:52:04 +08:00
parent 695b953a8f
commit c2725ac9ca

View File

@ -13,7 +13,7 @@ export type RepositoryType = typeof Repository;
export type CollectionSortable = string | boolean | { name?: string; scopeKey?: string }; export type CollectionSortable = string | boolean | { name?: string; scopeKey?: string };
export interface CollectionOptions extends Omit<ModelOptions, 'name'> { export interface CollectionOptions extends Omit<ModelOptions, 'name' | 'hooks'> {
name: string; name: string;
tableName?: string; tableName?: string;
filterTargetKey?: string; filterTargetKey?: string;
@ -201,19 +201,11 @@ export class Collection<
this.setFields(options.fields, false); this.setFields(options.fields, false);
this.setRepository(options.repository); this.setRepository(options.repository);
if (newOptions.hooks) {
this.setUpHooks(newOptions.hooks);
}
this.context.database.emit('afterUpdateCollection', this); this.context.database.emit('afterUpdateCollection', this);
return this; return this;
} }
setUpHooks(bindHooks) {
(<any>this.model)._setupHooks(bindHooks);
}
setSortable(sortable) { setSortable(sortable) {
if (!sortable) { if (!sortable) {
return; return;