From d2ac7570f386880cebf8a42bcc160395e6b09a70 Mon Sep 17 00:00:00 2001 From: Bruno Perel Date: Sun, 17 Dec 2023 19:27:09 +0100 Subject: [PATCH] Fix userId type --- apps/web/src/pages/admin/presentation-text/[decision].vue | 2 +- packages/api-routes/index.ts | 2 +- packages/api/routes/presentation-text/:decision.ts | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/web/src/pages/admin/presentation-text/[decision].vue b/apps/web/src/pages/admin/presentation-text/[decision].vue index ac7ef9408..07b26abff 100644 --- a/apps/web/src/pages/admin/presentation-text/[decision].vue +++ b/apps/web/src/pages/admin/presentation-text/[decision].vue @@ -17,7 +17,7 @@ let router = useRouter(); params: { decision: currentRoute.params.decision as string }, reqBody: currentRoute.query as unknown as { sentence: string; - userId: number; + userId: string; }, }), ); diff --git a/packages/api-routes/index.ts b/packages/api-routes/index.ts index dd8016828..67eee4ac0 100644 --- a/packages/api-routes/index.ts +++ b/packages/api-routes/index.ts @@ -396,7 +396,7 @@ export class GET__global_stats__user__list extends ContractWithMethodAndUrl<{ r } export class POST__presentation_text__$decision extends ContractWithMethodAndUrl<{ params: { decision: string }; - reqBody: { sentence: string; userId: number }; + reqBody: { sentence: string; userId: string }; }> { static readonly method = "post"; static readonly url = "/presentation-text/:decision"; diff --git a/packages/api/routes/presentation-text/:decision.ts b/packages/api/routes/presentation-text/:decision.ts index fc7d74448..a7b6e973b 100644 --- a/packages/api/routes/presentation-text/:decision.ts +++ b/packages/api/routes/presentation-text/:decision.ts @@ -12,10 +12,11 @@ export const post = [ async ( ...[req, res]: ExpressCall<{ params: { decision: string }; - reqBody: { sentence: string; userId: number }; + reqBody: { sentence: string; userId: string }; }> ) => { - const { sentence, userId } = req.body; + const { sentence, userId: userIdString } = req.body; + const userId = parseInt(userIdString); const { decision } = req.params; if (!["approve", "refuse"].includes(decision as string)) { res.writeHead(400);