From 7b1562c050c2f095382e9f3842d5cc853fa7029c Mon Sep 17 00:00:00 2001 From: Daniel Dietzler <36593685+danieldietzler@users.noreply.github.com> Date: Mon, 8 Apr 2024 22:00:08 +0200 Subject: [PATCH] fix(server): remove isWatched from DTO (#8598) * fix: remove isWatched * chore: open api --- mobile/openapi/doc/CreateLibraryDto.md | Bin 739 -> 697 bytes .../openapi/lib/model/create_library_dto.dart | Bin 5862 -> 5171 bytes .../openapi/test/create_library_dto_test.dart | Bin 1253 -> 1152 bytes open-api/immich-openapi-specs.json | 3 --- open-api/typescript-sdk/src/fetch-client.ts | 1 - server/src/dtos/library.dto.ts | 3 --- server/src/services/library.service.spec.ts | 8 -------- server/src/services/library.service.ts | 3 --- .../admin/library-management/+page.svelte | 4 +++- 9 files changed, 3 insertions(+), 19 deletions(-) diff --git a/mobile/openapi/doc/CreateLibraryDto.md b/mobile/openapi/doc/CreateLibraryDto.md index 94e96493ecd5e62c39446c017873031175894ef3..01a2a0f91776167abbbb066ad63d40141bec73e9 100644 GIT binary patch delta 12 TcmaFNx|4OoT*l4E8D$s&BK8E0 delta 22 dcmdnV`j~aYTt?2!;_$?hrQ2A6^6^ delta 48 wcmZqRe9E~Ynwc*tKR-tyvp77lBsn8BW%67mB@Q?zfJJTcdnWeH(afrh0HWy-S^xk5 diff --git a/open-api/immich-openapi-specs.json b/open-api/immich-openapi-specs.json index 38df22f00..a61a60eb8 100644 --- a/open-api/immich-openapi-specs.json +++ b/open-api/immich-openapi-specs.json @@ -8000,9 +8000,6 @@ "isVisible": { "type": "boolean" }, - "isWatched": { - "type": "boolean" - }, "name": { "type": "string" }, diff --git a/open-api/typescript-sdk/src/fetch-client.ts b/open-api/typescript-sdk/src/fetch-client.ts index 999fa23fa..4d2cfa041 100644 --- a/open-api/typescript-sdk/src/fetch-client.ts +++ b/open-api/typescript-sdk/src/fetch-client.ts @@ -461,7 +461,6 @@ export type CreateLibraryDto = { exclusionPatterns?: string[]; importPaths?: string[]; isVisible?: boolean; - isWatched?: boolean; name?: string; ownerId: string; "type": LibraryType; diff --git a/server/src/dtos/library.dto.ts b/server/src/dtos/library.dto.ts index 951012a85..b693d35ad 100644 --- a/server/src/dtos/library.dto.ts +++ b/server/src/dtos/library.dto.ts @@ -32,9 +32,6 @@ export class CreateLibraryDto { @ArrayUnique() @ArrayMaxSize(128) exclusionPatterns?: string[]; - - @ValidateBoolean({ optional: true }) - isWatched?: boolean; } export class UpdateLibraryDto { diff --git a/server/src/services/library.service.spec.ts b/server/src/services/library.service.spec.ts index df59d0c15..95e3655cb 100644 --- a/server/src/services/library.service.spec.ts +++ b/server/src/services/library.service.spec.ts @@ -1058,14 +1058,6 @@ describe(LibraryService.name, () => { expect(libraryMock.create).not.toHaveBeenCalled(); }); - - it('should not create watched', async () => { - await expect( - sut.create({ ownerId: authStub.admin.user.id, type: LibraryType.UPLOAD, isWatched: true }), - ).rejects.toBeInstanceOf(BadRequestException); - - expect(storageMock.watch).not.toHaveBeenCalled(); - }); }); }); diff --git a/server/src/services/library.service.ts b/server/src/services/library.service.ts index d0e41da17..63066866f 100644 --- a/server/src/services/library.service.ts +++ b/server/src/services/library.service.ts @@ -266,9 +266,6 @@ export class LibraryService extends EventEmitter { if (dto.exclusionPatterns && dto.exclusionPatterns.length > 0) { throw new BadRequestException('Upload libraries cannot have exclusion patterns'); } - if (dto.isWatched) { - throw new BadRequestException('Upload libraries cannot be watched'); - } break; } } diff --git a/web/src/routes/admin/library-management/+page.svelte b/web/src/routes/admin/library-management/+page.svelte index 1efc7f778..723a6994b 100644 --- a/web/src/routes/admin/library-management/+page.svelte +++ b/web/src/routes/admin/library-management/+page.svelte @@ -118,7 +118,9 @@ const handleCreate = async (ownerId: string) => { try { - const createdLibrary = await createLibrary({ createLibraryDto: { ownerId, type: LibraryType.External } }); + const createdLibrary = await createLibrary({ + createLibraryDto: { ownerId, type: LibraryType.External }, + }); notificationController.show({ message: `Created library: ${createdLibrary.name}`,