From 9b705e445076db9206bc7ee4b0a878372819de60 Mon Sep 17 00:00:00 2001 From: Alex Date: Wed, 27 Mar 2024 22:27:26 -0500 Subject: [PATCH] chore(server): open-api memory lane number generation (#8314) chore(server): openaapi memory lane number generation --- mobile/openapi/doc/MemoryLaneResponseDto.md | 2 +- mobile/openapi/lib/model/memory_lane_response_dto.dart | 4 ++-- mobile/openapi/test/memory_lane_response_dto_test.dart | 2 +- open-api/immich-openapi-specs.json | 2 +- server/src/dtos/asset-response.dto.ts | 3 +++ 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/mobile/openapi/doc/MemoryLaneResponseDto.md b/mobile/openapi/doc/MemoryLaneResponseDto.md index 102c45f1617f3..54d1a4769a4ad 100644 --- a/mobile/openapi/doc/MemoryLaneResponseDto.md +++ b/mobile/openapi/doc/MemoryLaneResponseDto.md @@ -10,7 +10,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **assets** | [**List**](AssetResponseDto.md) | | [default to const []] **title** | **String** | | -**yearsAgo** | **num** | | +**yearsAgo** | **int** | | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/mobile/openapi/lib/model/memory_lane_response_dto.dart b/mobile/openapi/lib/model/memory_lane_response_dto.dart index 4d6f86fb4752f..a0df079388335 100644 --- a/mobile/openapi/lib/model/memory_lane_response_dto.dart +++ b/mobile/openapi/lib/model/memory_lane_response_dto.dart @@ -22,7 +22,7 @@ class MemoryLaneResponseDto { String title; - num yearsAgo; + int yearsAgo; @override bool operator ==(Object other) => identical(this, other) || other is MemoryLaneResponseDto && @@ -58,7 +58,7 @@ class MemoryLaneResponseDto { return MemoryLaneResponseDto( assets: AssetResponseDto.listFromJson(json[r'assets']), title: mapValueOfType(json, r'title')!, - yearsAgo: num.parse('${json[r'yearsAgo']}'), + yearsAgo: mapValueOfType(json, r'yearsAgo')!, ); } return null; diff --git a/mobile/openapi/test/memory_lane_response_dto_test.dart b/mobile/openapi/test/memory_lane_response_dto_test.dart index 1106ee7d95fd3..4ed84f5ecd056 100644 --- a/mobile/openapi/test/memory_lane_response_dto_test.dart +++ b/mobile/openapi/test/memory_lane_response_dto_test.dart @@ -26,7 +26,7 @@ void main() { // TODO }); - // num yearsAgo + // int yearsAgo test('to test the property `yearsAgo`', () async { // TODO }); diff --git a/open-api/immich-openapi-specs.json b/open-api/immich-openapi-specs.json index 129b001a8d31f..c45914319fc48 100644 --- a/open-api/immich-openapi-specs.json +++ b/open-api/immich-openapi-specs.json @@ -8431,7 +8431,7 @@ "type": "string" }, "yearsAgo": { - "type": "number" + "type": "integer" } }, "required": [ diff --git a/server/src/dtos/asset-response.dto.ts b/server/src/dtos/asset-response.dto.ts index 59c9b90707c62..cf16a99a29cdb 100644 --- a/server/src/dtos/asset-response.dto.ts +++ b/server/src/dtos/asset-response.dto.ts @@ -133,7 +133,10 @@ export function mapAsset(entity: AssetEntity, options: AssetMapOptions = {}): As export class MemoryLaneResponseDto { @ApiProperty({ deprecated: true }) title!: string; + + @ApiProperty({ type: 'integer' }) yearsAgo!: number; + assets!: AssetResponseDto[]; }