import CollectionModel from '../models/collection'; const defaultValues = { actions: [ { type: 'list', name: 'list', title: '查看', }, { type: 'create', name: 'create', title: '创建', viewName: 'form', }, { type: 'update', name: 'update', title: '编辑', viewName: 'form', }, { type: 'destroy', name: 'destroy', title: '删除', }, ], views: [ { type: 'form', name: 'form', title: '表单', template: 'DrawerForm', }, { type: 'details', name: 'details', title: '详情', template: 'Details', actionNames: ['update'], }, { type: 'table', name: 'simple', title: '简易模式', template: 'SimpleTable', actionNames: ['create', 'destroy'], detailsViewName: 'details', updateViewName: 'form', }, { type: 'table', name: 'table', title: '列表', template: 'Table', actionNames: ['create', 'destroy'], default: true, }, ], tabs: [ { type: 'details', name: 'details', title: '详情', viewName: 'details', default: true, }, ], }; export default async function (model: CollectionModel, options: any = {}) { const { migrate = true } = options; if (migrate) { await model.migrate(); } await model.updateAssociations(defaultValues); }