* feat: add createdBy/updatedBy field config for table managed by collections * fix: update by different users and field initialization * fix: function argument * add: test cases Co-authored-by: chenos <chenlinxh@gmail.com>
19 lines
595 B
TypeScript
19 lines
595 B
TypeScript
import { Model, getDataTypeKey, getField } from '@nocobase/database';
|
|
|
|
export default async function(model: Model, options) {
|
|
// const { database } = model;
|
|
// const { type, target, collection_name } = model.get();
|
|
// const table = database.getTable(collection_name);
|
|
// const Type = getField(getDataTypeKey(type));
|
|
// let Exist;
|
|
// for (const Field of table.getFields().values()) {
|
|
// if (Field instanceof Type && Field.options.target === target) {
|
|
// Exist = Field;
|
|
// break;
|
|
// }
|
|
// }
|
|
// if (Exist) {
|
|
// model.set('name', Exist.options.name);
|
|
// }
|
|
}
|