From 39d2c4f37bdc3d4e559a018df56b583ddd024d14 Mon Sep 17 00:00:00 2001 From: Zack Pollard Date: Fri, 24 May 2024 15:37:01 +0100 Subject: [PATCH] chore: remove all deprecated endpoints/properties from server and mobile app (#9724) * chore: remove deprecated title property from MemoryLaneResponseDto * chore: remove deprecated webpPath and resizePath from MetadataSearchDto * chore: remove deprecated sharedUserIds property from Album AddUsersDto * chore: remove deprecated sharedUsers property from AlbumResponseDto * chore: remove deprecated sharedWithUserIds property from CreateAlbumDto * chore: remove deprecated isExternal and isReadOnly properties from AssetResponseDto * chore: remove deprecated /server-info endpoint * chore: bloody linters --- e2e/src/api/specs/album.e2e-spec.ts | 7 +- e2e/src/api/specs/server-info.e2e-spec.ts | 6 +- mobile/lib/entities/album.entity.dart | 7 +- mobile/lib/services/album.service.dart | 9 +- mobile/lib/services/memory.service.dart | 6 +- mobile/lib/services/sync.service.dart | 10 +- ...e_first_letter.dart => string_helper.dart} | 2 + mobile/openapi/README.md | Bin 27544 -> 27342 bytes mobile/openapi/lib/api.dart | Bin 9782 -> 9750 bytes mobile/openapi/lib/api/deprecated_api.dart | Bin 1893 -> 0 bytes mobile/openapi/lib/api/server_info_api.dart | Bin 13099 -> 11635 bytes mobile/openapi/lib/model/add_users_dto.dart | Bin 3250 -> 2789 bytes .../openapi/lib/model/album_response_dto.dart | Bin 9958 -> 9586 bytes .../openapi/lib/model/asset_response_dto.dart | Bin 14403 -> 12899 bytes .../openapi/lib/model/create_album_dto.dart | Bin 4718 -> 4167 bytes .../lib/model/memory_lane_response_dto.dart | Bin 3422 -> 3164 bytes .../lib/model/metadata_search_dto.dart | Bin 32169 -> 30685 bytes open-api/immich-openapi-specs.json | 92 ------------------ open-api/typescript-sdk/src/fetch-client.ts | 46 ++------- .../src/controllers/server-info.controller.ts | 8 -- server/src/dtos/album.dto.ts | 13 --- server/src/dtos/asset-response.dto.ts | 9 -- server/src/dtos/search.dto.ts | 13 --- server/src/services/album.service.spec.ts | 4 +- server/src/services/album.service.ts | 15 +-- server/src/services/search.service.ts | 3 - server/test/fixtures/shared-link.stub.ts | 2 - .../album-page/album-options.svelte | 2 +- .../album-page/user-selection-modal.svelte | 4 +- .../asset-viewer/detail-panel.svelte | 2 +- .../[[assetId=id]]/+page.svelte | 16 +-- web/src/test-data/factories/album-factory.ts | 1 - 32 files changed, 56 insertions(+), 221 deletions(-) rename mobile/lib/utils/{capitalize_first_letter.dart => string_helper.dart} (75%) delete mode 100644 mobile/openapi/lib/api/deprecated_api.dart diff --git a/e2e/src/api/specs/album.e2e-spec.ts b/e2e/src/api/specs/album.e2e-spec.ts index 5cebe8f42..4a231dbf9 100644 --- a/e2e/src/api/specs/album.e2e-spec.ts +++ b/e2e/src/api/specs/album.e2e-spec.ts @@ -383,7 +383,6 @@ describe('/albums', () => { description: '', albumThumbnailAssetId: null, shared: false, - sharedUsers: [], albumUsers: [], hasSharedLink: false, assets: [], @@ -611,7 +610,11 @@ describe('/albums', () => { expect(status).toBe(200); expect(body).toEqual( expect.objectContaining({ - sharedUsers: [expect.objectContaining({ id: user2.userId })], + albumUsers: [ + expect.objectContaining({ + user: expect.objectContaining({ id: user2.userId }), + }), + ], }), ); }); diff --git a/e2e/src/api/specs/server-info.e2e-spec.ts b/e2e/src/api/specs/server-info.e2e-spec.ts index 34af159a6..431971ac8 100644 --- a/e2e/src/api/specs/server-info.e2e-spec.ts +++ b/e2e/src/api/specs/server-info.e2e-spec.ts @@ -15,16 +15,16 @@ describe('/server-info', () => { nonAdmin = await utils.userSetup(admin.accessToken, createUserDto.user1); }); - describe('GET /server-info', () => { + describe('GET /server-info/storage', () => { it('should require authentication', async () => { - const { status, body } = await request(app).get('/server-info'); + const { status, body } = await request(app).get('/server-info/storage'); expect(status).toBe(401); expect(body).toEqual(errorDto.unauthorized); }); it('should return the disk information', async () => { const { status, body } = await request(app) - .get('/server-info') + .get('/server-info/storage') .set('Authorization', `Bearer ${admin.accessToken}`); expect(status).toBe(200); expect(body).toEqual({ diff --git a/mobile/lib/entities/album.entity.dart b/mobile/lib/entities/album.entity.dart index 49a38322e..c05b849dc 100644 --- a/mobile/lib/entities/album.entity.dart +++ b/mobile/lib/entities/album.entity.dart @@ -145,9 +145,10 @@ class Album { .remoteIdEqualTo(dto.albumThumbnailAssetId) .findFirst(); } - if (dto.sharedUsers.isNotEmpty) { - final users = await db.users - .getAllById(dto.sharedUsers.map((e) => e.id).toList(growable: false)); + if (dto.albumUsers.isNotEmpty) { + final users = await db.users.getAllById( + dto.albumUsers.map((e) => e.user.id).toList(growable: false), + ); a.sharedUsers.addAll(users.cast()); } if (dto.assets.isNotEmpty) { diff --git a/mobile/lib/services/album.service.dart b/mobile/lib/services/album.service.dart index bdf38a42a..c6d70c269 100644 --- a/mobile/lib/services/album.service.dart +++ b/mobile/lib/services/album.service.dart @@ -180,7 +180,14 @@ class AlbumService { CreateAlbumDto( albumName: albumName, assetIds: assets.map((asset) => asset.remoteId!).toList(), - sharedWithUserIds: sharedUsers.map((e) => e.id).toList(), + albumUsers: sharedUsers + .map( + (e) => AlbumUserCreateDto( + userId: e.id, + role: AlbumUserRole.editor, + ), + ) + .toList(), ), ); if (remote != null) { diff --git a/mobile/lib/services/memory.service.dart b/mobile/lib/services/memory.service.dart index 96b8c6900..b426214c0 100644 --- a/mobile/lib/services/memory.service.dart +++ b/mobile/lib/services/memory.service.dart @@ -8,6 +8,8 @@ import 'package:isar/isar.dart'; import 'package:logging/logging.dart'; import 'package:openapi/api.dart'; +import '../utils/string_helper.dart'; + final memoryServiceProvider = StateProvider((ref) { return MemoryService( ref.watch(apiServiceProvider), @@ -36,13 +38,13 @@ class MemoryService { } List memories = []; - for (final MemoryLaneResponseDto(:title, :assets) in data) { + for (final MemoryLaneResponseDto(:yearsAgo, :assets) in data) { final dbAssets = await _db.assets.getAllByRemoteId(assets.map((e) => e.id)); if (dbAssets.isNotEmpty) { memories.add( Memory( - title: title, + title: '$yearsAgo year${s(yearsAgo)} ago', assets: dbAssets, ), ); diff --git a/mobile/lib/services/sync.service.dart b/mobile/lib/services/sync.service.dart index acbd34d18..8ec56e925 100644 --- a/mobile/lib/services/sync.service.dart +++ b/mobile/lib/services/sync.service.dart @@ -362,15 +362,15 @@ class SyncService { // update shared users final List sharedUsers = album.sharedUsers.toList(growable: false); sharedUsers.sort((a, b) => a.id.compareTo(b.id)); - dto.sharedUsers.sort((a, b) => a.id.compareTo(b.id)); + dto.albumUsers.sort((a, b) => a.user.id.compareTo(b.user.id)); final List userIdsToAdd = []; final List usersToUnlink = []; diffSortedListsSync( - dto.sharedUsers, + dto.albumUsers, sharedUsers, - compare: (UserResponseDto a, User b) => a.id.compareTo(b.id), + compare: (AlbumUserResponseDto a, User b) => a.user.id.compareTo(b.id), both: (a, b) => false, - onlyFirst: (UserResponseDto a) => userIdsToAdd.add(a.id), + onlyFirst: (AlbumUserResponseDto a) => userIdsToAdd.add(a.user.id), onlySecond: (User a) => usersToUnlink.add(a), ); @@ -905,7 +905,7 @@ bool _hasAlbumResponseDtoChanged(AlbumResponseDto dto, Album a) { dto.albumName != a.name || dto.albumThumbnailAssetId != a.thumbnail.value?.remoteId || dto.shared != a.shared || - dto.sharedUsers.length != a.sharedUsers.length || + dto.albumUsers.length != a.sharedUsers.length || !dto.updatedAt.isAtSameMomentAs(a.modifiedAt) || !isAtSameMomentAs(dto.startDate, a.startDate) || !isAtSameMomentAs(dto.endDate, a.endDate) || diff --git a/mobile/lib/utils/capitalize_first_letter.dart b/mobile/lib/utils/string_helper.dart similarity index 75% rename from mobile/lib/utils/capitalize_first_letter.dart rename to mobile/lib/utils/string_helper.dart index c1fbb40f8..201d14153 100644 --- a/mobile/lib/utils/capitalize_first_letter.dart +++ b/mobile/lib/utils/string_helper.dart @@ -3,3 +3,5 @@ extension StringExtension on String { return "${this[0].toUpperCase()}${substring(1).toLowerCase()}"; } } + +String s(num count) => (count == 1 ? '' : 's'); diff --git a/mobile/openapi/README.md b/mobile/openapi/README.md index 4b5ef2f0ddb3eee4cc83972371a44b28c33350f8..402c3ccca070c7e6603d889d6499f7a6546e36b8 100644 GIT binary patch delta 27 jcmbPno$=gN#tnNVCx4X^oIFp8W3#oCr|9OF`s=L$uqz9^ delta 113 zcmX?im2t*(#tnNV-BSySQj-%)Qd1lYGPM+H6r#1X(o;)EzYf_+orDoQ_9udj4q~!)O8*lPUZ)8J(a0^Mci! z=AW4`bo4qocpJH^oGWcG&9zB$S>hqosE5vTq?DY(0N5}bZ+mdKxxvxa zc`$$sb5WPHHsoLcxm2QrwQOVIU;7OCw2&4m!&w?y!BSXu)aC|K!TmvUu>VK0&(2sq zeBnY9H^-YYqJ_@DAk{`$paS9Jbb1LlS7<8+6K@kXI<5H`-?y@3m?K@Ixkq!Za{Wb8 z@sX%<=WY*#U8$J|#l>t$amYzx&M^B9r5Q4iMv&wX?7ywF5>zlSrqj3H`zy&VJHFUm zzC1kKznLh5m&x6~IAhE!ZRvx~R*hwV@mq~%b?I1SImY|H*Vp5l+jm<@6euz@8^vof zQq5xs|HluH+se%K#cx%;V_!7zmzWaMRfRr-#-WSunhi}CHeF7ny4U~V@bbLt-vJyz zadYmRji;UVvQ=CwYC&l4+jX_FP5P~5JIO@a@uFg04M5dp$@G2l>c=qH^&BRTu8RLj z%7$5iOxL81m}5(`5$VA%RQrWqp|Pf+svD`Lkn}rthTh2>x~)~h3xjHVqBDf!BXC5% z_LAgIWLLa{&{D6VGw^^Iy>t^f{yxLX@pqS_xJktEoc%f~epnIOwQkP?<{)!@=PCJ8 zpaQ`RSnzB@VE=k5m4-WZ0ZSe z(3vcaB&IXVq>bULTi}P>RUT#f$^qC-C{ZZb`>gPL#RG*Ipvs)JRJ@t@TGyvcenD#_ zVCjk=v-19Rn+tnF&m!vwDJ1r!1Fksc8n2~5x0f%u^ss)myYu2nca%N}^R#JB*kTR# x>%E&~$aqRo${#p%yQv#k@_ch*=sZWrPV5#OJog;vCbuj<{ diff --git a/mobile/openapi/lib/api/server_info_api.dart b/mobile/openapi/lib/api/server_info_api.dart index 6e55c62759041511ef8c745f3a51be8ce69c01f7..76da103b707ead52281dca55436261dc406ee564 100644 GIT binary patch delta 16 YcmZ3T_Bm?9B%aB)#g#Yb3hh$>07ef7WdHyG delta 199 zcmewywK{FXB%bh)jLc$%f};F_)S{9~h4RE=g_P8SqSWNXlGGH1%shoMLp?(SGd%+? z1qFS5eF&-GmtT@ufnAfuGcPTF@@J}FZ@IhU7v^8udC3IIf% BLe>BP diff --git a/mobile/openapi/lib/model/add_users_dto.dart b/mobile/openapi/lib/model/add_users_dto.dart index 7ecb0de5e88ada47e4bab352d3e8f3aa3eb5f84b..2daa571265da6ff1a4b46a247bfffd1ac0bcef37 100644 GIT binary patch delta 37 vcmV+=0NVeu8RZqQlL3>q0W6a+0+y2o17(wn14)zd1Aeoj1fK!3?FPjK6+{lR delta 424 zcmaDVx=C`wWJX~Hg_4ZSV!h&w#G=%c(Bjl0&y>l{j5Z$n`uYkXKpBOCqWpr?qLNC5 z^2B0=l+=Qv)a1mH)D(rxJcTktJwpQ{Jp(QU1)t2~5}V+XqRhN>I|UTOb~4VHEX|}W zjVxHKgQ_N&DP2TC8)%Gzf(Ej>$?KUyWKq=?+p3_bU}CPp(690eb}v999AY38q6+FF6qrDjJ%4 qCHbIW(nv2-%`XQTX{C^sm{XjpiDI;sLUMjyafw27>}Cnpv#bDJm5r1D diff --git a/mobile/openapi/lib/model/album_response_dto.dart b/mobile/openapi/lib/model/album_response_dto.dart index fcdb6c096090a7d3f7d04f860e3b4625df28975b..c98a95775d2c8c6b019a98f4f75ad137c9547dd2 100644 GIT binary patch delta 55 zcmV-70LcI5P4Y^xR|B(n1KJXmM&$v4X8aa(-TMi9&SjW^d*lEs#WJ~*TUruHPzPCs=H`vOH<`GQw3G`-F^MDiwkk+kH}?q{vuY|RWEJPS0z0!E16~A^90@10j@6tsq#lj3M0#lc+0xvt=ya3+xLV3;+NC delta 522 zcmaEya=2i_4krGRjLc%a%wpGylGLKS#GJ_&n8YTZVA6((2c;&a_~+$Rg2Xp7GyAbj z?q=6yHqkTK%*d6%D3Fw&pJT6pq}_*I2fGTGL7R)&&#{TYtW&VHMb>S|7bON$2$6#E zHdpi2uqYvG%PY;vQLtAqP_RNWL2>e9A#Wv^CXf**%3u>k|PX4Xh#Q{?cmVXTZQEOyy6mt=-A0G85Pv^ z_4O4(fGQOVit-Cmi%KdL$`gwf5>rxAQxr1u6v_@5Imx6*%W^sv4a7j^SUb>wEhD$c@W>#RFT+5=YiXo+gsakXLZI(-t3fe$p6%;fu zbWC2%I!g_UHd_@8rJHTpVj0a86tar*^P-E?G33=_fnkI_@T@maWxv3rrGV)?E9}Ni Vp3AAhhib#*Q=Ac-Q@I|o0su3Wm*xNf diff --git a/mobile/openapi/lib/model/memory_lane_response_dto.dart b/mobile/openapi/lib/model/memory_lane_response_dto.dart index bf6e8e2cce9988fb2039a85936eb0e2c1fb893f0..4abe607381f35acfed0e1c985fbb5584fd59229f 100644 GIT binary patch delta 57 zcmV-90LK5`8r&GLy#bTf0X36L0=JVM1AUXS17DLL1d+4T1lR$y;|5y>6M1D}a&tjv PZzn7YARv7^3VjL+mnsxa delta 215 zcmca3aZhT)UPjiE%#xhc$txK>t@ZWw6+$vHixmor@(WUnN-7n~6N?p6QVWVwlM_o) zQxr1u6v_@3e2AxtZU+{A*g#GKMp|Fn?Gf>axbb#@wA#rb(U3PtJ= S{hErKpRlH~K`nCRkp=)uCQIJ{ diff --git a/mobile/openapi/lib/model/metadata_search_dto.dart b/mobile/openapi/lib/model/metadata_search_dto.dart index c5aeb11066d8f775572ff88401cfa6281931750d..322373ee5815dcbb6b6a3824f2dbeaf85c6a6f48 100644 GIT binary patch delta 81 zcmV-X0IvV3`vKkW0kEF~le7cSvzG+gB(oGN!Va@{I|>T3r$u)Gvp`2P2D7P67Xq{L nPhta;Y*XvAYgGRYv+-in1(T~`3A0RTQVO%*b6Enjb#^od%<3aa delta 503 zcmccno^j=G#trkC*@{w&GpkZ3Phh^!o|;q;kXVwjIho~|ibhCAX0bv+QGP*cQAwpj zd1A3bN@_t-YI0&pYKlT;oPWLtZ8mEFwYTh%lW~;K&XD0^hUw diff --git a/open-api/immich-openapi-specs.json b/open-api/immich-openapi-specs.json index 4bec15e4a..980961153 100644 --- a/open-api/immich-openapi-specs.json +++ b/open-api/immich-openapi-specs.json @@ -4399,44 +4399,6 @@ ] } }, - "/server-info": { - "get": { - "deprecated": true, - "description": "This property was deprecated in v1.106.0", - "operationId": "getServerInfo", - "parameters": [], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ServerStorageResponseDto" - } - } - }, - "description": "" - } - }, - "security": [ - { - "bearer": [] - }, - { - "cookie": [] - }, - { - "api_key": [] - } - ], - "tags": [ - "Server Info", - "Deprecated" - ], - "x-immich-lifecycle": { - "deprecatedAt": "v1.106.0" - } - } - }, "/server-info/config": { "get": { "operationId": "getServerConfig", @@ -6738,15 +6700,6 @@ "$ref": "#/components/schemas/AlbumUserAddDto" }, "type": "array" - }, - "sharedUserIds": { - "deprecated": true, - "description": "This property was deprecated in v1.102.0", - "items": { - "format": "uuid", - "type": "string" - }, - "type": "array" } }, "required": [ @@ -6844,14 +6797,6 @@ "shared": { "type": "boolean" }, - "sharedUsers": { - "deprecated": true, - "description": "This property was deprecated in v1.102.0", - "items": { - "$ref": "#/components/schemas/UserResponseDto" - }, - "type": "array" - }, "startDate": { "format": "date-time", "type": "string" @@ -6875,7 +6820,6 @@ "owner", "ownerId", "shared", - "sharedUsers", "updatedAt" ], "type": "object" @@ -7495,22 +7439,12 @@ "isArchived": { "type": "boolean" }, - "isExternal": { - "deprecated": true, - "description": "This property was deprecated in v1.104.0", - "type": "boolean" - }, "isFavorite": { "type": "boolean" }, "isOffline": { "type": "boolean" }, - "isReadOnly": { - "deprecated": true, - "description": "This property was deprecated in v1.104.0", - "type": "boolean" - }, "isTrashed": { "type": "boolean" }, @@ -7801,7 +7735,6 @@ "type": "string" }, "albumUsers": { - "description": "This property was added in v1.104.0", "items": { "$ref": "#/components/schemas/AlbumUserCreateDto" }, @@ -7816,15 +7749,6 @@ }, "description": { "type": "string" - }, - "sharedWithUserIds": { - "deprecated": true, - "description": "This property was deprecated in v1.104.0", - "items": { - "format": "uuid", - "type": "string" - }, - "type": "array" } }, "required": [ @@ -8672,18 +8596,12 @@ }, "type": "array" }, - "title": { - "deprecated": true, - "description": "This property was deprecated in v1.100.0", - "type": "string" - }, "yearsAgo": { "type": "integer" } }, "required": [ "assets", - "title", "yearsAgo" ], "type": "object" @@ -8874,11 +8792,6 @@ "previewPath": { "type": "string" }, - "resizePath": { - "deprecated": true, - "description": "This property was deprecated in v1.100.0", - "type": "string" - }, "size": { "maximum": 1000, "minimum": 1, @@ -8917,11 +8830,6 @@ "format": "date-time", "type": "string" }, - "webpPath": { - "deprecated": true, - "description": "This property was deprecated in v1.100.0", - "type": "string" - }, "withArchived": { "default": false, "type": "boolean" diff --git a/open-api/typescript-sdk/src/fetch-client.ts b/open-api/typescript-sdk/src/fetch-client.ts index 2f895a76e..29ae94c42 100644 --- a/open-api/typescript-sdk/src/fetch-client.ts +++ b/open-api/typescript-sdk/src/fetch-client.ts @@ -123,12 +123,8 @@ export type AssetResponseDto = { hasMetadata: boolean; id: string; isArchived: boolean; - /** This property was deprecated in v1.104.0 */ - isExternal?: boolean; isFavorite: boolean; isOffline: boolean; - /** This property was deprecated in v1.104.0 */ - isReadOnly?: boolean; isTrashed: boolean; /** This property was deprecated in v1.106.0 */ libraryId?: string | null; @@ -166,8 +162,6 @@ export type AlbumResponseDto = { owner: UserResponseDto; ownerId: string; shared: boolean; - /** This property was deprecated in v1.102.0 */ - sharedUsers: UserResponseDto[]; startDate?: string; updatedAt: string; }; @@ -177,12 +171,9 @@ export type AlbumUserCreateDto = { }; export type CreateAlbumDto = { albumName: string; - /** This property was added in v1.104.0 */ albumUsers?: AlbumUserCreateDto[]; assetIds?: string[]; description?: string; - /** This property was deprecated in v1.104.0 */ - sharedWithUserIds?: string[]; }; export type AlbumCountResponseDto = { notShared: number; @@ -213,8 +204,6 @@ export type AlbumUserAddDto = { }; export type AddUsersDto = { albumUsers: AlbumUserAddDto[]; - /** This property was deprecated in v1.102.0 */ - sharedUserIds?: string[]; }; export type ApiKeyResponseDto = { createdAt: string; @@ -285,8 +274,6 @@ export type MapMarkerResponseDto = { }; export type MemoryLaneResponseDto = { assets: AssetResponseDto[]; - /** This property was deprecated in v1.100.0 */ - title: string; yearsAgo: number; }; export type UpdateStackParentDto = { @@ -660,8 +647,6 @@ export type MetadataSearchDto = { page?: number; personIds?: string[]; previewPath?: string; - /** This property was deprecated in v1.100.0 */ - resizePath?: string; size?: number; state?: string; takenAfter?: string; @@ -672,8 +657,6 @@ export type MetadataSearchDto = { "type"?: AssetTypeEnum; updatedAfter?: string; updatedBefore?: string; - /** This property was deprecated in v1.100.0 */ - webpPath?: string; withArchived?: boolean; withDeleted?: boolean; withExif?: boolean; @@ -745,15 +728,6 @@ export type SmartSearchDto = { withDeleted?: boolean; withExif?: boolean; }; -export type ServerStorageResponseDto = { - diskAvailable: string; - diskAvailableRaw: number; - diskSize: string; - diskSizeRaw: number; - diskUsagePercentage: number; - diskUse: string; - diskUseRaw: number; -}; export type ServerConfigDto = { externalDomain: string; isInitialized: boolean; @@ -801,6 +775,15 @@ export type ServerStatsResponseDto = { usageByUser: UsageByUserDto[]; videos: number; }; +export type ServerStorageResponseDto = { + diskAvailable: string; + diskAvailableRaw: number; + diskSize: string; + diskSizeRaw: number; + diskUsagePercentage: number; + diskUse: string; + diskUseRaw: number; +}; export type ServerThemeDto = { customCss: string; }; @@ -2277,17 +2260,6 @@ export function getSearchSuggestions({ country, make, model, state, $type }: { ...opts })); } -/** - * This property was deprecated in v1.106.0 - */ -export function getServerInfo(opts?: Oazapfts.RequestOpts) { - return oazapfts.ok(oazapfts.fetchJson<{ - status: 200; - data: ServerStorageResponseDto; - }>("/server-info", { - ...opts - })); -} export function getServerConfig(opts?: Oazapfts.RequestOpts) { return oazapfts.ok(oazapfts.fetchJson<{ status: 200; diff --git a/server/src/controllers/server-info.controller.ts b/server/src/controllers/server-info.controller.ts index 308778dbb..03968c1f5 100644 --- a/server/src/controllers/server-info.controller.ts +++ b/server/src/controllers/server-info.controller.ts @@ -1,6 +1,5 @@ import { Controller, Get } from '@nestjs/common'; import { ApiTags } from '@nestjs/swagger'; -import { EndpointLifecycle } from 'src/decorators'; import { ServerConfigDto, ServerFeaturesDto, @@ -23,13 +22,6 @@ export class ServerInfoController { private versionService: VersionService, ) {} - @Get() - @EndpointLifecycle({ deprecatedAt: 'v1.106.0' }) - @Authenticated() - getServerInfo(): Promise { - return this.service.getStorage(); - } - @Get('storage') @Authenticated() getStorage(): Promise { diff --git a/server/src/dtos/album.dto.ts b/server/src/dtos/album.dto.ts index 19d03a4d8..21eb649e1 100644 --- a/server/src/dtos/album.dto.ts +++ b/server/src/dtos/album.dto.ts @@ -2,7 +2,6 @@ import { ApiProperty } from '@nestjs/swagger'; import { Type } from 'class-transformer'; import { ArrayNotEmpty, IsArray, IsEnum, IsString, ValidateNested } from 'class-validator'; import _ from 'lodash'; -import { PropertyLifecycle } from 'src/decorators'; import { AssetResponseDto, mapAsset } from 'src/dtos/asset-response.dto'; import { AuthDto } from 'src/dtos/auth.dto'; import { UserResponseDto, mapUser } from 'src/dtos/user.dto'; @@ -25,10 +24,6 @@ export class AlbumUserAddDto { } export class AddUsersDto { - @ValidateUUID({ each: true, optional: true }) - @PropertyLifecycle({ deprecatedAt: 'v1.102.0' }) - sharedUserIds?: string[]; - @ArrayNotEmpty() albumUsers!: AlbumUserAddDto[]; } @@ -55,13 +50,8 @@ export class CreateAlbumDto { @IsArray() @ValidateNested({ each: true }) @Type(() => AlbumUserCreateDto) - @PropertyLifecycle({ addedAt: 'v1.104.0' }) albumUsers?: AlbumUserCreateDto[]; - @ValidateUUID({ optional: true, each: true }) - @PropertyLifecycle({ deprecatedAt: 'v1.104.0' }) - sharedWithUserIds?: string[]; - @ValidateUUID({ optional: true, each: true }) assetIds?: string[]; } @@ -137,8 +127,6 @@ export class AlbumResponseDto { updatedAt!: Date; albumThumbnailAssetId!: string | null; shared!: boolean; - @PropertyLifecycle({ deprecatedAt: 'v1.102.0' }) - sharedUsers!: UserResponseDto[]; albumUsers!: AlbumUserResponseDto[]; hasSharedLink!: boolean; assets!: AssetResponseDto[]; @@ -192,7 +180,6 @@ export const mapAlbum = (entity: AlbumEntity, withAssets: boolean, auth?: AuthDt id: entity.id, ownerId: entity.ownerId, owner: mapUser(entity.owner), - sharedUsers, albumUsers: albumUsersSorted, shared: hasSharedUser || hasSharedLink, hasSharedLink, diff --git a/server/src/dtos/asset-response.dto.ts b/server/src/dtos/asset-response.dto.ts index 2cf12061d..3d6cd4cad 100644 --- a/server/src/dtos/asset-response.dto.ts +++ b/server/src/dtos/asset-response.dto.ts @@ -37,10 +37,6 @@ export class AssetResponseDto extends SanitizedAssetResponseDto { isArchived!: boolean; isTrashed!: boolean; isOffline!: boolean; - @PropertyLifecycle({ deprecatedAt: 'v1.104.0' }) - isExternal?: boolean; - @PropertyLifecycle({ deprecatedAt: 'v1.104.0' }) - isReadOnly?: boolean; exifInfo?: ExifResponseDto; smartInfo?: SmartInfoResponseDto; tags?: TagResponseDto[]; @@ -129,17 +125,12 @@ export function mapAsset(entity: AssetEntity, options: AssetMapOptions = {}): As : undefined, stackCount: entity.stack?.assets?.length ?? null, isOffline: entity.isOffline, - isExternal: false, - isReadOnly: false, hasMetadata: true, duplicateId: entity.duplicateId, }; } export class MemoryLaneResponseDto { - @PropertyLifecycle({ deprecatedAt: 'v1.100.0' }) - title!: string; - @ApiProperty({ type: 'integer' }) yearsAgo!: number; diff --git a/server/src/dtos/search.dto.ts b/server/src/dtos/search.dto.ts index 4d05b9f3a..5927aa86f 100644 --- a/server/src/dtos/search.dto.ts +++ b/server/src/dtos/search.dto.ts @@ -1,7 +1,6 @@ import { ApiProperty } from '@nestjs/swagger'; import { Type } from 'class-transformer'; import { IsEnum, IsInt, IsNotEmpty, IsString, Max, Min } from 'class-validator'; -import { PropertyLifecycle } from 'src/decorators'; import { AlbumResponseDto } from 'src/dtos/album.dto'; import { AssetResponseDto } from 'src/dtos/asset-response.dto'; import { AssetOrder } from 'src/entities/album.entity'; @@ -155,18 +154,6 @@ export class MetadataSearchDto extends BaseSearchDto { @Optional() originalPath?: string; - @IsString() - @IsNotEmpty() - @Optional() - @PropertyLifecycle({ deprecatedAt: 'v1.100.0' }) - resizePath?: string; - - @IsString() - @IsNotEmpty() - @Optional() - @PropertyLifecycle({ deprecatedAt: 'v1.100.0' }) - webpPath?: string; - @IsString() @IsNotEmpty() @Optional() diff --git a/server/src/services/album.service.spec.ts b/server/src/services/album.service.spec.ts index e2a7fc49c..3d20a6a55 100644 --- a/server/src/services/album.service.spec.ts +++ b/server/src/services/album.service.spec.ts @@ -185,7 +185,7 @@ describe(AlbumService.name, () => { await sut.create(authStub.admin, { albumName: 'Empty album', - sharedWithUserIds: ['user-id'], + albumUsers: [{ userId: 'user-id', role: AlbumUserRole.EDITOR }], description: '', assetIds: ['123'], }); @@ -208,7 +208,7 @@ describe(AlbumService.name, () => { await expect( sut.create(authStub.admin, { albumName: 'Empty album', - sharedWithUserIds: ['user-3'], + albumUsers: [{ userId: 'user-3', role: AlbumUserRole.EDITOR }], }), ).rejects.toBeInstanceOf(BadRequestException); expect(userMock.get).toHaveBeenCalledWith('user-3', {}); diff --git a/server/src/services/album.service.ts b/server/src/services/album.service.ts index 38464bd75..643d06049 100644 --- a/server/src/services/album.service.ts +++ b/server/src/services/album.service.ts @@ -14,7 +14,7 @@ import { } from 'src/dtos/album.dto'; import { BulkIdResponseDto, BulkIdsDto } from 'src/dtos/asset-ids.response.dto'; import { AuthDto } from 'src/dtos/auth.dto'; -import { AlbumUserEntity, AlbumUserRole } from 'src/entities/album-user.entity'; +import { AlbumUserEntity } from 'src/entities/album-user.entity'; import { AlbumEntity } from 'src/entities/album.entity'; import { AssetEntity } from 'src/entities/asset.entity'; import { IAccessRepository } from 'src/interfaces/access.interface'; @@ -115,9 +115,6 @@ export class AlbumService { async create(auth: AuthDto, dto: CreateAlbumDto): Promise { const albumUsers = dto.albumUsers || []; - for (const userId of dto.sharedWithUserIds || []) { - albumUsers.push({ userId, role: AlbumUserRole.EDITOR }); - } for (const { userId } of albumUsers) { const exists = await this.userRepository.get(userId, {}); @@ -216,15 +213,7 @@ export class AlbumService { return results; } - async addUsers(auth: AuthDto, id: string, { albumUsers, sharedUserIds }: AddUsersDto): Promise { - // Remove once deprecated sharedUserIds is removed - if (!albumUsers) { - if (!sharedUserIds) { - throw new BadRequestException('No users provided'); - } - albumUsers = sharedUserIds.map((userId) => ({ userId, role: AlbumUserRole.EDITOR })); - } - + async addUsers(auth: AuthDto, id: string, { albumUsers }: AddUsersDto): Promise { await this.access.requirePermission(auth, Permission.ALBUM_SHARE, id); const album = await this.findOrFail(id, { withAssets: false }); diff --git a/server/src/services/search.service.ts b/server/src/services/search.service.ts index 10a2ccda2..8c8921813 100644 --- a/server/src/services/search.service.ts +++ b/server/src/services/search.service.ts @@ -78,9 +78,6 @@ export class SearchService { checksum = Buffer.from(dto.checksum, encoding); } - dto.previewPath ??= dto.resizePath; - dto.thumbnailPath ??= dto.webpPath; - const page = dto.page ?? 1; const size = dto.size || 250; const enumToOrder = { [AssetOrder.ASC]: 'ASC', [AssetOrder.DESC]: 'DESC' } as const; diff --git a/server/test/fixtures/shared-link.stub.ts b/server/test/fixtures/shared-link.stub.ts index ebadc63fa..acea12160 100644 --- a/server/test/fixtures/shared-link.stub.ts +++ b/server/test/fixtures/shared-link.stub.ts @@ -57,7 +57,6 @@ const assetResponse: AssetResponseDto = { resized: false, thumbhash: null, fileModifiedAt: today, - isExternal: false, isOffline: false, fileCreatedAt: today, localDateTime: today, @@ -100,7 +99,6 @@ const albumResponse: AlbumResponseDto = { id: 'album-123', ownerId: 'admin_id', owner: mapUser(userStub.admin), - sharedUsers: [], albumUsers: [], shared: false, hasSharedLink: false, diff --git a/web/src/lib/components/album-page/album-options.svelte b/web/src/lib/components/album-page/album-options.svelte index e0d11b3b2..0b91dbb02 100644 --- a/web/src/lib/components/album-page/album-options.svelte +++ b/web/src/lib/components/album-page/album-options.svelte @@ -88,7 +88,7 @@
{user.name}
Owner
- {#each album.sharedUsers as user (user.id)} + {#each album.albumUsers as { user } (user.id)}
diff --git a/web/src/lib/components/album-page/user-selection-modal.svelte b/web/src/lib/components/album-page/user-selection-modal.svelte index ffe8adf48..78947c203 100644 --- a/web/src/lib/components/album-page/user-selection-modal.svelte +++ b/web/src/lib/components/album-page/user-selection-modal.svelte @@ -42,8 +42,8 @@ users = data.filter((user) => !(user.deletedAt || user.id === album.ownerId)); // Remove the existed shared users from the album - for (const sharedUser of album.sharedUsers) { - users = users.filter((user) => user.id !== sharedUser.id); + for (const sharedUser of album.albumUsers) { + users = users.filter((user) => user.id !== sharedUser.user.id); } }); diff --git a/web/src/lib/components/asset-viewer/detail-panel.svelte b/web/src/lib/components/asset-viewer/detail-panel.svelte index c921faaff..52a80e3ba 100644 --- a/web/src/lib/components/asset-viewer/detail-panel.svelte +++ b/web/src/lib/components/asset-viewer/detail-panel.svelte @@ -571,7 +571,7 @@
{/if} -{#if currentAlbum && currentAlbum.sharedUsers.length > 0 && asset.owner} +{#if currentAlbum && currentAlbum.albumUsers.length > 0 && asset.owner}

SHARED BY

diff --git a/web/src/routes/(user)/albums/[albumId=id]/[[photos=photos]]/[[assetId=id]]/+page.svelte b/web/src/routes/(user)/albums/[albumId=id]/[[photos=photos]]/[[assetId=id]]/+page.svelte index d63776342..32fb7c01e 100644 --- a/web/src/routes/(user)/albums/[albumId=id]/[[photos=photos]]/[[assetId=id]]/+page.svelte +++ b/web/src/routes/(user)/albums/[albumId=id]/[[photos=photos]]/[[assetId=id]]/+page.svelte @@ -136,7 +136,7 @@ assetGridWidth = isShowActivity ? globalWidth - (globalWidth < 768 ? 360 : 460) : globalWidth; } $: showActivityStatus = - album.sharedUsers.length > 0 && !$showAssetViewer && (album.isActivityEnabled || $numberOfComments > 0); + album.albumUsers.length > 0 && !$showAssetViewer && (album.isActivityEnabled || $numberOfComments > 0); $: isEditor = album.albumUsers.find(({ user: { id } }) => id === $user.id)?.role === AlbumUserRole.Editor || @@ -158,7 +158,7 @@ backUrl = url || AppRoute.ALBUMS; - if (backUrl === AppRoute.SHARING && album.sharedUsers.length === 0 && !album.hasSharedLink) { + if (backUrl === AppRoute.SHARING && album.albumUsers.length === 0 && !album.hasSharedLink) { isCreatingSharedAlbum = true; } }); @@ -229,7 +229,7 @@ isShowActivity = !isShowActivity; }; - $: if (album.sharedUsers.length > 0) { + $: if (album.albumUsers.length > 0) { handlePromiseError(getFavorite()); handlePromiseError(getNumberOfComments()); } @@ -342,7 +342,7 @@ try { await refreshAlbum(); - viewMode = album.sharedUsers.length > 0 ? ViewMode.VIEW_USERS : ViewMode.VIEW; + viewMode = album.albumUsers.length > 0 ? ViewMode.VIEW_USERS : ViewMode.VIEW; } catch (error) { handleError(error, 'Error deleting shared user'); } @@ -482,7 +482,7 @@ {/if} {/if} - {#if isCreatingSharedAlbum && album.sharedUsers.length === 0} + {#if isCreatingSharedAlbum && album.albumUsers.length === 0}