UNPKG

@appsemble/node-utils

Version:

NodeJS utilities used by Appsemble internally.

16 lines 751 B
import { AppPermission } from '@appsemble/lang-sdk'; import { assertKoaCondition } from '../../../../../koa.js'; export function createGetAppGroupsController({ checkAuthSubjectAppPermissions, getApp, getAppGroups, }) { return async (ctx) => { const { pathParams: { appId }, } = ctx; const app = await getApp({ context: ctx, query: { attributes: ['id'], where: { id: appId } } }); assertKoaCondition(app != null, ctx, 404, 'App not found'); await checkAuthSubjectAppPermissions({ app, context: ctx, permissions: [AppPermission.QueryGroups], }); ctx.body = await getAppGroups({ context: ctx, app }); }; } //# sourceMappingURL=createGetAppGroupsController.js.map