From ba6f3f7f7dc483f374baf76fe61e0b015da66be9 Mon Sep 17 00:00:00 2001 From: chenos Date: Fri, 1 Jan 2021 19:12:53 +0800 Subject: [PATCH] fix: appends/except only use to get/list actions --- packages/app/src/api/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/app/src/api/index.ts b/packages/app/src/api/index.ts index 6c23097a1..697e2e435 100644 --- a/packages/app/src/api/index.ts +++ b/packages/app/src/api/index.ts @@ -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()) {