fix: appends/except only use to get/list actions

This commit is contained in:
chenos 2021-01-01 19:12:53 +08:00
parent 53212ee47d
commit ba6f3f7f7d

View File

@ -62,14 +62,14 @@ api.resourcer.use(async (ctx: actions.Context, next) => {
});
api.resourcer.use(async (ctx: actions.Context, next) => {
const { resourceField, resourceName, fields = {} } = ctx.action.params;
const { actionName, resourceField, resourceName, fields = {} } = ctx.action.params;
const table = ctx.db.getTable(resourceField ? resourceField.options.target : resourceName);
// ctx.state.developerMode = {[Op.not]: null};
ctx.state.developerMode = false;
if (table && table.hasField('developerMode') && ctx.state.developerMode === false) {
ctx.action.setParam('filter.developerMode', ctx.state.developerMode);
}
if (table) {
if (table && ['get', 'list'].includes(actionName)) {
const except = fields.except || [];
const appends = fields.appends || [];
for (const [name, field] of table.getFields()) {