mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-01-06 06:01:31 -05:00
fix(api): update logs in user.ts (#60193)
This commit is contained in:
committed by
GitHub
parent
504a6eaa1d
commit
dc5c7893b5
@@ -222,9 +222,7 @@ export const userPublicGetRoutes: FastifyPluginCallbackTypebox = (
|
||||
const logger = fastify.log.child({ req, res: reply });
|
||||
|
||||
if (req.validationError) {
|
||||
logger.warn('Validation error', {
|
||||
validationError: req.validationError
|
||||
});
|
||||
logger.warn('Validation error: No username provided');
|
||||
void reply.code(400);
|
||||
return await reply.send({
|
||||
type: 'danger',
|
||||
@@ -235,7 +233,7 @@ export const userPublicGetRoutes: FastifyPluginCallbackTypebox = (
|
||||
const username = req.query.username.toLowerCase();
|
||||
|
||||
if (isRestricted(username)) {
|
||||
logger.info({ username }, 'Restricted username');
|
||||
logger.info(`Restricted username: ${username}`);
|
||||
return await reply.send({ exists: true });
|
||||
}
|
||||
|
||||
@@ -244,6 +242,7 @@ export const userPublicGetRoutes: FastifyPluginCallbackTypebox = (
|
||||
where: { username }
|
||||
})) > 0;
|
||||
|
||||
logger.info(`User exists for username: ${username}`);
|
||||
await reply.send({ exists });
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user