mirror of
https://github.com/samsonjs/immich.git
synced 2026-04-27 15:07:45 +00:00
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:
parent
520b825511
commit
3cdece4945
3 changed files with 31 additions and 3 deletions
|
|
@ -2528,6 +2528,16 @@
|
||||||
"required": true
|
"required": true
|
||||||
},
|
},
|
||||||
"responses": {
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/AssetMediaResponseDto"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"description": "Asset is a duplicate"
|
||||||
|
},
|
||||||
"201": {
|
"201": {
|
||||||
"content": {
|
"content": {
|
||||||
"application/json": {
|
"application/json": {
|
||||||
|
|
@ -2536,7 +2546,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"description": ""
|
"description": "Asset uploaded successfully"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"security": [
|
"security": [
|
||||||
|
|
@ -3743,7 +3753,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"description": ""
|
"description": "Asset replaced successfully"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"security": [
|
"security": [
|
||||||
|
|
|
||||||
|
|
@ -2390,6 +2390,9 @@ export function uploadAsset({ key, slug, xImmichChecksum, assetMediaCreateDto }:
|
||||||
assetMediaCreateDto: AssetMediaCreateDto;
|
assetMediaCreateDto: AssetMediaCreateDto;
|
||||||
}, opts?: Oazapfts.RequestOpts) {
|
}, opts?: Oazapfts.RequestOpts) {
|
||||||
return oazapfts.ok(oazapfts.fetchJson<{
|
return oazapfts.ok(oazapfts.fetchJson<{
|
||||||
|
status: 200;
|
||||||
|
data: AssetMediaResponseDto;
|
||||||
|
} | {
|
||||||
status: 201;
|
status: 201;
|
||||||
data: AssetMediaResponseDto;
|
data: AssetMediaResponseDto;
|
||||||
}>(`/assets${QS.query(QS.explode({
|
}>(`/assets${QS.query(QS.explode({
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ import {
|
||||||
UploadedFiles,
|
UploadedFiles,
|
||||||
UseInterceptors,
|
UseInterceptors,
|
||||||
} from '@nestjs/common';
|
} 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 { NextFunction, Request, Response } from 'express';
|
||||||
import { Endpoint, HistoryBuilder } from 'src/decorators';
|
import { Endpoint, HistoryBuilder } from 'src/decorators';
|
||||||
import {
|
import {
|
||||||
|
|
@ -62,6 +62,16 @@ export class AssetMediaController {
|
||||||
required: false,
|
required: false,
|
||||||
})
|
})
|
||||||
@ApiBody({ description: 'Asset Upload Information', type: AssetMediaCreateDto })
|
@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({
|
@Endpoint({
|
||||||
summary: 'Upload asset',
|
summary: 'Upload asset',
|
||||||
description: 'Uploads a new asset to the server.',
|
description: 'Uploads a new asset to the server.',
|
||||||
|
|
@ -103,6 +113,11 @@ export class AssetMediaController {
|
||||||
@Put(':id/original')
|
@Put(':id/original')
|
||||||
@UseInterceptors(FileUploadInterceptor)
|
@UseInterceptors(FileUploadInterceptor)
|
||||||
@ApiConsumes('multipart/form-data')
|
@ApiConsumes('multipart/form-data')
|
||||||
|
@ApiResponse({
|
||||||
|
status: 200,
|
||||||
|
description: 'Asset replaced successfully',
|
||||||
|
type: AssetMediaResponseDto,
|
||||||
|
})
|
||||||
@Endpoint({
|
@Endpoint({
|
||||||
summary: 'Replace asset',
|
summary: 'Replace asset',
|
||||||
description: 'Replace the asset with new file, without changing its id.',
|
description: 'Replace the asset with new file, without changing its id.',
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue