Skip to content

Commit

Permalink
Fix userId type
Browse files Browse the repository at this point in the history
  • Loading branch information
bperel committed Dec 17, 2023
1 parent f93fd2b commit d2ac757
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion apps/web/src/pages/admin/presentation-text/[decision].vue
Original file line number Diff line number Diff line change
Expand Up @@ -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;
},
}),
);
Expand Down
2 changes: 1 addition & 1 deletion packages/api-routes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
5 changes: 3 additions & 2 deletions packages/api/routes/presentation-text/:decision.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit d2ac757

Please sign in to comment.