feat: add JWT authentication

This commit is contained in:
Cesar
2026-05-22 17:13:24 -06:00
parent 397c2ef3df
commit 45d6347d4c
15 changed files with 524 additions and 12 deletions

View File

@@ -0,0 +1,21 @@
export class RegisterUserDto {
private constructor(
public readonly name: string,
public readonly email: string,
public readonly password: string,
) {}
static create(props: { [key: string]: any }): [string | undefined, RegisterUserDto?] {
const { name, email, password } = props;
if (!name) return ['name is required'];
if (!email) return ['email is required'];
if (!password) return ['password is required'];
if (password.length < 6) {
return ['password must be at least 6 characters'];
}
return [undefined, new RegisterUserDto(name, email, password)];
}
}