mirror of
https://github.com/immich-app/immich
synced 2026-08-29 13:15:45 +00:00
refactor(server): deprecate PUT routes in favor of PATCH (#28859)
* add patch routes and deprecate put * gen client
This commit is contained in:
parent
8860817c76
commit
9e453440e6
15 changed files with 1215 additions and 65 deletions
|
|
@ -7,6 +7,7 @@ import {
|
|||
HttpStatus,
|
||||
Next,
|
||||
Param,
|
||||
Patch,
|
||||
Post,
|
||||
Put,
|
||||
Query,
|
||||
|
|
@ -14,7 +15,7 @@ import {
|
|||
UploadedFile,
|
||||
UseInterceptors,
|
||||
} from '@nestjs/common';
|
||||
import { ApiBody, ApiConsumes, ApiTags } from '@nestjs/swagger';
|
||||
import { ApiBody, ApiConsumes, ApiExcludeEndpoint, ApiTags } from '@nestjs/swagger';
|
||||
import { NextFunction, Response } from 'express';
|
||||
import { Endpoint, HistoryBuilder } from 'src/decorators';
|
||||
import { AuthDto } from 'src/dtos/auth.dto';
|
||||
|
|
@ -78,12 +79,23 @@ export class UserController {
|
|||
@Endpoint({
|
||||
summary: 'Update current user',
|
||||
description: 'Update the current user making the API request.',
|
||||
history: new HistoryBuilder().added('v1').beta('v1').stable('v2'),
|
||||
history: new HistoryBuilder()
|
||||
.added('v1')
|
||||
.beta('v1')
|
||||
.stable('v2')
|
||||
.deprecated('v3', { replacementId: 'updateMyUser' }),
|
||||
})
|
||||
updateMyUser(@Auth() auth: AuthDto, @Body() dto: UserUpdateMeDto): Promise<UserAdminResponseDto> {
|
||||
return this.service.updateMe(auth, dto);
|
||||
}
|
||||
|
||||
@Patch('me')
|
||||
@ApiExcludeEndpoint()
|
||||
@Authenticated({ permission: Permission.UserUpdate })
|
||||
updateMyUserV3(@Auth() auth: AuthDto, @Body() dto: UserUpdateMeDto): Promise<UserAdminResponseDto> {
|
||||
return this.service.updateMe(auth, dto);
|
||||
}
|
||||
|
||||
@Get('me/preferences')
|
||||
@Authenticated({ permission: Permission.UserPreferenceRead })
|
||||
@Endpoint({
|
||||
|
|
@ -100,7 +112,11 @@ export class UserController {
|
|||
@Endpoint({
|
||||
summary: 'Update my preferences',
|
||||
description: 'Update the preferences of the current user.',
|
||||
history: new HistoryBuilder().added('v1').beta('v1').stable('v2'),
|
||||
history: new HistoryBuilder()
|
||||
.added('v1')
|
||||
.beta('v1')
|
||||
.stable('v2')
|
||||
.deprecated('v3', { replacementId: 'updateMyPreferences' }),
|
||||
})
|
||||
updateMyPreferences(
|
||||
@Auth() auth: AuthDto,
|
||||
|
|
@ -109,6 +125,16 @@ export class UserController {
|
|||
return this.service.updateMyPreferences(auth, dto);
|
||||
}
|
||||
|
||||
@Patch('me/preferences')
|
||||
@ApiExcludeEndpoint()
|
||||
@Authenticated({ permission: Permission.UserPreferenceUpdate })
|
||||
updateMyPreferencesV3(
|
||||
@Auth() auth: AuthDto,
|
||||
@Body() dto: UserPreferencesUpdateDto,
|
||||
): Promise<UserPreferencesResponseDto> {
|
||||
return this.service.updateMyPreferences(auth, dto);
|
||||
}
|
||||
|
||||
@Get('me/license')
|
||||
@Authenticated({ permission: Permission.UserLicenseRead })
|
||||
@Endpoint({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue