mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 11:36:42 +00:00
bugfix
This commit is contained in:
parent
6b419fc5cd
commit
91ecd98071
@ -17,6 +17,8 @@ import { middlewares } from '@nocobase/server';
|
||||
useStaticServer: !(process.env.APP_USE_STATIC_SERVER === 'false' || !process.env.APP_USE_STATIC_SERVER),
|
||||
}));
|
||||
|
||||
await api.database.getModel('collections').load({ skipExisting: true });
|
||||
|
||||
api.listen(process.env.API_PORT, () => {
|
||||
console.log(`http://localhost:${process.env.API_PORT}/`);
|
||||
});
|
||||
|
12
packages/plugin-collections/src/actions/fields.ts
Normal file
12
packages/plugin-collections/src/actions/fields.ts
Normal file
@ -0,0 +1,12 @@
|
||||
import { Model, ModelCtor } from '@nocobase/database';
|
||||
import { actions, middlewares } from '@nocobase/actions';
|
||||
import { sort } from '@nocobase/actions/src/actions/common';
|
||||
import { cloneDeep, omit } from 'lodash';
|
||||
|
||||
export const create = async (ctx: actions.Context, next: actions.Next) => {
|
||||
await actions.common.create(ctx, async () => {});
|
||||
const { associated } = ctx.action.params;
|
||||
await associated.migrate();
|
||||
console.log('associated.migrate');
|
||||
await next();
|
||||
}
|
@ -3,6 +3,7 @@ import { Application } from '@nocobase/server';
|
||||
import { registerModels, Table } from '@nocobase/database';
|
||||
import * as models from './models';
|
||||
import { createOrUpdate, findAll } from './actions';
|
||||
import { create } from './actions/fields';
|
||||
|
||||
export default async function (this: Application, options = {}) {
|
||||
const database = this.database;
|
||||
@ -15,6 +16,7 @@ export default async function (this: Application, options = {}) {
|
||||
model.set('name', model.get('key'));
|
||||
}
|
||||
});
|
||||
this.resourcer.registerActionHandler('collections.fields:create', create);
|
||||
this.resourcer.registerActionHandler('collections:findAll', findAll);
|
||||
this.resourcer.registerActionHandler('collections:createOrUpdate', createOrUpdate);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user