fix: make avatar and name in update me request optional

This commit is contained in:
2023-12-29 11:46:56 +01:00
parent 49cd869e07
commit ebdc350584
2 changed files with 10 additions and 8 deletions

View File

@@ -1,15 +1,14 @@
import { PickType } from '@nestjs/swagger' import { ApiProperty, PickType } from '@nestjs/swagger'
import { IsEmail, IsOptional } from 'class-validator' import { IsOptional } from 'class-validator'
import { User } from '../entities/auth.entity' import { User } from '../entities/auth.entity'
export class UpdateUserDataDto extends PickType(User, ['name', 'email', 'avatar'] as const) { export class UpdateUserDataDto extends PickType(User, ['name', 'avatar'] as const) {
@IsOptional()
@ApiProperty({ required: false })
avatar: string avatar: string
@IsOptional() @IsOptional()
@ApiProperty({ required: false })
name: string name: string
@IsOptional()
@IsEmail()
email: string
} }

View File

@@ -4,7 +4,10 @@ import { CommandHandler, ICommandHandler } from '@nestjs/cqrs'
import { CardsRepository } from '../infrastructure/cards.repository' import { CardsRepository } from '../infrastructure/cards.repository'
export class DeleteCardByIdCommand { export class DeleteCardByIdCommand {
constructor(public readonly id: string, public readonly userId: string) {} constructor(
public readonly id: string,
public readonly userId: string
) {}
} }
@CommandHandler(DeleteCardByIdCommand) @CommandHandler(DeleteCardByIdCommand)