feat(F-054): completed feature

This commit is contained in:
chattie
2026-08-19 13:15:30 +02:00
parent 6a74f5ede6
commit de41a42d88
17 changed files with 446 additions and 100 deletions

View File

@@ -107,7 +107,20 @@ export async function registerBackofficeRoutes(
};
app.post('/backoffice/auth/login', { schema: loginSchema }, async (request, reply) => {
const input = credentialsSchema.parse(request.body);
const parseResult = credentialsSchema.safeParse(request.body);
if (!parseResult.success) {
throw new AppError(
400,
'VALIDATION_ERROR',
'Invalid request payload',
parseResult.error.issues.map((issue) => ({
path: issue.path.join('.'),
message: issue.message,
code: issue.code,
})),
);
}
const input = parseResult.data;
try {
const result = await login.execute(input);
setCookie(reply, result.token, true);