fix(server): Document HTTP 200 response for duplicate uploads in OpenAPI (#25148)

* fix(server): Document HTTP 200 response for duplicate uploads in OpenAPI

* fix 201

* rename
This commit is contained in:
Timon
2026-01-09 05:52:31 +01:00
committed by GitHub
parent 520b825511
commit 3cdece4945
3 changed files with 31 additions and 3 deletions

View File

@@ -15,7 +15,7 @@ import {
UploadedFiles,
UseInterceptors,
} from '@nestjs/common';
import { ApiBody, ApiConsumes, ApiHeader, ApiTags } from '@nestjs/swagger';
import { ApiBody, ApiConsumes, ApiHeader, ApiResponse, ApiTags } from '@nestjs/swagger';
import { NextFunction, Request, Response } from 'express';
import { Endpoint, HistoryBuilder } from 'src/decorators';
import {
@@ -62,6 +62,16 @@ export class AssetMediaController {
required: false,
})
@ApiBody({ description: 'Asset Upload Information', type: AssetMediaCreateDto })
@ApiResponse({
status: 200,
description: 'Asset is a duplicate',
type: AssetMediaResponseDto,
})
@ApiResponse({
status: 201,
description: 'Asset uploaded successfully',
type: AssetMediaResponseDto,
})
@Endpoint({
summary: 'Upload asset',
description: 'Uploads a new asset to the server.',
@@ -103,6 +113,11 @@ export class AssetMediaController {
@Put(':id/original')
@UseInterceptors(FileUploadInterceptor)
@ApiConsumes('multipart/form-data')
@ApiResponse({
status: 200,
description: 'Asset replaced successfully',
type: AssetMediaResponseDto,
})
@Endpoint({
summary: 'Replace asset',
description: 'Replace the asset with new file, without changing its id.',