mirror of
https://github.com/KevinMidboe/immich.git
synced 2026-02-12 03:09:20 +00:00
refactor(server): person dto (#3058)
This commit is contained in:
26
server/src/domain/person/person.dto.ts
Normal file
26
server/src/domain/person/person.dto.ts
Normal 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);
|
||||
}
|
||||
Reference in New Issue
Block a user