refactor(server): person dto (#3058)

This commit is contained in:
Jason Rasmussen
2023-06-30 21:52:40 -04:00
committed by GitHub
parent 399312ead3
commit 49f1f6cad7
8 changed files with 11 additions and 15 deletions

View File

@@ -0,0 +1,26 @@
import { AssetFaceEntity, PersonEntity } from '@app/infra/entities';
import { IsNotEmpty, IsString } from 'class-validator';
export class PersonUpdateDto {
@IsNotEmpty()
@IsString()
name!: string;
}
export class PersonResponseDto {
id!: string;
name!: string;
thumbnailPath!: string;
}
export function mapPerson(person: PersonEntity): PersonResponseDto {
return {
id: person.id,
name: person.name,
thumbnailPath: person.thumbnailPath,
};
}
export function mapFace(face: AssetFaceEntity): PersonResponseDto {
return mapPerson(face.person);
}