Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion mobile/openapi/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions mobile/openapi/lib/api/assets_api.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

134 changes: 134 additions & 0 deletions mobile/openapi/lib/api/deprecated_api.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 7 additions & 4 deletions open-api/immich-openapi-specs.json
Original file line number Diff line number Diff line change
Expand Up @@ -2504,7 +2504,8 @@
"description": "This endpoint requires the `asset.download` permission."
},
"put": {
"description": "Replace the asset with new file, without changing its id. This endpoint requires the `asset.replace` permission.",
"deprecated": true,
"description": "This property was deprecated in v1.142.0. Replace the asset with new file, without changing its id. This endpoint requires the `asset.replace` permission.",
"operationId": "replaceAsset",
"parameters": [
{
Expand Down Expand Up @@ -2566,12 +2567,14 @@
"api_key": []
}
],
"summary": "replaceAsset",
"summary": "Replace the asset with new file, without changing its id",
"tags": [
"Assets"
"Assets",
"Deprecated"
],
"x-immich-lifecycle": {
"addedAt": "v1.106.0"
"addedAt": "v1.106.0",
"deprecatedAt": "v1.142.0"
},
"x-immich-permission": "asset.replace"
}
Expand Down
2 changes: 1 addition & 1 deletion open-api/typescript-sdk/src/fetch-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2368,7 +2368,7 @@ export function downloadAsset({ id, key, slug }: {
}));
}
/**
* replaceAsset
* Replace the asset with new file, without changing its id
*/
export function replaceAsset({ id, key, slug, assetMediaReplaceDto }: {
id: string;
Expand Down
5 changes: 3 additions & 2 deletions server/src/controllers/asset-media.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,9 @@ export class AssetMediaController {
@Put(':id/original')
@UseInterceptors(FileUploadInterceptor)
@ApiConsumes('multipart/form-data')
@EndpointLifecycle({ addedAt: 'v1.106.0' })
@ApiOperation({
@EndpointLifecycle({
addedAt: 'v1.106.0',
deprecatedAt: 'v1.142.0',
summary: 'replaceAsset',
description: 'Replace the asset with new file, without changing its id',
})
Expand Down
15 changes: 12 additions & 3 deletions server/src/decorators.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SetMetadata, applyDecorators } from '@nestjs/common';
import { ApiExtension, ApiOperation, ApiProperty, ApiTags } from '@nestjs/swagger';
import { ApiExtension, ApiOperation, ApiOperationOptions, ApiProperty, ApiTags } from '@nestjs/swagger';
import _ from 'lodash';
import { ADDED_IN_PREFIX, DEPRECATED_IN_PREFIX, LIFECYCLE_EXTENSION } from 'src/constants';
import { ImmichWorker, JobName, MetadataKey, QueueName } from 'src/enum';
Expand Down Expand Up @@ -159,12 +159,21 @@ type LifecycleMetadata = {
deprecatedAt?: LifecycleRelease;
};

export const EndpointLifecycle = ({ addedAt, deprecatedAt }: LifecycleMetadata) => {
export const EndpointLifecycle = ({
addedAt,
deprecatedAt,
description,
...options
}: LifecycleMetadata & ApiOperationOptions) => {
const decorators: MethodDecorator[] = [ApiExtension(LIFECYCLE_EXTENSION, { addedAt, deprecatedAt })];
if (deprecatedAt) {
decorators.push(
ApiTags('Deprecated'),
ApiOperation({ deprecated: true, description: DEPRECATED_IN_PREFIX + deprecatedAt }),
ApiOperation({
deprecated: true,
description: DEPRECATED_IN_PREFIX + deprecatedAt + (description ? `. ${description}` : ''),
...options,
}),
);
}

Expand Down
Loading