From 49f1f6cad7d5dce6bdda7c249689dde8a8691a86 Mon Sep 17 00:00:00 2001 From: Jason Rasmussen Date: Fri, 30 Jun 2023 21:52:40 -0400 Subject: [PATCH] refactor(server): person dto (#3058) --- server/src/domain/asset/response-dto/asset-response.dto.ts | 2 +- server/src/domain/person/dto/index.ts | 1 - server/src/domain/person/dto/person-update.dto.ts | 7 ------- server/src/domain/person/index.ts | 3 +-- .../{response-dto/person-response.dto.ts => person.dto.ts} | 7 +++++++ server/src/domain/person/person.service.spec.ts | 2 +- server/src/domain/person/person.service.ts | 3 +-- server/src/domain/person/response-dto/index.ts | 1 - 8 files changed, 11 insertions(+), 15 deletions(-) delete mode 100644 server/src/domain/person/dto/index.ts delete mode 100644 server/src/domain/person/dto/person-update.dto.ts rename server/src/domain/person/{response-dto/person-response.dto.ts => person.dto.ts} (76%) delete mode 100644 server/src/domain/person/response-dto/index.ts diff --git a/server/src/domain/asset/response-dto/asset-response.dto.ts b/server/src/domain/asset/response-dto/asset-response.dto.ts index fa4d057d34..1df6b47e8b 100644 --- a/server/src/domain/asset/response-dto/asset-response.dto.ts +++ b/server/src/domain/asset/response-dto/asset-response.dto.ts @@ -1,6 +1,6 @@ import { AssetEntity, AssetType } from '@app/infra/entities'; import { ApiProperty } from '@nestjs/swagger'; -import { mapFace, PersonResponseDto } from '../../person'; +import { mapFace, PersonResponseDto } from '../../person/person.dto'; import { mapTag, TagResponseDto } from '../../tag'; import { ExifResponseDto, mapExif } from './exif-response.dto'; import { mapSmartInfo, SmartInfoResponseDto } from './smart-info-response.dto'; diff --git a/server/src/domain/person/dto/index.ts b/server/src/domain/person/dto/index.ts deleted file mode 100644 index 5668429a29..0000000000 --- a/server/src/domain/person/dto/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './person-update.dto'; diff --git a/server/src/domain/person/dto/person-update.dto.ts b/server/src/domain/person/dto/person-update.dto.ts deleted file mode 100644 index 72312378ca..0000000000 --- a/server/src/domain/person/dto/person-update.dto.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { IsNotEmpty, IsString } from 'class-validator'; - -export class PersonUpdateDto { - @IsNotEmpty() - @IsString() - name!: string; -} diff --git a/server/src/domain/person/index.ts b/server/src/domain/person/index.ts index 02a38887b7..9c1ae2f7eb 100644 --- a/server/src/domain/person/index.ts +++ b/server/src/domain/person/index.ts @@ -1,4 +1,3 @@ -export * from './dto'; +export * from './person.dto'; export * from './person.repository'; export * from './person.service'; -export * from './response-dto'; diff --git a/server/src/domain/person/response-dto/person-response.dto.ts b/server/src/domain/person/person.dto.ts similarity index 76% rename from server/src/domain/person/response-dto/person-response.dto.ts rename to server/src/domain/person/person.dto.ts index c5e4a221ce..19185dc930 100644 --- a/server/src/domain/person/response-dto/person-response.dto.ts +++ b/server/src/domain/person/person.dto.ts @@ -1,4 +1,11 @@ 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; diff --git a/server/src/domain/person/person.service.spec.ts b/server/src/domain/person/person.service.spec.ts index d431e94af1..6d46b3a978 100644 --- a/server/src/domain/person/person.service.spec.ts +++ b/server/src/domain/person/person.service.spec.ts @@ -9,9 +9,9 @@ import { } from '@test'; import { IJobRepository, JobName } from '..'; import { IStorageRepository } from '../storage'; +import { PersonResponseDto } from './person.dto'; import { IPersonRepository } from './person.repository'; import { PersonService } from './person.service'; -import { PersonResponseDto } from './response-dto'; const responseDto: PersonResponseDto = { id: 'person-1', diff --git a/server/src/domain/person/person.service.ts b/server/src/domain/person/person.service.ts index 85a558355b..48075bee87 100644 --- a/server/src/domain/person/person.service.ts +++ b/server/src/domain/person/person.service.ts @@ -3,9 +3,8 @@ import { AssetResponseDto, mapAsset } from '../asset'; import { AuthUserDto } from '../auth'; import { IJobRepository, JobName } from '../job'; import { ImmichReadStream, IStorageRepository } from '../storage'; -import { PersonUpdateDto } from './dto'; +import { mapPerson, PersonResponseDto, PersonUpdateDto } from './person.dto'; import { IPersonRepository } from './person.repository'; -import { mapPerson, PersonResponseDto } from './response-dto'; @Injectable() export class PersonService { diff --git a/server/src/domain/person/response-dto/index.ts b/server/src/domain/person/response-dto/index.ts deleted file mode 100644 index 0e48d9b0e6..0000000000 --- a/server/src/domain/person/response-dto/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './person-response.dto';