Something went wrong. Try again.
Synapse is a study workspace. Organize courses read and annotate the material, train with generated exercises and watch your progress forked from denishovart.com/synapse
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940import { IsIn, IsOptional, IsString, MinLength } from 'class-validator';
// Login / bootstrap credentials. Length rules on registration live in the// service (single source of truth); here we only require presence so the// login route gives a clean 401 rather than a 400 on an empty field.export class CredentialsDto { @IsString() username!: string; @IsString() password!: string;}
export class RegisterDto { @IsString() @MinLength(1) username!: string; @IsString() @MinLength(8) password!: string;}
// Change-password: the new password enforces the same floor as registration;// the current one only needs presence (a wrong value 401s in the service).export class ChangePasswordDto { @IsString() currentPassword!: string; @IsString() @MinLength(8) newPassword!: string;}
// Admin-created account. The initial password is set by the admin and handed// over out of band; the user changes it themselves in Settings → Account.export class CreateUserDto { @IsString() @MinLength(1) username!: string; @IsString() @MinLength(8) password!: string; @IsOptional() @IsIn(['user', 'admin']) role?: 'user' | 'admin';}
// Admin-driven password reset for another account.export class ResetUserPasswordDto { @IsString() @MinLength(8) password!: string;}
// Admin-driven role change for another account.export class SetRoleDto { @IsIn(['user', 'admin']) role!: 'user' | 'admin';}