diff --git a/mobile/lib/models/activities/activity.model.dart b/mobile/lib/models/activities/activity.model.dart index 9cb3d0790c..6adb80dca9 100644 --- a/mobile/lib/models/activities/activity.model.dart +++ b/mobile/lib/models/activities/activity.model.dart @@ -43,7 +43,7 @@ class Activity { assetId = dto.assetId, comment = dto.comment, createdAt = dto.createdAt, - type = dto.type == ActivityResponseDtoTypeEnum.comment + type = dto.type == ReactionType.comment ? ActivityType.comment : ActivityType.like, user = User.fromSimpleUserDto(dto.user); diff --git a/mobile/openapi/lib/model/activity_response_dto.dart b/mobile/openapi/lib/model/activity_response_dto.dart index cd7a4f482f..bfffd8485b 100644 Binary files a/mobile/openapi/lib/model/activity_response_dto.dart and b/mobile/openapi/lib/model/activity_response_dto.dart differ diff --git a/mobile/openapi/lib/model/memory_response_dto.dart b/mobile/openapi/lib/model/memory_response_dto.dart index 06e0e3114b..f794be53cd 100644 Binary files a/mobile/openapi/lib/model/memory_response_dto.dart and b/mobile/openapi/lib/model/memory_response_dto.dart differ diff --git a/open-api/immich-openapi-specs.json b/open-api/immich-openapi-specs.json index 3e1744d570..5a327f1d34 100644 --- a/open-api/immich-openapi-specs.json +++ b/open-api/immich-openapi-specs.json @@ -7216,11 +7216,7 @@ "type": "string" }, "type": { - "enum": [ - "comment", - "like" - ], - "type": "string" + "$ref": "#/components/schemas/ReactionType" }, "user": { "$ref": "#/components/schemas/UserResponseDto" @@ -9311,10 +9307,7 @@ "type": "string" }, "type": { - "enum": [ - "on_this_day" - ], - "type": "string" + "$ref": "#/components/schemas/MemoryType" }, "updatedAt": { "format": "date-time", diff --git a/open-api/typescript-sdk/src/fetch-client.ts b/open-api/typescript-sdk/src/fetch-client.ts index 7b43a6f3ff..85575893f0 100644 --- a/open-api/typescript-sdk/src/fetch-client.ts +++ b/open-api/typescript-sdk/src/fetch-client.ts @@ -26,7 +26,7 @@ export type ActivityResponseDto = { comment?: string | null; createdAt: string; id: string; - "type": Type; + "type": ReactionType; user: UserResponseDto; }; export type ActivityCreateDto = { @@ -572,7 +572,7 @@ export type MemoryResponseDto = { memoryAt: string; ownerId: string; seenAt?: string; - "type": Type2; + "type": MemoryType; updatedAt: string; }; export type MemoryCreateDto = { @@ -3065,10 +3065,6 @@ export enum ReactionType { Comment = "comment", Like = "like" } -export enum Type { - Comment = "comment", - Like = "like" -} export enum UserAvatarColor { Primary = "primary", Pink = "pink", @@ -3164,9 +3160,6 @@ export enum MapTheme { Light = "light", Dark = "dark" } -export enum Type2 { - OnThisDay = "on_this_day" -} export enum MemoryType { OnThisDay = "on_this_day" } diff --git a/server/src/dtos/activity.dto.ts b/server/src/dtos/activity.dto.ts index 4a3de208ff..4bc0065244 100644 --- a/server/src/dtos/activity.dto.ts +++ b/server/src/dtos/activity.dto.ts @@ -19,6 +19,7 @@ export type MaybeDuplicate = { duplicate: boolean; value: T }; export class ActivityResponseDto { id!: string; createdAt!: Date; + @ApiProperty({ enumName: 'ReactionType', enum: ReactionType }) type!: ReactionType; user!: UserResponseDto; assetId!: string | null; @@ -53,7 +54,7 @@ export class ActivitySearchDto extends ActivityDto { userId?: string; } -const isComment = (dto: ActivityCreateDto) => dto.type === 'comment'; +const isComment = (dto: ActivityCreateDto) => dto.type === ReactionType.COMMENT; export class ActivityCreateDto extends ActivityDto { @IsEnum(ReactionType) diff --git a/server/src/dtos/memory.dto.ts b/server/src/dtos/memory.dto.ts index ecd62785f8..c9db4b04e0 100644 --- a/server/src/dtos/memory.dto.ts +++ b/server/src/dtos/memory.dto.ts @@ -61,6 +61,7 @@ export class MemoryResponseDto { memoryAt!: Date; seenAt?: Date; ownerId!: string; + @ApiProperty({ enumName: 'MemoryType', enum: MemoryType }) type!: MemoryType; data!: MemoryData; isSaved!: boolean; diff --git a/web/src/lib/components/asset-viewer/activity-viewer.svelte b/web/src/lib/components/asset-viewer/activity-viewer.svelte index 4664dcc3c5..050802e1d0 100644 --- a/web/src/lib/components/asset-viewer/activity-viewer.svelte +++ b/web/src/lib/components/asset-viewer/activity-viewer.svelte @@ -8,7 +8,6 @@ import { isTenMinutesApart } from '$lib/utils/timesince'; import { ReactionType, - Type, createActivity, deleteActivity, getActivities, @@ -111,15 +110,15 @@ await deleteActivity({ id: reaction.id }); reactions.splice(index, 1); reactions = reactions; - if (isLiked && reaction.type === 'like' && reaction.id == isLiked.id) { + if (isLiked && reaction.type === ReactionType.Like && reaction.id == isLiked.id) { dispatch('deleteLike'); } else { dispatch('deleteComment'); } - const deleteMessages: Record = { - [Type.Comment]: $t('comment_deleted'), - [Type.Like]: $t('like_deleted'), + const deleteMessages: Record = { + [ReactionType.Comment]: $t('comment_deleted'), + [ReactionType.Like]: $t('like_deleted'), }; notificationController.show({ message: deleteMessages[reaction.type], @@ -172,7 +171,7 @@ style="height: {divHeight}px;padding-bottom: {chatHeight}px" > {#each reactions as reaction, index (reaction.id)} - {#if reaction.type === 'comment'} + {#if reaction.type === ReactionType.Comment}
@@ -216,7 +215,7 @@ {timeSince(luxon.DateTime.fromISO(reaction.createdAt, { locale: $locale }))}
{/if} - {:else if reaction.type === 'like'} + {:else if reaction.type === ReactionType.Like}