From 334cc5903af899b62a38aef26811fd11b248a394 Mon Sep 17 00:00:00 2001 From: Gao Sun Date: Thu, 26 Aug 2021 22:50:27 +0800 Subject: [PATCH] refactor: accept rest data while creating application --- packages/core/src/routes/application.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/packages/core/src/routes/application.ts b/packages/core/src/routes/application.ts index ff8402207..825f78e85 100644 --- a/packages/core/src/routes/application.ts +++ b/packages/core/src/routes/application.ts @@ -1,6 +1,6 @@ import Router from 'koa-router'; -import { nativeEnum, object, string } from 'zod'; -import { ApplicationType } from '@logto/schemas'; +import { object, string } from 'zod'; +import { Applications } from '@logto/schemas'; import koaGuard from '@/middleware/koa-guard'; import { deleteApplicationById, insertApplication } from '@/queries/application'; import { buildIdGenerator } from '@/utils/id'; @@ -12,19 +12,20 @@ export default function applicationRoutes(router: Router { - const { name, type } = ctx.guard.body; + const { name, type, ...rest } = ctx.guard.body; ctx.body = await insertApplication({ id: applicationId(), type, name, oidcClientMetadata: generateOidcClientMetadata(), + ...rest, }); return next(); }