feat: add jwt auth guard and profile endpoint

This commit is contained in:
2026-02-28 08:14:04 +03:30
parent 8212ede785
commit 06f659101d
21 changed files with 371 additions and 31 deletions
@@ -0,0 +1,23 @@
import {
ValidationArguments,
ValidatorConstraint,
ValidatorConstraintInterface,
} from 'class-validator';
@ValidatorConstraint({ name: 'MatchFields', async: false })
export class MatchFieldsConstraint implements ValidatorConstraintInterface {
validate(value: any, args: ValidationArguments): boolean {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const [property] = args.constraints;
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
const relatedValue = (args.object as any)[property];
return value === relatedValue;
}
defaultMessage(args: ValidationArguments): string {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const [property] = args.constraints;
return `${args.property} must match ${property}`;
}
}