fix: field update with migrate
This commit is contained in:
parent
bad753cd46
commit
50baa9363c
@ -7,3 +7,11 @@ export const create = async (ctx: Context, next: Next) => {
|
|||||||
await ctx.body.migrate();
|
await ctx.body.migrate();
|
||||||
await next();
|
await next();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const update = async (ctx: Context, next: Next) => {
|
||||||
|
await actions.update(ctx, async () => {});
|
||||||
|
const { associated } = ctx.action.params;
|
||||||
|
await ctx.body.generateReverseField();
|
||||||
|
await ctx.body.migrate();
|
||||||
|
await next();
|
||||||
|
}
|
@ -3,7 +3,7 @@ import { Plugin } from '@nocobase/server';
|
|||||||
import { registerModels, Table, uid } from '@nocobase/database';
|
import { registerModels, Table, uid } from '@nocobase/database';
|
||||||
import * as models from './models';
|
import * as models from './models';
|
||||||
import { createOrUpdate, findAll } from './actions';
|
import { createOrUpdate, findAll } from './actions';
|
||||||
import { create } from './actions/fields';
|
import { create, update } from './actions/fields';
|
||||||
|
|
||||||
registerModels(models);
|
registerModels(models);
|
||||||
|
|
||||||
@ -126,9 +126,11 @@ export default {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.app.resourcer.registerActionHandler('collections.fields:create', create);
|
this.app.resourcer.registerActionHandler('collections.fields:create', create);
|
||||||
|
this.app.resourcer.registerActionHandler('collections.fields:update', update);
|
||||||
this.app.resourcer.registerActionHandler('collections:findAll', findAll);
|
this.app.resourcer.registerActionHandler('collections:findAll', findAll);
|
||||||
this.app.resourcer.registerActionHandler('collections:createOrUpdate', createOrUpdate);
|
this.app.resourcer.registerActionHandler('collections:createOrUpdate', createOrUpdate);
|
||||||
this.app.resourcer.registerActionHandler('fields:create', create);
|
this.app.resourcer.registerActionHandler('fields:create', create);
|
||||||
|
this.app.resourcer.registerActionHandler('fields:update', update);
|
||||||
this.app.resourcer.registerActionHandler('collections:create', createOrUpdate);
|
this.app.resourcer.registerActionHandler('collections:create', createOrUpdate);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user