Skip to content

Commit

Permalink
style: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
guilhermeais-luizalabs committed Dec 10, 2024
1 parent 8b354f1 commit 76eafcd
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions src/infra/auth/jwt.strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,29 @@ export class JwtStrategy extends PassportStrategy(Strategy, 'jwt') {

async validate(payload: UserPayload) {
try {
this.logger.log(JwtStrategy.name, `Validating user ${JSON.stringify(payload, null, 2)}`);
const { sub } = tokenPayloadSchema.parse(payload);
this.logger.log(
JwtStrategy.name,
`Validating user ${JSON.stringify(payload, null, 2)}`,
);
const { sub } = tokenPayloadSchema.parse(payload);

this.logger.log(JwtStrategy.name, `Getting user ${sub}`);
this.logger.log(JwtStrategy.name, `Getting user ${sub}`);

const user = await this.getUser.execute({ userId: sub });
const user = await this.getUser.execute({ userId: sub });

this.logger.log(
JwtStrategy.name,
`User ${user.id.toString()} - ${user.name} found`,
);
this.logger.log(
JwtStrategy.name,
`User ${user.id.toString()} - ${user.name} found`,
);

return user;
return user;
} catch (error: any) {
this.logger.error(JwtStrategy.name, `Error validatin the user ${JSON.stringify(payload, null, 2)}: ${error.message}`, error.stack)
throw error
this.logger.error(
JwtStrategy.name,
`Error validating the user ${JSON.stringify(payload, null, 2)}: ${error.message}`,
error.stack,
);
throw error;
}
}

Expand Down

0 comments on commit 76eafcd

Please sign in to comment.