chore: update response codes (#20770)

* chore: update response codes

* chore: skip problematic test
This commit is contained in:
Jason Rasmussen 2025-08-08 15:56:37 -04:00 committed by GitHub
parent 2ce4f8dd3b
commit 13563fc507
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
33 changed files with 119 additions and 85 deletions

View File

@ -683,7 +683,7 @@ describe('/albums', () => {
.set('Authorization', `Bearer ${user1.accessToken}`) .set('Authorization', `Bearer ${user1.accessToken}`)
.send({ role: AlbumUserRole.Editor }); .send({ role: AlbumUserRole.Editor });
expect(status).toBe(200); expect(status).toBe(204);
// Get album to verify the role change // Get album to verify the role change
const { body } = await request(app) const { body } = await request(app)

View File

@ -555,7 +555,7 @@ describe('/asset', () => {
expect(body).toMatchObject({ id: user1Assets[0].id, livePhotoVideoId: null }); expect(body).toMatchObject({ id: user1Assets[0].id, livePhotoVideoId: null });
}); });
it('should update date time original when sidecar file contains DateTimeOriginal', async () => { it.skip('should update date time original when sidecar file contains DateTimeOriginal', async () => {
const sidecarData = `<?xpacket begin='?' id='W5M0MpCehiHzreSzNTczkc9d'?> const sidecarData = `<?xpacket begin='?' id='W5M0MpCehiHzreSzNTczkc9d'?>
<x:xmpmeta xmlns:x='adobe:ns:meta/' x:xmptk='Image::ExifTool 12.40'> <x:xmpmeta xmlns:x='adobe:ns:meta/' x:xmptk='Image::ExifTool 12.40'>
<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'> <rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>

View File

@ -116,7 +116,7 @@ describe('/partners', () => {
.delete(`/partners/${user3.userId}`) .delete(`/partners/${user3.userId}`)
.set('Authorization', `Bearer ${user1.accessToken}`); .set('Authorization', `Bearer ${user1.accessToken}`);
expect(status).toBe(200); expect(status).toBe(204);
}); });
it('should throw a bad request if partner not found', async () => { it('should throw a bad request if partner not found', async () => {

View File

@ -485,7 +485,7 @@ describe('/shared-links', () => {
.delete(`/shared-links/${linkWithAlbum.id}`) .delete(`/shared-links/${linkWithAlbum.id}`)
.set('Authorization', `Bearer ${user1.accessToken}`); .set('Authorization', `Bearer ${user1.accessToken}`);
expect(status).toBe(200); expect(status).toBe(204);
}); });
}); });
}); });

View File

@ -304,7 +304,7 @@ describe('/users', () => {
const { status } = await request(app) const { status } = await request(app)
.delete(`/users/me/license`) .delete(`/users/me/license`)
.set('Authorization', `Bearer ${nonAdmin.accessToken}`); .set('Authorization', `Bearer ${nonAdmin.accessToken}`);
expect(status).toBe(200); expect(status).toBe(204);
}); });
}); });
}); });

View File

@ -989,7 +989,7 @@
} }
], ],
"responses": { "responses": {
"200": { "204": {
"description": "" "description": ""
} }
}, },
@ -1280,7 +1280,7 @@
} }
], ],
"responses": { "responses": {
"200": { "204": {
"description": "" "description": ""
} }
}, },
@ -1333,7 +1333,7 @@
"required": true "required": true
}, },
"responses": { "responses": {
"200": { "204": {
"description": "" "description": ""
} }
}, },
@ -2568,7 +2568,7 @@
"required": true "required": true
}, },
"responses": { "responses": {
"200": { "204": {
"description": "" "description": ""
} }
}, },
@ -2603,7 +2603,7 @@
"required": true "required": true
}, },
"responses": { "responses": {
"201": { "204": {
"description": "" "description": ""
} }
}, },
@ -2638,7 +2638,7 @@
"required": true "required": true
}, },
"responses": { "responses": {
"200": { "204": {
"description": "" "description": ""
} }
}, },
@ -2665,7 +2665,7 @@
"operationId": "lockAuthSession", "operationId": "lockAuthSession",
"parameters": [], "parameters": [],
"responses": { "responses": {
"200": { "204": {
"description": "" "description": ""
} }
}, },
@ -2700,7 +2700,7 @@
"required": true "required": true
}, },
"responses": { "responses": {
"200": { "204": {
"description": "" "description": ""
} }
}, },
@ -2922,7 +2922,7 @@
"required": true "required": true
}, },
"responses": { "responses": {
"200": { "204": {
"description": "" "description": ""
} }
}, },
@ -2994,7 +2994,7 @@
} }
], ],
"responses": { "responses": {
"200": { "204": {
"description": "" "description": ""
} }
}, },
@ -3123,7 +3123,7 @@
"required": true "required": true
}, },
"responses": { "responses": {
"200": { "204": {
"description": "" "description": ""
} }
}, },
@ -3245,7 +3245,7 @@
"required": true "required": true
}, },
"responses": { "responses": {
"201": { "204": {
"description": "" "description": ""
} }
}, },
@ -4252,7 +4252,7 @@
"required": true "required": true
}, },
"responses": { "responses": {
"200": { "204": {
"description": "" "description": ""
} }
}, },
@ -4356,7 +4356,7 @@
"required": true "required": true
}, },
"responses": { "responses": {
"200": { "204": {
"description": "" "description": ""
} }
}, },
@ -4393,7 +4393,7 @@
} }
], ],
"responses": { "responses": {
"200": { "204": {
"description": "" "description": ""
} }
}, },
@ -4586,7 +4586,7 @@
"required": true "required": true
}, },
"responses": { "responses": {
"201": { "200": {
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
@ -4720,7 +4720,7 @@
} }
], ],
"responses": { "responses": {
"200": { "204": {
"description": "" "description": ""
} }
}, },
@ -5198,7 +5198,7 @@
"required": true "required": true
}, },
"responses": { "responses": {
"201": { "200": {
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
@ -6250,7 +6250,7 @@
"operationId": "deleteServerLicense", "operationId": "deleteServerLicense",
"parameters": [], "parameters": [],
"responses": { "responses": {
"200": { "204": {
"description": "" "description": ""
} }
}, },
@ -6963,7 +6963,7 @@
} }
], ],
"responses": { "responses": {
"200": { "204": {
"description": "" "description": ""
} }
}, },
@ -8984,7 +8984,7 @@
"operationId": "deleteUserLicense", "operationId": "deleteUserLicense",
"parameters": [], "parameters": [],
"responses": { "responses": {
"200": { "204": {
"description": "" "description": ""
} }
}, },
@ -9085,7 +9085,7 @@
"operationId": "deleteUserOnboarding", "operationId": "deleteUserOnboarding",
"parameters": [], "parameters": [],
"responses": { "responses": {
"200": { "204": {
"description": "" "description": ""
} }
}, },

View File

@ -2978,7 +2978,7 @@ export function linkOAuthAccount({ oAuthCallbackDto }: {
oAuthCallbackDto: OAuthCallbackDto; oAuthCallbackDto: OAuthCallbackDto;
}, opts?: Oazapfts.RequestOpts) { }, opts?: Oazapfts.RequestOpts) {
return oazapfts.ok(oazapfts.fetchJson<{ return oazapfts.ok(oazapfts.fetchJson<{
status: 201; status: 200;
data: UserAdminResponseDto; data: UserAdminResponseDto;
}>("/oauth/link", oazapfts.json({ }>("/oauth/link", oazapfts.json({
...opts, ...opts,
@ -3169,7 +3169,7 @@ export function mergePerson({ id, mergePersonDto }: {
mergePersonDto: MergePersonDto; mergePersonDto: MergePersonDto;
}, opts?: Oazapfts.RequestOpts) { }, opts?: Oazapfts.RequestOpts) {
return oazapfts.ok(oazapfts.fetchJson<{ return oazapfts.ok(oazapfts.fetchJson<{
status: 201; status: 200;
data: BulkIdResponseDto[]; data: BulkIdResponseDto[];
}>(`/people/${encodeURIComponent(id)}/merge`, oazapfts.json({ }>(`/people/${encodeURIComponent(id)}/merge`, oazapfts.json({
...opts, ...opts,

View File

@ -46,8 +46,8 @@ export class ActivityController {
} }
@Delete(':id') @Delete(':id')
@HttpCode(HttpStatus.NO_CONTENT)
@Authenticated({ permission: Permission.ActivityDelete }) @Authenticated({ permission: Permission.ActivityDelete })
@HttpCode(HttpStatus.NO_CONTENT)
deleteActivity(@Auth() auth: AuthDto, @Param() { id }: UUIDParamDto): Promise<void> { deleteActivity(@Auth() auth: AuthDto, @Param() { id }: UUIDParamDto): Promise<void> {
return this.service.delete(auth, id); return this.service.delete(auth, id);
} }

View File

@ -1,4 +1,4 @@
import { Body, Controller, Delete, Get, Param, Patch, Post, Put, Query } from '@nestjs/common'; import { Body, Controller, Delete, Get, HttpCode, HttpStatus, Param, Patch, Post, Put, Query } from '@nestjs/common';
import { ApiTags } from '@nestjs/swagger'; import { ApiTags } from '@nestjs/swagger';
import { import {
AddUsersDto, AddUsersDto,
@ -62,6 +62,7 @@ export class AlbumController {
@Delete(':id') @Delete(':id')
@Authenticated({ permission: Permission.AlbumDelete }) @Authenticated({ permission: Permission.AlbumDelete })
@HttpCode(HttpStatus.NO_CONTENT)
deleteAlbum(@Auth() auth: AuthDto, @Param() { id }: UUIDParamDto) { deleteAlbum(@Auth() auth: AuthDto, @Param() { id }: UUIDParamDto) {
return this.service.delete(auth, id); return this.service.delete(auth, id);
} }
@ -98,6 +99,7 @@ export class AlbumController {
@Put(':id/user/:userId') @Put(':id/user/:userId')
@Authenticated({ permission: Permission.AlbumUserUpdate }) @Authenticated({ permission: Permission.AlbumUserUpdate })
@HttpCode(HttpStatus.NO_CONTENT)
updateAlbumUser( updateAlbumUser(
@Auth() auth: AuthDto, @Auth() auth: AuthDto,
@Param() { id }: UUIDParamDto, @Param() { id }: UUIDParamDto,
@ -109,11 +111,12 @@ export class AlbumController {
@Delete(':id/user/:userId') @Delete(':id/user/:userId')
@Authenticated({ permission: Permission.AlbumUserDelete }) @Authenticated({ permission: Permission.AlbumUserDelete })
@HttpCode(HttpStatus.NO_CONTENT)
removeUserFromAlbum( removeUserFromAlbum(
@Auth() auth: AuthDto, @Auth() auth: AuthDto,
@Param() { id }: UUIDParamDto, @Param() { id }: UUIDParamDto,
@Param('userId', new ParseMeUUIDPipe({ version: '4' })) userId: string, @Param('userId', new ParseMeUUIDPipe({ version: '4' })) userId: string,
) { ): Promise<void> {
return this.service.removeUser(auth, id, userId); return this.service.removeUser(auth, id, userId);
} }
} }

View File

@ -41,8 +41,8 @@ export class APIKeyController {
} }
@Delete(':id') @Delete(':id')
@HttpCode(HttpStatus.NO_CONTENT)
@Authenticated({ permission: Permission.ApiKeyDelete }) @Authenticated({ permission: Permission.ApiKeyDelete })
@HttpCode(HttpStatus.NO_CONTENT)
deleteApiKey(@Auth() auth: AuthDto, @Param() { id }: UUIDParamDto): Promise<void> { deleteApiKey(@Auth() auth: AuthDto, @Param() { id }: UUIDParamDto): Promise<void> {
return this.service.delete(auth, id); return this.service.delete(auth, id);
} }

View File

@ -171,12 +171,12 @@ export class AssetMediaController {
* Checks if multiple assets exist on the server and returns all existing - used by background backup * Checks if multiple assets exist on the server and returns all existing - used by background backup
*/ */
@Post('exist') @Post('exist')
@HttpCode(HttpStatus.OK) @Authenticated()
@ApiOperation({ @ApiOperation({
summary: 'checkExistingAssets', summary: 'checkExistingAssets',
description: 'Checks if multiple assets exist on the server and returns all existing - used by background backup', description: 'Checks if multiple assets exist on the server and returns all existing - used by background backup',
}) })
@Authenticated() @HttpCode(HttpStatus.OK)
checkExistingAssets( checkExistingAssets(
@Auth() auth: AuthDto, @Auth() auth: AuthDto,
@Body() dto: CheckExistingAssetsDto, @Body() dto: CheckExistingAssetsDto,
@ -188,12 +188,12 @@ export class AssetMediaController {
* Checks if assets exist by checksums * Checks if assets exist by checksums
*/ */
@Post('bulk-upload-check') @Post('bulk-upload-check')
@HttpCode(HttpStatus.OK) @Authenticated()
@ApiOperation({ @ApiOperation({
summary: 'checkBulkUpload', summary: 'checkBulkUpload',
description: 'Checks if assets exist by checksums', description: 'Checks if assets exist by checksums',
}) })
@Authenticated() @HttpCode(HttpStatus.OK)
checkBulkUpload( checkBulkUpload(
@Auth() auth: AuthDto, @Auth() auth: AuthDto,
@Body() dto: AssetBulkUploadCheckDto, @Body() dto: AssetBulkUploadCheckDto,

View File

@ -57,15 +57,15 @@ export class AssetController {
} }
@Put() @Put()
@HttpCode(HttpStatus.NO_CONTENT)
@Authenticated({ permission: Permission.AssetUpdate }) @Authenticated({ permission: Permission.AssetUpdate })
@HttpCode(HttpStatus.NO_CONTENT)
updateAssets(@Auth() auth: AuthDto, @Body() dto: AssetBulkUpdateDto): Promise<void> { updateAssets(@Auth() auth: AuthDto, @Body() dto: AssetBulkUpdateDto): Promise<void> {
return this.service.updateAll(auth, dto); return this.service.updateAll(auth, dto);
} }
@Delete() @Delete()
@HttpCode(HttpStatus.NO_CONTENT)
@Authenticated({ permission: Permission.AssetDelete }) @Authenticated({ permission: Permission.AssetDelete })
@HttpCode(HttpStatus.NO_CONTENT)
deleteAssets(@Auth() auth: AuthDto, @Body() dto: AssetBulkDeleteDto): Promise<void> { deleteAssets(@Auth() auth: AuthDto, @Body() dto: AssetBulkDeleteDto): Promise<void> {
return this.service.deleteAll(auth, dto); return this.service.deleteAll(auth, dto);
} }

View File

@ -49,22 +49,22 @@ export class AuthController {
} }
@Post('validateToken') @Post('validateToken')
@HttpCode(HttpStatus.OK)
@Authenticated() @Authenticated()
@HttpCode(HttpStatus.OK)
validateAccessToken(): ValidateAccessTokenResponseDto { validateAccessToken(): ValidateAccessTokenResponseDto {
return { authStatus: true }; return { authStatus: true };
} }
@Post('change-password') @Post('change-password')
@HttpCode(HttpStatus.OK)
@Authenticated({ permission: Permission.AuthChangePassword }) @Authenticated({ permission: Permission.AuthChangePassword })
@HttpCode(HttpStatus.OK)
changePassword(@Auth() auth: AuthDto, @Body() dto: ChangePasswordDto): Promise<UserAdminResponseDto> { changePassword(@Auth() auth: AuthDto, @Body() dto: ChangePasswordDto): Promise<UserAdminResponseDto> {
return this.service.changePassword(auth, dto); return this.service.changePassword(auth, dto);
} }
@Post('logout') @Post('logout')
@HttpCode(HttpStatus.OK)
@Authenticated() @Authenticated()
@HttpCode(HttpStatus.OK)
async logout( async logout(
@Req() request: Request, @Req() request: Request,
@Res({ passthrough: true }) res: Response, @Res({ passthrough: true }) res: Response,
@ -88,32 +88,35 @@ export class AuthController {
@Post('pin-code') @Post('pin-code')
@Authenticated({ permission: Permission.PinCodeCreate }) @Authenticated({ permission: Permission.PinCodeCreate })
@HttpCode(HttpStatus.NO_CONTENT)
setupPinCode(@Auth() auth: AuthDto, @Body() dto: PinCodeSetupDto): Promise<void> { setupPinCode(@Auth() auth: AuthDto, @Body() dto: PinCodeSetupDto): Promise<void> {
return this.service.setupPinCode(auth, dto); return this.service.setupPinCode(auth, dto);
} }
@Put('pin-code') @Put('pin-code')
@Authenticated({ permission: Permission.PinCodeUpdate }) @Authenticated({ permission: Permission.PinCodeUpdate })
@HttpCode(HttpStatus.NO_CONTENT)
async changePinCode(@Auth() auth: AuthDto, @Body() dto: PinCodeChangeDto): Promise<void> { async changePinCode(@Auth() auth: AuthDto, @Body() dto: PinCodeChangeDto): Promise<void> {
return this.service.changePinCode(auth, dto); return this.service.changePinCode(auth, dto);
} }
@Delete('pin-code') @Delete('pin-code')
@Authenticated({ permission: Permission.PinCodeDelete }) @Authenticated({ permission: Permission.PinCodeDelete })
@HttpCode(HttpStatus.NO_CONTENT)
async resetPinCode(@Auth() auth: AuthDto, @Body() dto: PinCodeResetDto): Promise<void> { async resetPinCode(@Auth() auth: AuthDto, @Body() dto: PinCodeResetDto): Promise<void> {
return this.service.resetPinCode(auth, dto); return this.service.resetPinCode(auth, dto);
} }
@Post('session/unlock') @Post('session/unlock')
@HttpCode(HttpStatus.OK)
@Authenticated() @Authenticated()
@HttpCode(HttpStatus.NO_CONTENT)
async unlockAuthSession(@Auth() auth: AuthDto, @Body() dto: SessionUnlockDto): Promise<void> { async unlockAuthSession(@Auth() auth: AuthDto, @Body() dto: SessionUnlockDto): Promise<void> {
return this.service.unlockSession(auth, dto); return this.service.unlockSession(auth, dto);
} }
@Post('session/lock') @Post('session/lock')
@HttpCode(HttpStatus.OK)
@Authenticated() @Authenticated()
@HttpCode(HttpStatus.NO_CONTENT)
async lockAuthSession(@Auth() auth: AuthDto): Promise<void> { async lockAuthSession(@Auth() auth: AuthDto): Promise<void> {
return this.service.lockSession(auth); return this.service.lockSession(auth);
} }

View File

@ -20,9 +20,9 @@ export class DownloadController {
} }
@Post('archive') @Post('archive')
@HttpCode(HttpStatus.OK)
@FileResponse()
@Authenticated({ permission: Permission.AssetDownload, sharedLink: true }) @Authenticated({ permission: Permission.AssetDownload, sharedLink: true })
@FileResponse()
@HttpCode(HttpStatus.OK)
downloadArchive(@Auth() auth: AuthDto, @Body() dto: AssetIdsDto): Promise<StreamableFile> { downloadArchive(@Auth() auth: AuthDto, @Body() dto: AssetIdsDto): Promise<StreamableFile> {
return this.service.downloadArchive(auth, dto).then(asStreamableFile); return this.service.downloadArchive(auth, dto).then(asStreamableFile);
} }

View File

@ -1,4 +1,4 @@
import { Body, Controller, Delete, Get, Param } from '@nestjs/common'; import { Body, Controller, Delete, Get, HttpCode, HttpStatus, Param } from '@nestjs/common';
import { ApiTags } from '@nestjs/swagger'; import { ApiTags } from '@nestjs/swagger';
import { BulkIdsDto } from 'src/dtos/asset-ids.response.dto'; import { BulkIdsDto } from 'src/dtos/asset-ids.response.dto';
import { AuthDto } from 'src/dtos/auth.dto'; import { AuthDto } from 'src/dtos/auth.dto';
@ -21,12 +21,14 @@ export class DuplicateController {
@Delete() @Delete()
@Authenticated({ permission: Permission.DuplicateDelete }) @Authenticated({ permission: Permission.DuplicateDelete })
@HttpCode(HttpStatus.NO_CONTENT)
deleteDuplicates(@Auth() auth: AuthDto, @Body() dto: BulkIdsDto): Promise<void> { deleteDuplicates(@Auth() auth: AuthDto, @Body() dto: BulkIdsDto): Promise<void> {
return this.service.deleteAll(auth, dto); return this.service.deleteAll(auth, dto);
} }
@Delete(':id') @Delete(':id')
@Authenticated({ permission: Permission.DuplicateDelete }) @Authenticated({ permission: Permission.DuplicateDelete })
@HttpCode(HttpStatus.NO_CONTENT)
deleteDuplicate(@Auth() auth: AuthDto, @Param() { id }: UUIDParamDto): Promise<void> { deleteDuplicate(@Auth() auth: AuthDto, @Param() { id }: UUIDParamDto): Promise<void> {
return this.service.delete(auth, id); return this.service.delete(auth, id);
} }

View File

@ -1,4 +1,4 @@
import { Body, Controller, Delete, Get, Param, Post, Put, Query } from '@nestjs/common'; import { Body, Controller, Delete, Get, HttpCode, HttpStatus, Param, Post, Put, Query } from '@nestjs/common';
import { ApiTags } from '@nestjs/swagger'; import { ApiTags } from '@nestjs/swagger';
import { AuthDto } from 'src/dtos/auth.dto'; import { AuthDto } from 'src/dtos/auth.dto';
import { import {
@ -42,7 +42,8 @@ export class FaceController {
@Delete(':id') @Delete(':id')
@Authenticated({ permission: Permission.FaceDelete }) @Authenticated({ permission: Permission.FaceDelete })
deleteFace(@Auth() auth: AuthDto, @Param() { id }: UUIDParamDto, @Body() dto: AssetFaceDeleteDto) { @HttpCode(HttpStatus.NO_CONTENT)
deleteFace(@Auth() auth: AuthDto, @Param() { id }: UUIDParamDto, @Body() dto: AssetFaceDeleteDto): Promise<void> {
return this.service.deleteFace(auth, id, dto); return this.service.deleteFace(auth, id, dto);
} }
} }

View File

@ -1,4 +1,4 @@
import { Body, Controller, Get, Param, Post, Put } from '@nestjs/common'; import { Body, Controller, Get, HttpCode, HttpStatus, Param, Post, Put } from '@nestjs/common';
import { ApiTags } from '@nestjs/swagger'; import { ApiTags } from '@nestjs/swagger';
import { AllJobStatusResponseDto, JobCommandDto, JobCreateDto, JobIdParamDto, JobStatusDto } from 'src/dtos/job.dto'; import { AllJobStatusResponseDto, JobCommandDto, JobCreateDto, JobIdParamDto, JobStatusDto } from 'src/dtos/job.dto';
import { Permission } from 'src/enum'; import { Permission } from 'src/enum';
@ -18,6 +18,7 @@ export class JobController {
@Post() @Post()
@Authenticated({ permission: Permission.JobCreate, admin: true }) @Authenticated({ permission: Permission.JobCreate, admin: true })
@HttpCode(HttpStatus.NO_CONTENT)
createJob(@Body() dto: JobCreateDto): Promise<void> { createJob(@Body() dto: JobCreateDto): Promise<void> {
return this.service.create(dto); return this.service.create(dto);
} }

View File

@ -43,15 +43,15 @@ export class LibraryController {
} }
@Delete(':id') @Delete(':id')
@HttpCode(HttpStatus.NO_CONTENT)
@Authenticated({ permission: Permission.LibraryDelete, admin: true }) @Authenticated({ permission: Permission.LibraryDelete, admin: true })
@HttpCode(HttpStatus.NO_CONTENT)
deleteLibrary(@Param() { id }: UUIDParamDto): Promise<void> { deleteLibrary(@Param() { id }: UUIDParamDto): Promise<void> {
return this.service.delete(id); return this.service.delete(id);
} }
@Post(':id/validate') @Post(':id/validate')
@HttpCode(200)
@Authenticated({ admin: true }) @Authenticated({ admin: true })
@HttpCode(HttpStatus.OK)
// TODO: change endpoint to validate current settings instead // TODO: change endpoint to validate current settings instead
validate(@Param() { id }: UUIDParamDto, @Body() dto: ValidateLibraryDto): Promise<ValidateLibraryResponseDto> { validate(@Param() { id }: UUIDParamDto, @Body() dto: ValidateLibraryDto): Promise<ValidateLibraryResponseDto> {
return this.service.validate(id, dto); return this.service.validate(id, dto);
@ -64,9 +64,9 @@ export class LibraryController {
} }
@Post(':id/scan') @Post(':id/scan')
@HttpCode(HttpStatus.NO_CONTENT)
@Authenticated({ permission: Permission.LibraryUpdate, admin: true }) @Authenticated({ permission: Permission.LibraryUpdate, admin: true })
scanLibrary(@Param() { id }: UUIDParamDto) { @HttpCode(HttpStatus.NO_CONTENT)
scanLibrary(@Param() { id }: UUIDParamDto): Promise<void> {
return this.service.queueScan(id); return this.service.queueScan(id);
} }
} }

View File

@ -54,8 +54,8 @@ export class MemoryController {
} }
@Delete(':id') @Delete(':id')
@HttpCode(HttpStatus.NO_CONTENT)
@Authenticated({ permission: Permission.MemoryDelete }) @Authenticated({ permission: Permission.MemoryDelete })
@HttpCode(HttpStatus.NO_CONTENT)
deleteMemory(@Auth() auth: AuthDto, @Param() { id }: UUIDParamDto): Promise<void> { deleteMemory(@Auth() auth: AuthDto, @Param() { id }: UUIDParamDto): Promise<void> {
return this.service.remove(auth, id); return this.service.remove(auth, id);
} }
@ -71,8 +71,8 @@ export class MemoryController {
} }
@Delete(':id/assets') @Delete(':id/assets')
@HttpCode(HttpStatus.OK)
@Authenticated({ permission: Permission.MemoryAssetDelete }) @Authenticated({ permission: Permission.MemoryAssetDelete })
@HttpCode(HttpStatus.OK)
removeMemoryAssets( removeMemoryAssets(
@Auth() auth: AuthDto, @Auth() auth: AuthDto,
@Body() dto: BulkIdsDto, @Body() dto: BulkIdsDto,

View File

@ -25,15 +25,15 @@ export class NotificationAdminController {
} }
@Post('test-email') @Post('test-email')
@HttpCode(HttpStatus.OK)
@Authenticated({ admin: true }) @Authenticated({ admin: true })
@HttpCode(HttpStatus.OK)
sendTestEmailAdmin(@Auth() auth: AuthDto, @Body() dto: SystemConfigSmtpDto): Promise<TestEmailResponseDto> { sendTestEmailAdmin(@Auth() auth: AuthDto, @Body() dto: SystemConfigSmtpDto): Promise<TestEmailResponseDto> {
return this.service.sendTestEmail(auth.user.id, dto); return this.service.sendTestEmail(auth.user.id, dto);
} }
@Post('templates/:name') @Post('templates/:name')
@HttpCode(HttpStatus.OK)
@Authenticated({ admin: true }) @Authenticated({ admin: true })
@HttpCode(HttpStatus.OK)
getNotificationTemplateAdmin( getNotificationTemplateAdmin(
@Auth() auth: AuthDto, @Auth() auth: AuthDto,
@Param('name') name: EmailTemplate, @Param('name') name: EmailTemplate,

View File

@ -1,4 +1,4 @@
import { Body, Controller, Delete, Get, Param, Put, Query } from '@nestjs/common'; import { Body, Controller, Delete, Get, HttpCode, HttpStatus, Param, Put, Query } from '@nestjs/common';
import { ApiTags } from '@nestjs/swagger'; import { ApiTags } from '@nestjs/swagger';
import { AuthDto } from 'src/dtos/auth.dto'; import { AuthDto } from 'src/dtos/auth.dto';
import { import {
@ -26,12 +26,14 @@ export class NotificationController {
@Put() @Put()
@Authenticated({ permission: Permission.NotificationUpdate }) @Authenticated({ permission: Permission.NotificationUpdate })
@HttpCode(HttpStatus.NO_CONTENT)
updateNotifications(@Auth() auth: AuthDto, @Body() dto: NotificationUpdateAllDto): Promise<void> { updateNotifications(@Auth() auth: AuthDto, @Body() dto: NotificationUpdateAllDto): Promise<void> {
return this.service.updateAll(auth, dto); return this.service.updateAll(auth, dto);
} }
@Delete() @Delete()
@Authenticated({ permission: Permission.NotificationDelete }) @Authenticated({ permission: Permission.NotificationDelete })
@HttpCode(HttpStatus.NO_CONTENT)
deleteNotifications(@Auth() auth: AuthDto, @Body() dto: NotificationDeleteAllDto): Promise<void> { deleteNotifications(@Auth() auth: AuthDto, @Body() dto: NotificationDeleteAllDto): Promise<void> {
return this.service.deleteAll(auth, dto); return this.service.deleteAll(auth, dto);
} }
@ -54,6 +56,7 @@ export class NotificationController {
@Delete(':id') @Delete(':id')
@Authenticated({ permission: Permission.NotificationDelete }) @Authenticated({ permission: Permission.NotificationDelete })
@HttpCode(HttpStatus.NO_CONTENT)
deleteNotification(@Auth() auth: AuthDto, @Param() { id }: UUIDParamDto): Promise<void> { deleteNotification(@Auth() auth: AuthDto, @Param() { id }: UUIDParamDto): Promise<void> {
return this.service.delete(auth, id); return this.service.delete(auth, id);
} }

View File

@ -70,6 +70,7 @@ export class OAuthController {
@Post('link') @Post('link')
@Authenticated() @Authenticated()
@HttpCode(HttpStatus.OK)
linkOAuthAccount( linkOAuthAccount(
@Req() request: Request, @Req() request: Request,
@Auth() auth: AuthDto, @Auth() auth: AuthDto,
@ -79,8 +80,8 @@ export class OAuthController {
} }
@Post('unlink') @Post('unlink')
@HttpCode(HttpStatus.OK)
@Authenticated() @Authenticated()
@HttpCode(HttpStatus.OK)
unlinkOAuthAccount(@Auth() auth: AuthDto): Promise<UserAdminResponseDto> { unlinkOAuthAccount(@Auth() auth: AuthDto): Promise<UserAdminResponseDto> {
return this.service.unlink(auth); return this.service.unlink(auth);
} }

View File

@ -1,4 +1,4 @@
import { Body, Controller, Delete, Get, Param, Post, Put, Query } from '@nestjs/common'; import { Body, Controller, Delete, Get, HttpCode, HttpStatus, Param, Post, Put, Query } from '@nestjs/common';
import { ApiTags } from '@nestjs/swagger'; import { ApiTags } from '@nestjs/swagger';
import { AuthDto } from 'src/dtos/auth.dto'; import { AuthDto } from 'src/dtos/auth.dto';
import { PartnerResponseDto, PartnerSearchDto, UpdatePartnerDto } from 'src/dtos/partner.dto'; import { PartnerResponseDto, PartnerSearchDto, UpdatePartnerDto } from 'src/dtos/partner.dto';
@ -36,6 +36,7 @@ export class PartnerController {
@Delete(':id') @Delete(':id')
@Authenticated({ permission: Permission.PartnerDelete }) @Authenticated({ permission: Permission.PartnerDelete })
@HttpCode(HttpStatus.NO_CONTENT)
removePartner(@Auth() auth: AuthDto, @Param() { id }: UUIDParamDto): Promise<void> { removePartner(@Auth() auth: AuthDto, @Param() { id }: UUIDParamDto): Promise<void> {
return this.service.remove(auth, id); return this.service.remove(auth, id);
} }

View File

@ -63,8 +63,8 @@ export class PersonController {
} }
@Delete() @Delete()
@HttpCode(HttpStatus.NO_CONTENT)
@Authenticated({ permission: Permission.PersonDelete }) @Authenticated({ permission: Permission.PersonDelete })
@HttpCode(HttpStatus.NO_CONTENT)
deletePeople(@Auth() auth: AuthDto, @Body() dto: BulkIdsDto): Promise<void> { deletePeople(@Auth() auth: AuthDto, @Body() dto: BulkIdsDto): Promise<void> {
return this.service.deleteAll(auth, dto); return this.service.deleteAll(auth, dto);
} }
@ -86,8 +86,8 @@ export class PersonController {
} }
@Delete(':id') @Delete(':id')
@HttpCode(HttpStatus.NO_CONTENT)
@Authenticated({ permission: Permission.PersonDelete }) @Authenticated({ permission: Permission.PersonDelete })
@HttpCode(HttpStatus.NO_CONTENT)
deletePerson(@Auth() auth: AuthDto, @Param() { id }: UUIDParamDto): Promise<void> { deletePerson(@Auth() auth: AuthDto, @Param() { id }: UUIDParamDto): Promise<void> {
return this.service.delete(auth, id); return this.service.delete(auth, id);
} }
@ -122,6 +122,7 @@ export class PersonController {
@Post(':id/merge') @Post(':id/merge')
@Authenticated({ permission: Permission.PersonMerge }) @Authenticated({ permission: Permission.PersonMerge })
@HttpCode(HttpStatus.OK)
mergePerson( mergePerson(
@Auth() auth: AuthDto, @Auth() auth: AuthDto,
@Param() { id }: UUIDParamDto, @Param() { id }: UUIDParamDto,

View File

@ -27,36 +27,36 @@ export class SearchController {
constructor(private service: SearchService) {} constructor(private service: SearchService) {}
@Post('metadata') @Post('metadata')
@HttpCode(HttpStatus.OK)
@Authenticated({ permission: Permission.AssetRead }) @Authenticated({ permission: Permission.AssetRead })
@HttpCode(HttpStatus.OK)
searchAssets(@Auth() auth: AuthDto, @Body() dto: MetadataSearchDto): Promise<SearchResponseDto> { searchAssets(@Auth() auth: AuthDto, @Body() dto: MetadataSearchDto): Promise<SearchResponseDto> {
return this.service.searchMetadata(auth, dto); return this.service.searchMetadata(auth, dto);
} }
@Post('statistics') @Post('statistics')
@HttpCode(HttpStatus.OK)
@Authenticated({ permission: Permission.AssetStatistics }) @Authenticated({ permission: Permission.AssetStatistics })
@HttpCode(HttpStatus.OK)
searchAssetStatistics(@Auth() auth: AuthDto, @Body() dto: StatisticsSearchDto): Promise<SearchStatisticsResponseDto> { searchAssetStatistics(@Auth() auth: AuthDto, @Body() dto: StatisticsSearchDto): Promise<SearchStatisticsResponseDto> {
return this.service.searchStatistics(auth, dto); return this.service.searchStatistics(auth, dto);
} }
@Post('random') @Post('random')
@HttpCode(HttpStatus.OK)
@Authenticated({ permission: Permission.AssetRead }) @Authenticated({ permission: Permission.AssetRead })
@HttpCode(HttpStatus.OK)
searchRandom(@Auth() auth: AuthDto, @Body() dto: RandomSearchDto): Promise<AssetResponseDto[]> { searchRandom(@Auth() auth: AuthDto, @Body() dto: RandomSearchDto): Promise<AssetResponseDto[]> {
return this.service.searchRandom(auth, dto); return this.service.searchRandom(auth, dto);
} }
@Post('large-assets') @Post('large-assets')
@HttpCode(HttpStatus.OK)
@Authenticated({ permission: Permission.AssetRead }) @Authenticated({ permission: Permission.AssetRead })
@HttpCode(HttpStatus.OK)
searchLargeAssets(@Auth() auth: AuthDto, @Query() dto: LargeAssetSearchDto): Promise<AssetResponseDto[]> { searchLargeAssets(@Auth() auth: AuthDto, @Query() dto: LargeAssetSearchDto): Promise<AssetResponseDto[]> {
return this.service.searchLargeAssets(auth, dto); return this.service.searchLargeAssets(auth, dto);
} }
@Post('smart') @Post('smart')
@HttpCode(HttpStatus.OK)
@Authenticated({ permission: Permission.AssetRead }) @Authenticated({ permission: Permission.AssetRead })
@HttpCode(HttpStatus.OK)
searchSmart(@Auth() auth: AuthDto, @Body() dto: SmartSearchDto): Promise<SearchResponseDto> { searchSmart(@Auth() auth: AuthDto, @Body() dto: SmartSearchDto): Promise<SearchResponseDto> {
return this.service.searchSmart(auth, dto); return this.service.searchSmart(auth, dto);
} }

View File

@ -1,4 +1,4 @@
import { Body, Controller, Delete, Get, Put } from '@nestjs/common'; import { Body, Controller, Delete, Get, HttpCode, HttpStatus, Put } from '@nestjs/common';
import { ApiNotFoundResponse, ApiTags } from '@nestjs/swagger'; import { ApiNotFoundResponse, ApiTags } from '@nestjs/swagger';
import { LicenseKeyDto, LicenseResponseDto } from 'src/dtos/license.dto'; import { LicenseKeyDto, LicenseResponseDto } from 'src/dtos/license.dto';
import { import {
@ -104,6 +104,7 @@ export class ServerController {
@Delete('license') @Delete('license')
@Authenticated({ permission: Permission.ServerLicenseDelete, admin: true }) @Authenticated({ permission: Permission.ServerLicenseDelete, admin: true })
@HttpCode(HttpStatus.NO_CONTENT)
deleteServerLicense(): Promise<void> { deleteServerLicense(): Promise<void> {
return this.service.deleteLicense(); return this.service.deleteLicense();
} }

View File

@ -1,4 +1,18 @@
import { Body, Controller, Delete, Get, Param, Patch, Post, Put, Query, Req, Res } from '@nestjs/common'; import {
Body,
Controller,
Delete,
Get,
HttpCode,
HttpStatus,
Param,
Patch,
Post,
Put,
Query,
Req,
Res,
} from '@nestjs/common';
import { ApiTags } from '@nestjs/swagger'; import { ApiTags } from '@nestjs/swagger';
import { Request, Response } from 'express'; import { Request, Response } from 'express';
import { AssetIdsResponseDto } from 'src/dtos/asset-ids.response.dto'; import { AssetIdsResponseDto } from 'src/dtos/asset-ids.response.dto';
@ -73,6 +87,7 @@ export class SharedLinkController {
@Delete(':id') @Delete(':id')
@Authenticated({ permission: Permission.SharedLinkDelete }) @Authenticated({ permission: Permission.SharedLinkDelete })
@HttpCode(HttpStatus.NO_CONTENT)
removeSharedLink(@Auth() auth: AuthDto, @Param() { id }: UUIDParamDto): Promise<void> { removeSharedLink(@Auth() auth: AuthDto, @Param() { id }: UUIDParamDto): Promise<void> {
return this.service.remove(auth, id); return this.service.remove(auth, id);
} }

View File

@ -49,8 +49,8 @@ export class StackController {
} }
@Delete(':id') @Delete(':id')
@HttpCode(HttpStatus.NO_CONTENT)
@Authenticated({ permission: Permission.StackDelete }) @Authenticated({ permission: Permission.StackDelete })
@HttpCode(HttpStatus.NO_CONTENT)
deleteStack(@Auth() auth: AuthDto, @Param() { id }: UUIDParamDto): Promise<void> { deleteStack(@Auth() auth: AuthDto, @Param() { id }: UUIDParamDto): Promise<void> {
return this.service.delete(auth, id); return this.service.delete(auth, id);
} }

View File

@ -26,23 +26,23 @@ export class SyncController {
) {} ) {}
@Post('full-sync') @Post('full-sync')
@HttpCode(HttpStatus.OK)
@Authenticated() @Authenticated()
@HttpCode(HttpStatus.OK)
getFullSyncForUser(@Auth() auth: AuthDto, @Body() dto: AssetFullSyncDto): Promise<AssetResponseDto[]> { getFullSyncForUser(@Auth() auth: AuthDto, @Body() dto: AssetFullSyncDto): Promise<AssetResponseDto[]> {
return this.service.getFullSync(auth, dto); return this.service.getFullSync(auth, dto);
} }
@Post('delta-sync') @Post('delta-sync')
@HttpCode(HttpStatus.OK)
@Authenticated() @Authenticated()
@HttpCode(HttpStatus.OK)
getDeltaSync(@Auth() auth: AuthDto, @Body() dto: AssetDeltaSyncDto): Promise<AssetDeltaSyncResponseDto> { getDeltaSync(@Auth() auth: AuthDto, @Body() dto: AssetDeltaSyncDto): Promise<AssetDeltaSyncResponseDto> {
return this.service.getDeltaSync(auth, dto); return this.service.getDeltaSync(auth, dto);
} }
@Post('stream') @Post('stream')
@Authenticated({ permission: Permission.SyncStream })
@Header('Content-Type', 'application/jsonlines+json') @Header('Content-Type', 'application/jsonlines+json')
@HttpCode(HttpStatus.OK) @HttpCode(HttpStatus.OK)
@Authenticated({ permission: Permission.SyncStream })
async getSyncStream(@Auth() auth: AuthDto, @Res() res: Response, @Body() dto: SyncStreamDto) { async getSyncStream(@Auth() auth: AuthDto, @Res() res: Response, @Body() dto: SyncStreamDto) {
try { try {
await this.service.stream(auth, res, dto); await this.service.stream(auth, res, dto);
@ -59,16 +59,16 @@ export class SyncController {
} }
@Post('ack') @Post('ack')
@HttpCode(HttpStatus.NO_CONTENT)
@Authenticated({ permission: Permission.SyncCheckpointUpdate }) @Authenticated({ permission: Permission.SyncCheckpointUpdate })
@HttpCode(HttpStatus.NO_CONTENT)
sendSyncAck(@Auth() auth: AuthDto, @Body() dto: SyncAckSetDto) { sendSyncAck(@Auth() auth: AuthDto, @Body() dto: SyncAckSetDto) {
return this.service.setAcks(auth, dto); return this.service.setAcks(auth, dto);
} }
@Delete('ack') @Delete('ack')
@HttpCode(HttpStatus.NO_CONTENT)
@Authenticated({ permission: Permission.SyncCheckpointDelete }) @Authenticated({ permission: Permission.SyncCheckpointDelete })
deleteSyncAck(@Auth() auth: AuthDto, @Body() dto: SyncAckDeleteDto) { @HttpCode(HttpStatus.NO_CONTENT)
deleteSyncAck(@Auth() auth: AuthDto, @Body() dto: SyncAckDeleteDto): Promise<void> {
return this.service.deleteAcks(auth, dto); return this.service.deleteAcks(auth, dto);
} }
} }

View File

@ -21,8 +21,8 @@ export class SystemMetadataController {
} }
@Post('admin-onboarding') @Post('admin-onboarding')
@HttpCode(HttpStatus.NO_CONTENT)
@Authenticated({ permission: Permission.SystemMetadataUpdate, admin: true }) @Authenticated({ permission: Permission.SystemMetadataUpdate, admin: true })
@HttpCode(HttpStatus.NO_CONTENT)
updateAdminOnboarding(@Body() dto: AdminOnboardingUpdateDto): Promise<void> { updateAdminOnboarding(@Body() dto: AdminOnboardingUpdateDto): Promise<void> {
return this.service.updateAdminOnboarding(dto); return this.service.updateAdminOnboarding(dto);
} }

View File

@ -57,8 +57,8 @@ export class TagController {
} }
@Delete(':id') @Delete(':id')
@HttpCode(HttpStatus.NO_CONTENT)
@Authenticated({ permission: Permission.TagDelete }) @Authenticated({ permission: Permission.TagDelete })
@HttpCode(HttpStatus.NO_CONTENT)
deleteTag(@Auth() auth: AuthDto, @Param() { id }: UUIDParamDto): Promise<void> { deleteTag(@Auth() auth: AuthDto, @Param() { id }: UUIDParamDto): Promise<void> {
return this.service.remove(auth, id); return this.service.remove(auth, id);
} }

View File

@ -13,22 +13,22 @@ export class TrashController {
constructor(private service: TrashService) {} constructor(private service: TrashService) {}
@Post('empty') @Post('empty')
@HttpCode(HttpStatus.OK)
@Authenticated({ permission: Permission.AssetDelete }) @Authenticated({ permission: Permission.AssetDelete })
@HttpCode(HttpStatus.OK)
emptyTrash(@Auth() auth: AuthDto): Promise<TrashResponseDto> { emptyTrash(@Auth() auth: AuthDto): Promise<TrashResponseDto> {
return this.service.empty(auth); return this.service.empty(auth);
} }
@Post('restore') @Post('restore')
@HttpCode(HttpStatus.OK)
@Authenticated({ permission: Permission.AssetDelete }) @Authenticated({ permission: Permission.AssetDelete })
@HttpCode(HttpStatus.OK)
restoreTrash(@Auth() auth: AuthDto): Promise<TrashResponseDto> { restoreTrash(@Auth() auth: AuthDto): Promise<TrashResponseDto> {
return this.service.restore(auth); return this.service.restore(auth);
} }
@Post('restore/assets') @Post('restore/assets')
@HttpCode(HttpStatus.OK)
@Authenticated({ permission: Permission.AssetDelete }) @Authenticated({ permission: Permission.AssetDelete })
@HttpCode(HttpStatus.OK)
restoreAssets(@Auth() auth: AuthDto, @Body() dto: BulkIdsDto): Promise<TrashResponseDto> { restoreAssets(@Auth() auth: AuthDto, @Body() dto: BulkIdsDto): Promise<TrashResponseDto> {
return this.service.restoreAssets(auth, dto); return this.service.restoreAssets(auth, dto);
} }

View File

@ -84,6 +84,7 @@ export class UserController {
@Delete('me/license') @Delete('me/license')
@Authenticated({ permission: Permission.UserLicenseDelete }) @Authenticated({ permission: Permission.UserLicenseDelete })
@HttpCode(HttpStatus.NO_CONTENT)
async deleteUserLicense(@Auth() auth: AuthDto): Promise<void> { async deleteUserLicense(@Auth() auth: AuthDto): Promise<void> {
await this.service.deleteLicense(auth); await this.service.deleteLicense(auth);
} }
@ -102,6 +103,7 @@ export class UserController {
@Delete('me/onboarding') @Delete('me/onboarding')
@Authenticated({ permission: Permission.UserOnboardingDelete }) @Authenticated({ permission: Permission.UserOnboardingDelete })
@HttpCode(HttpStatus.NO_CONTENT)
async deleteUserOnboarding(@Auth() auth: AuthDto): Promise<void> { async deleteUserOnboarding(@Auth() auth: AuthDto): Promise<void> {
await this.service.deleteOnboarding(auth); await this.service.deleteOnboarding(auth);
} }
@ -112,11 +114,11 @@ export class UserController {
return this.service.get(id); return this.service.get(id);
} }
@Post('profile-image')
@Authenticated({ permission: Permission.UserProfileImageUpdate })
@UseInterceptors(FileUploadInterceptor) @UseInterceptors(FileUploadInterceptor)
@ApiConsumes('multipart/form-data') @ApiConsumes('multipart/form-data')
@ApiBody({ description: 'A new avatar for the user', type: CreateProfileImageDto }) @ApiBody({ description: 'A new avatar for the user', type: CreateProfileImageDto })
@Post('profile-image')
@Authenticated({ permission: Permission.UserProfileImageUpdate })
createProfileImage( createProfileImage(
@Auth() auth: AuthDto, @Auth() auth: AuthDto,
@UploadedFile() fileInfo: Express.Multer.File, @UploadedFile() fileInfo: Express.Multer.File,
@ -125,8 +127,8 @@ export class UserController {
} }
@Delete('profile-image') @Delete('profile-image')
@HttpCode(HttpStatus.NO_CONTENT)
@Authenticated({ permission: Permission.UserProfileImageDelete }) @Authenticated({ permission: Permission.UserProfileImageDelete })
@HttpCode(HttpStatus.NO_CONTENT)
deleteProfileImage(@Auth() auth: AuthDto): Promise<void> { deleteProfileImage(@Auth() auth: AuthDto): Promise<void> {
return this.service.deleteProfileImage(auth); return this.service.deleteProfileImage(auth);
} }