From 49b74e909131b04112c8c970e6ee05431b1cb899 Mon Sep 17 00:00:00 2001 From: Jason Rasmussen Date: Wed, 24 May 2023 10:30:13 -0400 Subject: [PATCH] refactor(server): album controller (#2539) * refactor: album controller/service * chore: open-api * fix: tests --- mobile/openapi/README.md | Bin 16901 -> 16861 bytes mobile/openapi/doc/AlbumApi.md | Bin 26064 -> 25864 bytes mobile/openapi/lib/api/album_api.dart | Bin 21103 -> 20743 bytes mobile/openapi/test/album_api_test.dart | Bin 2334 -> 2294 bytes .../src/api-v1/album/album.controller.ts | 110 ++++---- .../src/api-v1/album/album.service.spec.ts | 84 ++---- .../immich/src/api-v1/album/album.service.ts | 40 +-- .../src/api-v1/album/dto/album-id.dto.ts | 6 - server/immich-openapi-specs.json | 26 +- web/src/api/open-api/api.ts | 240 +++++++++--------- 10 files changed, 219 insertions(+), 287 deletions(-) delete mode 100644 server/apps/immich/src/api-v1/album/dto/album-id.dto.ts diff --git a/mobile/openapi/README.md b/mobile/openapi/README.md index 49e207285ad42133fa3804271b7964f76706305c..2c317643255b024500277996baa05928f5ba8100 100644 GIT binary patch delta 75 zcmZo|VZ7VSxM39+W9H-yTq%s1o29rl8G)R0d}5R1dE9}lH9Xg#{CT{~!OCPOXYd69 SSqJ!Xf#iB|vCW?RdyD|#-5MhR delta 110 zcmccH%-Gt(xM39+TVhU9X|CsFT|U{#C%D|9+|2^qnv5{1d|t810X#6N$uoGaA!PQ# an7VxVFy>soTvo8Dlj{Y=H!Je*F#-TX%O*Sk diff --git a/mobile/openapi/doc/AlbumApi.md b/mobile/openapi/doc/AlbumApi.md index 034750a4dc0c80fd194df17993c84d0f22b1df7e..2924ce5c028e9783251ea077f4342ab9860799f4 100644 GIT binary patch delta 379 zcmca`nz7>);|3{4#>~kIj6p!Mg7GtuEM)Qql82Z!0m&-nnLtvKB^F55utWpNyDaXE znVYp(%~^mP15dNbdO}>2mvi<4c~)FMfn_aRk=X9g+ia8DmDqL z2r*@*Z2lms3{zsGr3w_8oXBN6d8yU}usX5LccM2kPG-_I0-9!}YYJ1UC&WH^li?ho znh>LJK&b%Z>6}37t&JwKib%&0uz^OQlR2Fx0_7Jtv2z2dwZ3qJ*eB()gS8Z-Om38l Po-CR?1*-l;G6xd?V|06? delta 586 zcmeA;#dzT~;|3{4w#1yI(p=BU(u_ecW**~b7&D2<8^&D6v6tf*l40@Vw=2*(|xj>BQMr6cR6+< znWE+Nkqc&uj4!&?Y?J!~%VE~D2mMCUC>dEga<@3w8J*)EMUys{D^Hg6DLraera)PQSs#WvVjma@?6nCH4R*u zK=M789EwS?+}nXJ0NE|ir8il|S$J{=41m!@ySAs=l#GB6l`=0X39*N ze9>NEa=M&6P$1DgfEj4v(jRzx;)a)Wlq=D8{oP=7;o<$zUNP2R^V zK6$Y^$fZZsy*Yq_K$jv+*JR@Zo4&?Cfi*KlN1=LhzPc2fDYNxR&+z6A&zPcQfw-^WleY*K0n>o{D1A#=K_qaB{Gjjkr0v@f;oXjTc z`EX7CXs-bj4sU0T3H?UK_latQz}>`Fv>O`a9#`a^yFf7EZrMaGy{p_M(OhGl-$@WZDFzzm<8W?k-y}TeqeM+smjsjHc z1OuDN{M>At=QDFN!Bj%b@R=;arVkU^#bh(Nfz1TU-Mp1;H(YfgXCzD&NaG96Xc*Ul zS95ZLy#tK9j!O=^12*$>?}GaUVus%20%76F8oc5#%?`XVQ0C^jydU^EU_P0AfiaLB z%9+HaFqv6S9>$#%=4SGj30Bs3`0w1$Lum-GWzy~Fec7qwwc-CAWAGBvoiz7vbGb< zca!z)4JWTt5T883NfBz^=1op(;ciWEg?mg;O?C2fS6`T|rf%^t=2SN|VOZ*br}Gre z$&SpTn{T?kKym`m1P@!7HdW6s7_-LnIMyHrCC&Z5CX@FIa83T~1&?7lKYiq6jy1?9 d1M}JDN8bC9YzLVY2eVSnFA2)r-00WF1OTmDTD<@O diff --git a/mobile/openapi/test/album_api_test.dart b/mobile/openapi/test/album_api_test.dart index 8dde0b9f003e9d8a0dbdc48503808d207d75a2f4..6a75449eebfcd1d9e5cead74748d8fb15f05b87c 100644 GIT binary patch delta 62 zcmbOy^i6QXcSgp{$$uHwF=lSw$aD_Gk>`+@JeMUID8R;Q2o%_C%cctwFJPYqBn3F8 J0?E}J#Q?ME6g~g| delta 111 zcmew+I8SK9cSg3voTSoR&&fX+*Fl+^mouGXWQPc+Og_jYKDm!287B9M#gLH;DyO4R cJ(-tPWwQ?(E8LhM_E|6!-?C4IF`GGx0UVPkFaQ7m diff --git a/server/apps/immich/src/api-v1/album/album.controller.ts b/server/apps/immich/src/api-v1/album/album.controller.ts index fff93f1403..373c58a177 100644 --- a/server/apps/immich/src/api-v1/album/album.controller.ts +++ b/server/apps/immich/src/api-v1/album/album.controller.ts @@ -20,124 +20,112 @@ import { } from '../../constants/download.constant'; import { DownloadDto } from '../asset/dto/download-library.dto'; import { CreateAlbumShareLinkDto as CreateAlbumSharedLinkDto } from './dto/create-album-shared-link.dto'; -import { AlbumIdDto } from './dto/album-id.dto'; import { UseValidation } from '../../decorators/use-validation.decorator'; +import { UUIDParamDto } from '../../controllers/dto/uuid-param.dto'; +import { DownloadArchive } from '../../modules/download/download.service'; + +const handleDownload = (download: DownloadArchive, res: Res) => { + res.attachment(download.fileName); + res.setHeader(IMMICH_CONTENT_LENGTH_HINT, download.fileSize); + res.setHeader(IMMICH_ARCHIVE_FILE_COUNT, download.fileCount); + res.setHeader(IMMICH_ARCHIVE_COMPLETE, `${download.complete}`); + return download.stream; +}; @ApiTags('Album') @Controller('album') @UseValidation() export class AlbumController { - constructor(private readonly albumService: AlbumService) {} + constructor(private readonly service: AlbumService) {} @Authenticated() @Get('count-by-user-id') - async getAlbumCountByUserId(@GetAuthUser() authUser: AuthUserDto): Promise { - return this.albumService.getAlbumCountByUserId(authUser); + getAlbumCountByUserId(@GetAuthUser() authUser: AuthUserDto): Promise { + return this.service.getCountByUserId(authUser); } @Authenticated() @Post() - async createAlbum(@GetAuthUser() authUser: AuthUserDto, @Body() createAlbumDto: CreateAlbumDto) { + createAlbum(@GetAuthUser() authUser: AuthUserDto, @Body() dto: CreateAlbumDto) { // TODO: Handle nonexistent sharedWithUserIds and assetIds. - return this.albumService.create(authUser, createAlbumDto); + return this.service.create(authUser, dto); } @Authenticated() - @Put('/:albumId/users') - async addUsersToAlbum( - @GetAuthUser() authUser: AuthUserDto, - @Body() addUsersDto: AddUsersDto, - @Param() { albumId }: AlbumIdDto, - ) { + @Put(':id/users') + addUsersToAlbum(@GetAuthUser() authUser: AuthUserDto, @Param() { id }: UUIDParamDto, @Body() dto: AddUsersDto) { // TODO: Handle nonexistent sharedUserIds. - return this.albumService.addUsersToAlbum(authUser, addUsersDto, albumId); + return this.service.addUsers(authUser, id, dto); } @Authenticated({ isShared: true }) - @Put('/:albumId/assets') - async addAssetsToAlbum( + @Put(':id/assets') + addAssetsToAlbum( @GetAuthUser() authUser: AuthUserDto, - @Body() addAssetsDto: AddAssetsDto, - @Param() { albumId }: AlbumIdDto, + @Param() { id }: UUIDParamDto, + @Body() dto: AddAssetsDto, ): Promise { // TODO: Handle nonexistent assetIds. // TODO: Disallow adding assets of another user to an album. - return this.albumService.addAssetsToAlbum(authUser, addAssetsDto, albumId); + return this.service.addAssets(authUser, id, dto); } @Authenticated({ isShared: true }) - @Get('/:albumId') - async getAlbumInfo(@GetAuthUser() authUser: AuthUserDto, @Param() { albumId }: AlbumIdDto) { - return this.albumService.getAlbumInfo(authUser, albumId); + @Get(':id') + getAlbumInfo(@GetAuthUser() authUser: AuthUserDto, @Param() { id }: UUIDParamDto) { + return this.service.get(authUser, id); } @Authenticated() - @Delete('/:albumId/assets') - async removeAssetFromAlbum( + @Delete(':id/assets') + removeAssetFromAlbum( @GetAuthUser() authUser: AuthUserDto, - @Body() removeAssetsDto: RemoveAssetsDto, - @Param() { albumId }: AlbumIdDto, + @Body() dto: RemoveAssetsDto, + @Param() { id }: UUIDParamDto, ): Promise { - return this.albumService.removeAssetsFromAlbum(authUser, removeAssetsDto, albumId); + return this.service.removeAssets(authUser, id, dto); } @Authenticated() - @Delete('/:albumId') - async deleteAlbum(@GetAuthUser() authUser: AuthUserDto, @Param() { albumId }: AlbumIdDto) { - return this.albumService.deleteAlbum(authUser, albumId); + @Delete(':id') + deleteAlbum(@GetAuthUser() authUser: AuthUserDto, @Param() { id }: UUIDParamDto) { + return this.service.delete(authUser, id); } @Authenticated() - @Delete('/:albumId/user/:userId') - async removeUserFromAlbum( + @Delete(':id/user/:userId') + removeUserFromAlbum( @GetAuthUser() authUser: AuthUserDto, - @Param() { albumId }: AlbumIdDto, + @Param() { id }: UUIDParamDto, @Param('userId', new ParseMeUUIDPipe({ version: '4' })) userId: string, ) { - return this.albumService.removeUserFromAlbum(authUser, albumId, userId); + return this.service.removeUser(authUser, id, userId); } @Authenticated() - @Patch('/:albumId') - async updateAlbumInfo( - @GetAuthUser() authUser: AuthUserDto, - @Body() updateAlbumInfoDto: UpdateAlbumDto, - @Param() { albumId }: AlbumIdDto, - ) { + @Patch(':id') + updateAlbumInfo(@GetAuthUser() authUser: AuthUserDto, @Param() { id }: UUIDParamDto, @Body() dto: UpdateAlbumDto) { // TODO: Handle nonexistent albumThumbnailAssetId. // TODO: Disallow setting asset from other user as albumThumbnailAssetId. - return this.albumService.updateAlbumInfo(authUser, updateAlbumInfoDto, albumId); + return this.service.update(authUser, id, dto); } @Authenticated({ isShared: true }) - @Get('/:albumId/download') + @Get(':id/download') @ApiOkResponse({ content: { 'application/zip': { schema: { type: 'string', format: 'binary' } } } }) - async downloadArchive( + downloadArchive( @GetAuthUser() authUser: AuthUserDto, - @Param() { albumId }: AlbumIdDto, + @Param() { id }: UUIDParamDto, @Query() dto: DownloadDto, @Response({ passthrough: true }) res: Res, ) { - this.albumService.checkDownloadAccess(authUser); - - const { stream, fileName, fileSize, fileCount, complete } = await this.albumService.downloadArchive( - authUser, - albumId, - dto, - ); - res.attachment(fileName); - res.setHeader(IMMICH_CONTENT_LENGTH_HINT, fileSize); - res.setHeader(IMMICH_ARCHIVE_FILE_COUNT, fileCount); - res.setHeader(IMMICH_ARCHIVE_COMPLETE, `${complete}`); - return stream; + this.service.checkDownloadAccess(authUser); + return this.service.downloadArchive(authUser, id, dto).then((download) => handleDownload(download, res)); } @Authenticated() - @Post('/create-shared-link') - async createAlbumSharedLink( - @GetAuthUser() authUser: AuthUserDto, - @Body() createAlbumShareLinkDto: CreateAlbumSharedLinkDto, - ) { - return this.albumService.createAlbumSharedLink(authUser, createAlbumShareLinkDto); + @Post('create-shared-link') + createAlbumSharedLink(@GetAuthUser() authUser: AuthUserDto, @Body() dto: CreateAlbumSharedLinkDto) { + return this.service.createSharedLink(authUser, dto); } } diff --git a/server/apps/immich/src/api-v1/album/album.service.spec.ts b/server/apps/immich/src/api-v1/album/album.service.spec.ts index bea9fa3d74..95e5fadda1 100644 --- a/server/apps/immich/src/api-v1/album/album.service.spec.ts +++ b/server/apps/immich/src/api-v1/album/album.service.spec.ts @@ -182,14 +182,14 @@ describe('Album service', () => { shared: false, assetCount: 0, }; - await expect(sut.getAlbumInfo(authUser, albumId)).resolves.toEqual(expectedResult); + await expect(sut.get(authUser, albumId)).resolves.toEqual(expectedResult); }); it('gets a shared album', async () => { const albumEntity = _getSharedWithAuthUserAlbum(); albumRepositoryMock.get.mockImplementation(() => Promise.resolve(albumEntity)); - const result = await sut.getAlbumInfo(authUser, albumId); + const result = await sut.get(authUser, albumId); expect(result.id).toEqual(albumId); expect(result.ownerId).toEqual(sharedAlbumOwnerId); expect(result.shared).toEqual(true); @@ -203,19 +203,19 @@ describe('Album service', () => { const albumId = albumEntity.id; albumRepositoryMock.get.mockImplementation(() => Promise.resolve(albumEntity)); - await expect(sut.getAlbumInfo(authUser, albumId)).rejects.toBeInstanceOf(ForbiddenException); + await expect(sut.get(authUser, albumId)).rejects.toBeInstanceOf(ForbiddenException); }); it('throws a not found exception if the album is not found', async () => { albumRepositoryMock.get.mockImplementation(() => Promise.resolve(null)); - await expect(sut.getAlbumInfo(authUser, '0002')).rejects.toBeInstanceOf(NotFoundException); + await expect(sut.get(authUser, '0002')).rejects.toBeInstanceOf(NotFoundException); }); it('deletes an owned album', async () => { const albumEntity = _getOwnedAlbum(); albumRepositoryMock.get.mockImplementation(() => Promise.resolve(albumEntity)); albumRepositoryMock.delete.mockImplementation(() => Promise.resolve()); - await sut.deleteAlbum(authUser, albumId); + await sut.delete(authUser, albumId); expect(albumRepositoryMock.delete).toHaveBeenCalledTimes(1); expect(albumRepositoryMock.delete).toHaveBeenCalledWith(albumEntity); }); @@ -223,14 +223,14 @@ describe('Album service', () => { it('prevents deleting a shared album (shared with auth user)', async () => { const albumEntity = _getSharedWithAuthUserAlbum(); albumRepositoryMock.get.mockImplementation(() => Promise.resolve(albumEntity)); - await expect(sut.deleteAlbum(authUser, albumId)).rejects.toBeInstanceOf(ForbiddenException); + await expect(sut.delete(authUser, albumId)).rejects.toBeInstanceOf(ForbiddenException); }); it('removes a shared user from an owned album', async () => { const albumEntity = _getOwnedSharedAlbum(); albumRepositoryMock.get.mockImplementation(() => Promise.resolve(albumEntity)); albumRepositoryMock.removeUser.mockImplementation(() => Promise.resolve()); - await expect(sut.removeUserFromAlbum(authUser, albumEntity.id, ownedAlbumSharedWithId)).resolves.toBeUndefined(); + await expect(sut.removeUser(authUser, albumEntity.id, ownedAlbumSharedWithId)).resolves.toBeUndefined(); expect(albumRepositoryMock.removeUser).toHaveBeenCalledTimes(1); expect(albumRepositoryMock.removeUser).toHaveBeenCalledWith(albumEntity, ownedAlbumSharedWithId); }); @@ -242,7 +242,7 @@ describe('Album service', () => { albumRepositoryMock.get.mockImplementation(() => Promise.resolve(albumEntity)); - await expect(sut.removeUserFromAlbum(authUser, albumId, userIdToRemove)).rejects.toBeInstanceOf(ForbiddenException); + await expect(sut.removeUser(authUser, albumId, userIdToRemove)).rejects.toBeInstanceOf(ForbiddenException); expect(albumRepositoryMock.removeUser).not.toHaveBeenCalled(); }); @@ -251,7 +251,7 @@ describe('Album service', () => { albumRepositoryMock.get.mockImplementation(() => Promise.resolve(albumEntity)); albumRepositoryMock.removeUser.mockImplementation(() => Promise.resolve()); - await sut.removeUserFromAlbum(authUser, albumEntity.id, authUser.id); + await sut.removeUser(authUser, albumEntity.id, authUser.id); expect(albumRepositoryMock.removeUser).toHaveReturnedTimes(1); expect(albumRepositoryMock.removeUser).toHaveBeenCalledWith(albumEntity, authUser.id); }); @@ -261,7 +261,7 @@ describe('Album service', () => { albumRepositoryMock.get.mockImplementation(() => Promise.resolve(albumEntity)); albumRepositoryMock.removeUser.mockImplementation(() => Promise.resolve()); - await sut.removeUserFromAlbum(authUser, albumEntity.id, 'me'); + await sut.removeUser(authUser, albumEntity.id, 'me'); expect(albumRepositoryMock.removeUser).toHaveReturnedTimes(1); expect(albumRepositoryMock.removeUser).toHaveBeenCalledWith(albumEntity, authUser.id); }); @@ -270,9 +270,7 @@ describe('Album service', () => { const albumEntity = _getOwnedAlbum(); albumRepositoryMock.get.mockImplementation(() => Promise.resolve(albumEntity)); - await expect(sut.removeUserFromAlbum(authUser, albumEntity.id, authUser.id)).rejects.toBeInstanceOf( - BadRequestException, - ); + await expect(sut.removeUser(authUser, albumEntity.id, authUser.id)).rejects.toBeInstanceOf(BadRequestException); }); it('updates a owned album', async () => { @@ -284,14 +282,10 @@ describe('Album service', () => { const updatedAlbum = { ...albumEntity, albumName: updatedAlbumName }; albumRepositoryMock.updateAlbum.mockResolvedValue(updatedAlbum); - const result = await sut.updateAlbumInfo( - authUser, - { - albumName: updatedAlbumName, - albumThumbnailAssetId: updatedAlbumThumbnailAssetId, - }, - albumId, - ); + const result = await sut.update(authUser, albumId, { + albumName: updatedAlbumName, + albumThumbnailAssetId: updatedAlbumThumbnailAssetId, + }); expect(result.id).toEqual(albumId); expect(result.albumName).toEqual(updatedAlbumName); @@ -310,14 +304,10 @@ describe('Album service', () => { albumRepositoryMock.get.mockImplementation(() => Promise.resolve(albumEntity)); await expect( - sut.updateAlbumInfo( - authUser, - { - albumName: 'new album name', - albumThumbnailAssetId: '69d2f917-0b31-48d8-9d7d-673b523f1aac', - }, - albumId, - ), + sut.update(authUser, albumId, { + albumName: 'new album name', + albumThumbnailAssetId: '69d2f917-0b31-48d8-9d7d-673b523f1aac', + }), ).rejects.toBeInstanceOf(ForbiddenException); }); @@ -334,13 +324,7 @@ describe('Album service', () => { albumRepositoryMock.get.mockImplementation(() => Promise.resolve(albumEntity)); albumRepositoryMock.addAssets.mockImplementation(() => Promise.resolve(albumResponse)); - const result = (await sut.addAssetsToAlbum( - authUser, - { - assetIds: ['1'], - }, - albumId, - )) as AddAssetsResponseDto; + const result = (await sut.addAssets(authUser, albumId, { assetIds: ['1'] })) as AddAssetsResponseDto; // TODO: stub and expect album rendered expect(result.album?.id).toEqual(albumId); @@ -359,13 +343,7 @@ describe('Album service', () => { albumRepositoryMock.get.mockImplementation(() => Promise.resolve(albumEntity)); albumRepositoryMock.addAssets.mockImplementation(() => Promise.resolve(albumResponse)); - const result = (await sut.addAssetsToAlbum( - authUser, - { - assetIds: ['1'], - }, - albumId, - )) as AddAssetsResponseDto; + const result = (await sut.addAssets(authUser, albumId, { assetIds: ['1'] })) as AddAssetsResponseDto; // TODO: stub and expect album rendered expect(result.album?.id).toEqual(albumId); @@ -384,15 +362,7 @@ describe('Album service', () => { albumRepositoryMock.get.mockImplementation(() => Promise.resolve(albumEntity)); albumRepositoryMock.addAssets.mockImplementation(() => Promise.resolve(albumResponse)); - await expect( - sut.addAssetsToAlbum( - authUser, - { - assetIds: ['1'], - }, - albumId, - ), - ).rejects.toBeInstanceOf(ForbiddenException); + await expect(sut.addAssets(authUser, albumId, { assetIds: ['1'] })).rejects.toBeInstanceOf(ForbiddenException); }); // it('removes assets from owned album', async () => { @@ -448,14 +418,6 @@ describe('Album service', () => { albumRepositoryMock.get.mockImplementation(() => Promise.resolve(albumEntity)); albumRepositoryMock.addAssets.mockImplementation(() => Promise.resolve(albumResponse)); - await expect( - sut.removeAssetsFromAlbum( - authUser, - { - assetIds: ['1'], - }, - albumId, - ), - ).rejects.toBeInstanceOf(ForbiddenException); + await expect(sut.removeAssets(authUser, albumId, { assetIds: ['1'] })).rejects.toBeInstanceOf(ForbiddenException); }); }); diff --git a/server/apps/immich/src/api-v1/album/album.service.ts b/server/apps/immich/src/api-v1/album/album.service.ts index d5c1de91f2..651b87b59c 100644 --- a/server/apps/immich/src/api-v1/album/album.service.ts +++ b/server/apps/immich/src/api-v1/album/album.service.ts @@ -61,18 +61,18 @@ export class AlbumService { return mapAlbum(albumEntity); } - async getAlbumInfo(authUser: AuthUserDto, albumId: string): Promise { + async get(authUser: AuthUserDto, albumId: string): Promise { const album = await this._getAlbum({ authUser, albumId, validateIsOwner: false }); return mapAlbum(album); } - async addUsersToAlbum(authUser: AuthUserDto, addUsersDto: AddUsersDto, albumId: string): Promise { + async addUsers(authUser: AuthUserDto, albumId: string, dto: AddUsersDto): Promise { const album = await this._getAlbum({ authUser, albumId }); - const updatedAlbum = await this.albumRepository.addSharedUsers(album, addUsersDto); + const updatedAlbum = await this.albumRepository.addSharedUsers(album, dto); return mapAlbum(updatedAlbum); } - async deleteAlbum(authUser: AuthUserDto, albumId: string): Promise { + async delete(authUser: AuthUserDto, albumId: string): Promise { const album = await this._getAlbum({ authUser, albumId }); for (const sharedLink of album.sharedLinks) { @@ -83,7 +83,7 @@ export class AlbumService { await this.jobRepository.queue({ name: JobName.SEARCH_REMOVE_ALBUM, data: { ids: [albumId] } }); } - async removeUserFromAlbum(authUser: AuthUserDto, albumId: string, userId: string | 'me'): Promise { + async removeUser(authUser: AuthUserDto, albumId: string, userId: string | 'me'): Promise { const sharedUserId = userId == 'me' ? authUser.id : userId; const album = await this._getAlbum({ authUser, albumId, validateIsOwner: false }); if (album.ownerId != authUser.id && authUser.id != sharedUserId) { @@ -95,34 +95,26 @@ export class AlbumService { await this.albumRepository.removeUser(album, sharedUserId); } - async removeAssetsFromAlbum( - authUser: AuthUserDto, - removeAssetsDto: RemoveAssetsDto, - albumId: string, - ): Promise { + async removeAssets(authUser: AuthUserDto, albumId: string, dto: RemoveAssetsDto): Promise { const album = await this._getAlbum({ authUser, albumId }); - const deletedCount = await this.albumRepository.removeAssets(album, removeAssetsDto); + const deletedCount = await this.albumRepository.removeAssets(album, dto); const newAlbum = await this._getAlbum({ authUser, albumId }); - if (deletedCount !== removeAssetsDto.assetIds.length) { + if (deletedCount !== dto.assetIds.length) { throw new BadRequestException('Some assets were not found in the album'); } return mapAlbum(newAlbum); } - async addAssetsToAlbum( - authUser: AuthUserDto, - addAssetsDto: AddAssetsDto, - albumId: string, - ): Promise { + async addAssets(authUser: AuthUserDto, albumId: string, dto: AddAssetsDto): Promise { if (authUser.isPublicUser && !authUser.isAllowUpload) { this.logger.warn('Deny public user attempt to add asset to album'); throw new ForbiddenException('Public user is not allowed to upload'); } const album = await this._getAlbum({ authUser, albumId, validateIsOwner: false }); - const result = await this.albumRepository.addAssets(album, addAssetsDto); + const result = await this.albumRepository.addAssets(album, dto); const newAlbum = await this._getAlbum({ authUser, albumId, validateIsOwner: false }); return { @@ -131,25 +123,21 @@ export class AlbumService { }; } - async updateAlbumInfo( - authUser: AuthUserDto, - updateAlbumDto: UpdateAlbumDto, - albumId: string, - ): Promise { + async update(authUser: AuthUserDto, albumId: string, dto: UpdateAlbumDto): Promise { const album = await this._getAlbum({ authUser, albumId }); if (authUser.id != album.ownerId) { throw new BadRequestException('Unauthorized to change album info'); } - const updatedAlbum = await this.albumRepository.updateAlbum(album, updateAlbumDto); + const updatedAlbum = await this.albumRepository.updateAlbum(album, dto); await this.jobRepository.queue({ name: JobName.SEARCH_INDEX_ALBUM, data: { ids: [updatedAlbum.id] } }); return mapAlbum(updatedAlbum); } - async getAlbumCountByUserId(authUser: AuthUserDto): Promise { + async getCountByUserId(authUser: AuthUserDto): Promise { return this.albumRepository.getCountByUserId(authUser.id); } @@ -160,7 +148,7 @@ export class AlbumService { return this.downloadService.downloadArchive(album.albumName, assets); } - async createAlbumSharedLink(authUser: AuthUserDto, dto: CreateAlbumShareLinkDto): Promise { + async createSharedLink(authUser: AuthUserDto, dto: CreateAlbumShareLinkDto): Promise { const album = await this._getAlbum({ authUser, albumId: dto.albumId }); const sharedLink = await this.shareCore.create(authUser.id, { diff --git a/server/apps/immich/src/api-v1/album/dto/album-id.dto.ts b/server/apps/immich/src/api-v1/album/dto/album-id.dto.ts deleted file mode 100644 index 5dbdf06c2b..0000000000 --- a/server/apps/immich/src/api-v1/album/dto/album-id.dto.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { ValidateUUID } from 'apps/immich/src/decorators/validate-uuid.decorator'; - -export class AlbumIdDto { - @ValidateUUID() - albumId!: string; -} diff --git a/server/immich-openapi-specs.json b/server/immich-openapi-specs.json index 40f4639932..e0c021f4b8 100644 --- a/server/immich-openapi-specs.json +++ b/server/immich-openapi-specs.json @@ -3627,12 +3627,12 @@ ] } }, - "/album/{albumId}/users": { + "/album/{id}/users": { "put": { "operationId": "addUsersToAlbum", "parameters": [ { - "name": "albumId", + "name": "id", "required": true, "in": "path", "schema": { @@ -3679,12 +3679,12 @@ ] } }, - "/album/{albumId}/assets": { + "/album/{id}/assets": { "put": { "operationId": "addAssetsToAlbum", "parameters": [ { - "name": "albumId", + "name": "id", "required": true, "in": "path", "schema": { @@ -3742,7 +3742,7 @@ "operationId": "removeAssetFromAlbum", "parameters": [ { - "name": "albumId", + "name": "id", "required": true, "in": "path", "schema": { @@ -3789,12 +3789,12 @@ ] } }, - "/album/{albumId}": { + "/album/{id}": { "get": { "operationId": "getAlbumInfo", "parameters": [ { - "name": "albumId", + "name": "id", "required": true, "in": "path", "schema": { @@ -3842,7 +3842,7 @@ "operationId": "deleteAlbum", "parameters": [ { - "name": "albumId", + "name": "id", "required": true, "in": "path", "schema": { @@ -3875,7 +3875,7 @@ "operationId": "updateAlbumInfo", "parameters": [ { - "name": "albumId", + "name": "id", "required": true, "in": "path", "schema": { @@ -3922,12 +3922,12 @@ ] } }, - "/album/{albumId}/user/{userId}": { + "/album/{id}/user/{userId}": { "delete": { "operationId": "removeUserFromAlbum", "parameters": [ { - "name": "albumId", + "name": "id", "required": true, "in": "path", "schema": { @@ -3965,12 +3965,12 @@ ] } }, - "/album/{albumId}/download": { + "/album/{id}/download": { "get": { "operationId": "downloadArchive", "parameters": [ { - "name": "albumId", + "name": "id", "required": true, "in": "path", "schema": { diff --git a/web/src/api/open-api/api.ts b/web/src/api/open-api/api.ts index dd91427d46..685964b291 100644 --- a/web/src/api/open-api/api.ts +++ b/web/src/api/open-api/api.ts @@ -3082,19 +3082,19 @@ export const AlbumApiAxiosParamCreator = function (configuration?: Configuration return { /** * - * @param {string} albumId + * @param {string} id * @param {AddAssetsDto} addAssetsDto * @param {string} [key] * @param {*} [options] Override http request option. * @throws {RequiredError} */ - addAssetsToAlbum: async (albumId: string, addAssetsDto: AddAssetsDto, key?: string, options: AxiosRequestConfig = {}): Promise => { - // verify required parameter 'albumId' is not null or undefined - assertParamExists('addAssetsToAlbum', 'albumId', albumId) + addAssetsToAlbum: async (id: string, addAssetsDto: AddAssetsDto, key?: string, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('addAssetsToAlbum', 'id', id) // verify required parameter 'addAssetsDto' is not null or undefined assertParamExists('addAssetsToAlbum', 'addAssetsDto', addAssetsDto) - const localVarPath = `/album/{albumId}/assets` - .replace(`{${"albumId"}}`, encodeURIComponent(String(albumId))); + const localVarPath = `/album/{id}/assets` + .replace(`{${"id"}}`, encodeURIComponent(String(id))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; @@ -3135,18 +3135,18 @@ export const AlbumApiAxiosParamCreator = function (configuration?: Configuration }, /** * - * @param {string} albumId + * @param {string} id * @param {AddUsersDto} addUsersDto * @param {*} [options] Override http request option. * @throws {RequiredError} */ - addUsersToAlbum: async (albumId: string, addUsersDto: AddUsersDto, options: AxiosRequestConfig = {}): Promise => { - // verify required parameter 'albumId' is not null or undefined - assertParamExists('addUsersToAlbum', 'albumId', albumId) + addUsersToAlbum: async (id: string, addUsersDto: AddUsersDto, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('addUsersToAlbum', 'id', id) // verify required parameter 'addUsersDto' is not null or undefined assertParamExists('addUsersToAlbum', 'addUsersDto', addUsersDto) - const localVarPath = `/album/{albumId}/users` - .replace(`{${"albumId"}}`, encodeURIComponent(String(albumId))); + const localVarPath = `/album/{id}/users` + .replace(`{${"id"}}`, encodeURIComponent(String(id))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; @@ -3271,15 +3271,15 @@ export const AlbumApiAxiosParamCreator = function (configuration?: Configuration }, /** * - * @param {string} albumId + * @param {string} id * @param {*} [options] Override http request option. * @throws {RequiredError} */ - deleteAlbum: async (albumId: string, options: AxiosRequestConfig = {}): Promise => { - // verify required parameter 'albumId' is not null or undefined - assertParamExists('deleteAlbum', 'albumId', albumId) - const localVarPath = `/album/{albumId}` - .replace(`{${"albumId"}}`, encodeURIComponent(String(albumId))); + deleteAlbum: async (id: string, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('deleteAlbum', 'id', id) + const localVarPath = `/album/{id}` + .replace(`{${"id"}}`, encodeURIComponent(String(id))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; @@ -3313,18 +3313,18 @@ export const AlbumApiAxiosParamCreator = function (configuration?: Configuration }, /** * - * @param {string} albumId + * @param {string} id * @param {string} [name] * @param {number} [skip] * @param {string} [key] * @param {*} [options] Override http request option. * @throws {RequiredError} */ - downloadArchive: async (albumId: string, name?: string, skip?: number, key?: string, options: AxiosRequestConfig = {}): Promise => { - // verify required parameter 'albumId' is not null or undefined - assertParamExists('downloadArchive', 'albumId', albumId) - const localVarPath = `/album/{albumId}/download` - .replace(`{${"albumId"}}`, encodeURIComponent(String(albumId))); + downloadArchive: async (id: string, name?: string, skip?: number, key?: string, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('downloadArchive', 'id', id) + const localVarPath = `/album/{id}/download` + .replace(`{${"id"}}`, encodeURIComponent(String(id))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; @@ -3408,16 +3408,16 @@ export const AlbumApiAxiosParamCreator = function (configuration?: Configuration }, /** * - * @param {string} albumId + * @param {string} id * @param {string} [key] * @param {*} [options] Override http request option. * @throws {RequiredError} */ - getAlbumInfo: async (albumId: string, key?: string, options: AxiosRequestConfig = {}): Promise => { - // verify required parameter 'albumId' is not null or undefined - assertParamExists('getAlbumInfo', 'albumId', albumId) - const localVarPath = `/album/{albumId}` - .replace(`{${"albumId"}}`, encodeURIComponent(String(albumId))); + getAlbumInfo: async (id: string, key?: string, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('getAlbumInfo', 'id', id) + const localVarPath = `/album/{id}` + .replace(`{${"id"}}`, encodeURIComponent(String(id))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; @@ -3503,18 +3503,18 @@ export const AlbumApiAxiosParamCreator = function (configuration?: Configuration }, /** * - * @param {string} albumId + * @param {string} id * @param {RemoveAssetsDto} removeAssetsDto * @param {*} [options] Override http request option. * @throws {RequiredError} */ - removeAssetFromAlbum: async (albumId: string, removeAssetsDto: RemoveAssetsDto, options: AxiosRequestConfig = {}): Promise => { - // verify required parameter 'albumId' is not null or undefined - assertParamExists('removeAssetFromAlbum', 'albumId', albumId) + removeAssetFromAlbum: async (id: string, removeAssetsDto: RemoveAssetsDto, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('removeAssetFromAlbum', 'id', id) // verify required parameter 'removeAssetsDto' is not null or undefined assertParamExists('removeAssetFromAlbum', 'removeAssetsDto', removeAssetsDto) - const localVarPath = `/album/{albumId}/assets` - .replace(`{${"albumId"}}`, encodeURIComponent(String(albumId))); + const localVarPath = `/album/{id}/assets` + .replace(`{${"id"}}`, encodeURIComponent(String(id))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; @@ -3551,18 +3551,18 @@ export const AlbumApiAxiosParamCreator = function (configuration?: Configuration }, /** * - * @param {string} albumId + * @param {string} id * @param {string} userId * @param {*} [options] Override http request option. * @throws {RequiredError} */ - removeUserFromAlbum: async (albumId: string, userId: string, options: AxiosRequestConfig = {}): Promise => { - // verify required parameter 'albumId' is not null or undefined - assertParamExists('removeUserFromAlbum', 'albumId', albumId) + removeUserFromAlbum: async (id: string, userId: string, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('removeUserFromAlbum', 'id', id) // verify required parameter 'userId' is not null or undefined assertParamExists('removeUserFromAlbum', 'userId', userId) - const localVarPath = `/album/{albumId}/user/{userId}` - .replace(`{${"albumId"}}`, encodeURIComponent(String(albumId))) + const localVarPath = `/album/{id}/user/{userId}` + .replace(`{${"id"}}`, encodeURIComponent(String(id))) .replace(`{${"userId"}}`, encodeURIComponent(String(userId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -3597,18 +3597,18 @@ export const AlbumApiAxiosParamCreator = function (configuration?: Configuration }, /** * - * @param {string} albumId + * @param {string} id * @param {UpdateAlbumDto} updateAlbumDto * @param {*} [options] Override http request option. * @throws {RequiredError} */ - updateAlbumInfo: async (albumId: string, updateAlbumDto: UpdateAlbumDto, options: AxiosRequestConfig = {}): Promise => { - // verify required parameter 'albumId' is not null or undefined - assertParamExists('updateAlbumInfo', 'albumId', albumId) + updateAlbumInfo: async (id: string, updateAlbumDto: UpdateAlbumDto, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('updateAlbumInfo', 'id', id) // verify required parameter 'updateAlbumDto' is not null or undefined assertParamExists('updateAlbumInfo', 'updateAlbumDto', updateAlbumDto) - const localVarPath = `/album/{albumId}` - .replace(`{${"albumId"}}`, encodeURIComponent(String(albumId))); + const localVarPath = `/album/{id}` + .replace(`{${"id"}}`, encodeURIComponent(String(id))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; @@ -3655,25 +3655,25 @@ export const AlbumApiFp = function(configuration?: Configuration) { return { /** * - * @param {string} albumId + * @param {string} id * @param {AddAssetsDto} addAssetsDto * @param {string} [key] * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async addAssetsToAlbum(albumId: string, addAssetsDto: AddAssetsDto, key?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.addAssetsToAlbum(albumId, addAssetsDto, key, options); + async addAssetsToAlbum(id: string, addAssetsDto: AddAssetsDto, key?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.addAssetsToAlbum(id, addAssetsDto, key, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * - * @param {string} albumId + * @param {string} id * @param {AddUsersDto} addUsersDto * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async addUsersToAlbum(albumId: string, addUsersDto: AddUsersDto, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.addUsersToAlbum(albumId, addUsersDto, options); + async addUsersToAlbum(id: string, addUsersDto: AddUsersDto, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.addUsersToAlbum(id, addUsersDto, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** @@ -3698,25 +3698,25 @@ export const AlbumApiFp = function(configuration?: Configuration) { }, /** * - * @param {string} albumId + * @param {string} id * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async deleteAlbum(albumId: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.deleteAlbum(albumId, options); + async deleteAlbum(id: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.deleteAlbum(id, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * - * @param {string} albumId + * @param {string} id * @param {string} [name] * @param {number} [skip] * @param {string} [key] * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async downloadArchive(albumId: string, name?: string, skip?: number, key?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.downloadArchive(albumId, name, skip, key, options); + async downloadArchive(id: string, name?: string, skip?: number, key?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.downloadArchive(id, name, skip, key, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** @@ -3730,13 +3730,13 @@ export const AlbumApiFp = function(configuration?: Configuration) { }, /** * - * @param {string} albumId + * @param {string} id * @param {string} [key] * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async getAlbumInfo(albumId: string, key?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.getAlbumInfo(albumId, key, options); + async getAlbumInfo(id: string, key?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getAlbumInfo(id, key, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** @@ -3752,35 +3752,35 @@ export const AlbumApiFp = function(configuration?: Configuration) { }, /** * - * @param {string} albumId + * @param {string} id * @param {RemoveAssetsDto} removeAssetsDto * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async removeAssetFromAlbum(albumId: string, removeAssetsDto: RemoveAssetsDto, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.removeAssetFromAlbum(albumId, removeAssetsDto, options); + async removeAssetFromAlbum(id: string, removeAssetsDto: RemoveAssetsDto, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.removeAssetFromAlbum(id, removeAssetsDto, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * - * @param {string} albumId + * @param {string} id * @param {string} userId * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async removeUserFromAlbum(albumId: string, userId: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.removeUserFromAlbum(albumId, userId, options); + async removeUserFromAlbum(id: string, userId: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.removeUserFromAlbum(id, userId, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * - * @param {string} albumId + * @param {string} id * @param {UpdateAlbumDto} updateAlbumDto * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async updateAlbumInfo(albumId: string, updateAlbumDto: UpdateAlbumDto, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.updateAlbumInfo(albumId, updateAlbumDto, options); + async updateAlbumInfo(id: string, updateAlbumDto: UpdateAlbumDto, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.updateAlbumInfo(id, updateAlbumDto, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, } @@ -3795,24 +3795,24 @@ export const AlbumApiFactory = function (configuration?: Configuration, basePath return { /** * - * @param {string} albumId + * @param {string} id * @param {AddAssetsDto} addAssetsDto * @param {string} [key] * @param {*} [options] Override http request option. * @throws {RequiredError} */ - addAssetsToAlbum(albumId: string, addAssetsDto: AddAssetsDto, key?: string, options?: any): AxiosPromise { - return localVarFp.addAssetsToAlbum(albumId, addAssetsDto, key, options).then((request) => request(axios, basePath)); + addAssetsToAlbum(id: string, addAssetsDto: AddAssetsDto, key?: string, options?: any): AxiosPromise { + return localVarFp.addAssetsToAlbum(id, addAssetsDto, key, options).then((request) => request(axios, basePath)); }, /** * - * @param {string} albumId + * @param {string} id * @param {AddUsersDto} addUsersDto * @param {*} [options] Override http request option. * @throws {RequiredError} */ - addUsersToAlbum(albumId: string, addUsersDto: AddUsersDto, options?: any): AxiosPromise { - return localVarFp.addUsersToAlbum(albumId, addUsersDto, options).then((request) => request(axios, basePath)); + addUsersToAlbum(id: string, addUsersDto: AddUsersDto, options?: any): AxiosPromise { + return localVarFp.addUsersToAlbum(id, addUsersDto, options).then((request) => request(axios, basePath)); }, /** * @@ -3834,24 +3834,24 @@ export const AlbumApiFactory = function (configuration?: Configuration, basePath }, /** * - * @param {string} albumId + * @param {string} id * @param {*} [options] Override http request option. * @throws {RequiredError} */ - deleteAlbum(albumId: string, options?: any): AxiosPromise { - return localVarFp.deleteAlbum(albumId, options).then((request) => request(axios, basePath)); + deleteAlbum(id: string, options?: any): AxiosPromise { + return localVarFp.deleteAlbum(id, options).then((request) => request(axios, basePath)); }, /** * - * @param {string} albumId + * @param {string} id * @param {string} [name] * @param {number} [skip] * @param {string} [key] * @param {*} [options] Override http request option. * @throws {RequiredError} */ - downloadArchive(albumId: string, name?: string, skip?: number, key?: string, options?: any): AxiosPromise { - return localVarFp.downloadArchive(albumId, name, skip, key, options).then((request) => request(axios, basePath)); + downloadArchive(id: string, name?: string, skip?: number, key?: string, options?: any): AxiosPromise { + return localVarFp.downloadArchive(id, name, skip, key, options).then((request) => request(axios, basePath)); }, /** * @@ -3863,13 +3863,13 @@ export const AlbumApiFactory = function (configuration?: Configuration, basePath }, /** * - * @param {string} albumId + * @param {string} id * @param {string} [key] * @param {*} [options] Override http request option. * @throws {RequiredError} */ - getAlbumInfo(albumId: string, key?: string, options?: any): AxiosPromise { - return localVarFp.getAlbumInfo(albumId, key, options).then((request) => request(axios, basePath)); + getAlbumInfo(id: string, key?: string, options?: any): AxiosPromise { + return localVarFp.getAlbumInfo(id, key, options).then((request) => request(axios, basePath)); }, /** * @@ -3883,33 +3883,33 @@ export const AlbumApiFactory = function (configuration?: Configuration, basePath }, /** * - * @param {string} albumId + * @param {string} id * @param {RemoveAssetsDto} removeAssetsDto * @param {*} [options] Override http request option. * @throws {RequiredError} */ - removeAssetFromAlbum(albumId: string, removeAssetsDto: RemoveAssetsDto, options?: any): AxiosPromise { - return localVarFp.removeAssetFromAlbum(albumId, removeAssetsDto, options).then((request) => request(axios, basePath)); + removeAssetFromAlbum(id: string, removeAssetsDto: RemoveAssetsDto, options?: any): AxiosPromise { + return localVarFp.removeAssetFromAlbum(id, removeAssetsDto, options).then((request) => request(axios, basePath)); }, /** * - * @param {string} albumId + * @param {string} id * @param {string} userId * @param {*} [options] Override http request option. * @throws {RequiredError} */ - removeUserFromAlbum(albumId: string, userId: string, options?: any): AxiosPromise { - return localVarFp.removeUserFromAlbum(albumId, userId, options).then((request) => request(axios, basePath)); + removeUserFromAlbum(id: string, userId: string, options?: any): AxiosPromise { + return localVarFp.removeUserFromAlbum(id, userId, options).then((request) => request(axios, basePath)); }, /** * - * @param {string} albumId + * @param {string} id * @param {UpdateAlbumDto} updateAlbumDto * @param {*} [options] Override http request option. * @throws {RequiredError} */ - updateAlbumInfo(albumId: string, updateAlbumDto: UpdateAlbumDto, options?: any): AxiosPromise { - return localVarFp.updateAlbumInfo(albumId, updateAlbumDto, options).then((request) => request(axios, basePath)); + updateAlbumInfo(id: string, updateAlbumDto: UpdateAlbumDto, options?: any): AxiosPromise { + return localVarFp.updateAlbumInfo(id, updateAlbumDto, options).then((request) => request(axios, basePath)); }, }; }; @@ -3923,27 +3923,27 @@ export const AlbumApiFactory = function (configuration?: Configuration, basePath export class AlbumApi extends BaseAPI { /** * - * @param {string} albumId + * @param {string} id * @param {AddAssetsDto} addAssetsDto * @param {string} [key] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AlbumApi */ - public addAssetsToAlbum(albumId: string, addAssetsDto: AddAssetsDto, key?: string, options?: AxiosRequestConfig) { - return AlbumApiFp(this.configuration).addAssetsToAlbum(albumId, addAssetsDto, key, options).then((request) => request(this.axios, this.basePath)); + public addAssetsToAlbum(id: string, addAssetsDto: AddAssetsDto, key?: string, options?: AxiosRequestConfig) { + return AlbumApiFp(this.configuration).addAssetsToAlbum(id, addAssetsDto, key, options).then((request) => request(this.axios, this.basePath)); } /** * - * @param {string} albumId + * @param {string} id * @param {AddUsersDto} addUsersDto * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AlbumApi */ - public addUsersToAlbum(albumId: string, addUsersDto: AddUsersDto, options?: AxiosRequestConfig) { - return AlbumApiFp(this.configuration).addUsersToAlbum(albumId, addUsersDto, options).then((request) => request(this.axios, this.basePath)); + public addUsersToAlbum(id: string, addUsersDto: AddUsersDto, options?: AxiosRequestConfig) { + return AlbumApiFp(this.configuration).addUsersToAlbum(id, addUsersDto, options).then((request) => request(this.axios, this.basePath)); } /** @@ -3970,18 +3970,18 @@ export class AlbumApi extends BaseAPI { /** * - * @param {string} albumId + * @param {string} id * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AlbumApi */ - public deleteAlbum(albumId: string, options?: AxiosRequestConfig) { - return AlbumApiFp(this.configuration).deleteAlbum(albumId, options).then((request) => request(this.axios, this.basePath)); + public deleteAlbum(id: string, options?: AxiosRequestConfig) { + return AlbumApiFp(this.configuration).deleteAlbum(id, options).then((request) => request(this.axios, this.basePath)); } /** * - * @param {string} albumId + * @param {string} id * @param {string} [name] * @param {number} [skip] * @param {string} [key] @@ -3989,8 +3989,8 @@ export class AlbumApi extends BaseAPI { * @throws {RequiredError} * @memberof AlbumApi */ - public downloadArchive(albumId: string, name?: string, skip?: number, key?: string, options?: AxiosRequestConfig) { - return AlbumApiFp(this.configuration).downloadArchive(albumId, name, skip, key, options).then((request) => request(this.axios, this.basePath)); + public downloadArchive(id: string, name?: string, skip?: number, key?: string, options?: AxiosRequestConfig) { + return AlbumApiFp(this.configuration).downloadArchive(id, name, skip, key, options).then((request) => request(this.axios, this.basePath)); } /** @@ -4005,14 +4005,14 @@ export class AlbumApi extends BaseAPI { /** * - * @param {string} albumId + * @param {string} id * @param {string} [key] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AlbumApi */ - public getAlbumInfo(albumId: string, key?: string, options?: AxiosRequestConfig) { - return AlbumApiFp(this.configuration).getAlbumInfo(albumId, key, options).then((request) => request(this.axios, this.basePath)); + public getAlbumInfo(id: string, key?: string, options?: AxiosRequestConfig) { + return AlbumApiFp(this.configuration).getAlbumInfo(id, key, options).then((request) => request(this.axios, this.basePath)); } /** @@ -4029,38 +4029,38 @@ export class AlbumApi extends BaseAPI { /** * - * @param {string} albumId + * @param {string} id * @param {RemoveAssetsDto} removeAssetsDto * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AlbumApi */ - public removeAssetFromAlbum(albumId: string, removeAssetsDto: RemoveAssetsDto, options?: AxiosRequestConfig) { - return AlbumApiFp(this.configuration).removeAssetFromAlbum(albumId, removeAssetsDto, options).then((request) => request(this.axios, this.basePath)); + public removeAssetFromAlbum(id: string, removeAssetsDto: RemoveAssetsDto, options?: AxiosRequestConfig) { + return AlbumApiFp(this.configuration).removeAssetFromAlbum(id, removeAssetsDto, options).then((request) => request(this.axios, this.basePath)); } /** * - * @param {string} albumId + * @param {string} id * @param {string} userId * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AlbumApi */ - public removeUserFromAlbum(albumId: string, userId: string, options?: AxiosRequestConfig) { - return AlbumApiFp(this.configuration).removeUserFromAlbum(albumId, userId, options).then((request) => request(this.axios, this.basePath)); + public removeUserFromAlbum(id: string, userId: string, options?: AxiosRequestConfig) { + return AlbumApiFp(this.configuration).removeUserFromAlbum(id, userId, options).then((request) => request(this.axios, this.basePath)); } /** * - * @param {string} albumId + * @param {string} id * @param {UpdateAlbumDto} updateAlbumDto * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AlbumApi */ - public updateAlbumInfo(albumId: string, updateAlbumDto: UpdateAlbumDto, options?: AxiosRequestConfig) { - return AlbumApiFp(this.configuration).updateAlbumInfo(albumId, updateAlbumDto, options).then((request) => request(this.axios, this.basePath)); + public updateAlbumInfo(id: string, updateAlbumDto: UpdateAlbumDto, options?: AxiosRequestConfig) { + return AlbumApiFp(this.configuration).updateAlbumInfo(id, updateAlbumDto, options).then((request) => request(this.axios, this.basePath)); } }