refactor(server): deprecate PUT routes in favor of PATCH (#28859)

* add patch routes and deprecate put

* gen client
This commit is contained in:
Timon authored and GitHub committed 2026-06-07 09:40:01 -04:00
1 parent 8860817c76
commit 9e453440e6
15 files changed
+1215 -65

No files matched your search

+29 -3
View File
@@ -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({