High performance self-hosted photo and video management solution.
TypeScript backup-toolfluttergoogle-photosgoogle-photos-alternativejavascriptmobile-appnestjsnodejsphoto-galleryphotosphotos-managementself-hostedsveltesveltekittypescriptvideos
fix(server): Document HTTP 200 response for duplicate uploads in OpenAPI (#25148)
Timon3cdece4945a2
diff --git a/open-api/immich-openapi-specs.json b/open-api/immich-openapi-specs.jsonindex 25be8d2f45..70f482c5b2 100644--- a/open-api/immich-openapi-specs.json+++ b/open-api/immich-openapi-specs.json@@ -2528,6 +2528,16 @@"required": true},"responses": {+ "200": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/AssetMediaResponseDto"+ }+ }+ },+ "description": "Asset is a duplicate"+ },"201": {"content": {"application/json": {@@ -2536,7 +2546,7 @@}}},- "description": ""+ "description": "Asset uploaded successfully"}},"security": [@@ -3743,7 +3753,7 @@}}},- "description": ""+ "description": "Asset replaced successfully"}},"security": [diff --git a/open-api/typescript-sdk/src/fetch-client.ts b/open-api/typescript-sdk/src/fetch-client.tsindex ab6b894c60..afc583f91d 100644--- a/open-api/typescript-sdk/src/fetch-client.ts+++ b/open-api/typescript-sdk/src/fetch-client.ts@@ -2390,6 +2390,9 @@ export function uploadAsset({ key, slug, xImmichChecksum, assetMediaCreateDto }:assetMediaCreateDto: AssetMediaCreateDto;}, opts?: Oazapfts.RequestOpts) {return oazapfts.ok(oazapfts.fetchJson<{+ status: 200;+ data: AssetMediaResponseDto;+ } | {status: 201;data: AssetMediaResponseDto;}>(`/assets${QS.query(QS.explode({diff --git a/server/src/controllers/asset-media.controller.ts b/server/src/controllers/asset-media.controller.tsindex 843c2a3f3d..d52a40d7dd 100644--- a/server/src/controllers/asset-media.controller.ts+++ b/server/src/controllers/asset-media.controller.ts@@ -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.',