profile avatar

This commit is contained in:
2026-07-10 13:50:25 +03:30
parent cefd42de17
commit 42f08397a2
6 changed files with 59 additions and 15 deletions
+15 -1
View File
@@ -1,4 +1,12 @@
import { IsEnum, IsOptional, IsString, Length, Matches } from 'class-validator';
import {
IsEnum,
IsOptional,
IsString,
IsUrl,
Length,
Matches,
ValidateIf,
} from 'class-validator';
import { UserRole } from '../enums/user-role.enum';
export class UpdateUserDto {
@@ -19,4 +27,10 @@ export class UpdateUserDto {
@IsOptional()
@IsEnum(UserRole)
role?: UserRole;
@IsOptional()
@ValidateIf((_, value) => value !== null)
@IsString()
@IsUrl()
avatarUrl?: string | null;
}
+3
View File
@@ -24,6 +24,9 @@ export class User {
@Column({ type: 'enum', enum: UserRole, default: UserRole.CUSTOMER })
role: UserRole;
@Column({ type: 'varchar', length: 500, nullable: true })
avatarUrl: string | null;
@CreateDateColumn()
createdAt: Date;