feat(server): create a person with optional values (#7706)
* feat: create person dto * chore: open api * fix: e2e * fix: web usage
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
import { AssetFaceEntity, PersonEntity } from '@app/infra/entities';
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { Transform, Type } from 'class-transformer';
|
||||
import { IsArray, IsBoolean, IsDate, IsNotEmpty, IsString, ValidateNested } from 'class-validator';
|
||||
import { IsArray, IsBoolean, IsDate, IsNotEmpty, IsString, MaxDate, ValidateNested } from 'class-validator';
|
||||
import { AuthDto } from '../auth';
|
||||
import { Optional, ValidateUUID, toBoolean } from '../domain.util';
|
||||
|
||||
export class PersonUpdateDto {
|
||||
export class PersonCreateDto {
|
||||
/**
|
||||
* Person name.
|
||||
*/
|
||||
@@ -20,16 +20,10 @@ export class PersonUpdateDto {
|
||||
@Optional({ nullable: true })
|
||||
@IsDate()
|
||||
@Type(() => Date)
|
||||
@MaxDate(() => new Date(), { message: 'Birth date cannot be in the future' })
|
||||
@ApiProperty({ format: 'date' })
|
||||
birthDate?: Date | null;
|
||||
|
||||
/**
|
||||
* Asset is used to get the feature face thumbnail.
|
||||
*/
|
||||
@Optional()
|
||||
@IsString()
|
||||
featureFaceAssetId?: string;
|
||||
|
||||
/**
|
||||
* Person visibility
|
||||
*/
|
||||
@@ -38,6 +32,15 @@ export class PersonUpdateDto {
|
||||
isHidden?: boolean;
|
||||
}
|
||||
|
||||
export class PersonUpdateDto extends PersonCreateDto {
|
||||
/**
|
||||
* Asset is used to get the feature face thumbnail.
|
||||
*/
|
||||
@Optional()
|
||||
@IsString()
|
||||
featureFaceAssetId?: string;
|
||||
}
|
||||
|
||||
export class PeopleUpdateDto {
|
||||
@IsArray()
|
||||
@ValidateNested({ each: true })
|
||||
|
||||
Reference in New Issue
Block a user