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
1 change: 1 addition & 0 deletions i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -928,6 +928,7 @@
"download_include_embedded_motion_videos": "Embedded videos",
"download_include_embedded_motion_videos_description": "Include videos embedded in motion photos as a separate file",
"download_notfound": "Download not found",
"download_original": "Download original",
"download_paused": "Download paused",
"download_settings": "Download",
"download_settings_description": "Manage settings related to asset download",
Expand Down
5 changes: 5 additions & 0 deletions mobile/lib/utils/openapi_patching.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ dynamic upgradeDto(dynamic value, String targetType) {
if (value is Map) {
addDefault(value, 'visibility', 'timeline');
addDefault(value, 'createdAt', DateTime.now().toIso8601String());
addDefault(value, 'isEdited', false);
}
break;
case 'UserAdminResponseDto':
Expand All @@ -46,6 +47,10 @@ dynamic upgradeDto(dynamic value, String targetType) {
addDefault(value, 'profileChangedAt', DateTime.now().toIso8601String());
addDefault(value, 'hasProfileImage', false);
}
case 'SyncAssetV1':
if (value is Map) {
addDefault(value, 'editCount', 0);
}
case 'ServerFeaturesDto':
if (value is Map) {
addDefault(value, 'ocr', false);
Expand Down
10 changes: 9 additions & 1 deletion mobile/openapi/lib/model/asset_response_dto.dart

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

10 changes: 9 additions & 1 deletion mobile/openapi/lib/model/sync_asset_v1.dart

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

Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ SyncAssetV1 _createAsset({
livePhotoVideoId: null,
stackId: null,
thumbhash: null,
editCount: 0,
);
}

Expand Down
1 change: 1 addition & 0 deletions mobile/test/fixtures/sync_stream.stub.dart
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ abstract final class SyncStreamStub {
visibility: AssetVisibility.timeline,
width: null,
height: null,
editCount: 0,
),
ack: ack,
);
Expand Down
19 changes: 19 additions & 0 deletions open-api/immich-openapi-specs.json
Original file line number Diff line number Diff line change
Expand Up @@ -16276,6 +16276,20 @@
"isArchived": {
"type": "boolean"
},
"isEdited": {
"type": "boolean",
"x-immich-history": [
{
"version": "v2.5.0",
"state": "Added"
},
{
"version": "v2.5.0",
"state": "Beta"
}
],
"x-immich-state": "Beta"
},
"isFavorite": {
"type": "boolean"
},
Expand Down Expand Up @@ -16408,6 +16422,7 @@
"height",
"id",
"isArchived",
"isEdited",
"isFavorite",
"isOffline",
"isTrashed",
Expand Down Expand Up @@ -21276,6 +21291,9 @@
"nullable": true,
"type": "string"
},
"editCount": {
"type": "integer"
},
"fileCreatedAt": {
"format": "date-time",
"nullable": true,
Expand Down Expand Up @@ -21346,6 +21364,7 @@
"checksum",
"deletedAt",
"duration",
"editCount",
"fileCreatedAt",
"fileModifiedAt",
"height",
Expand Down
1 change: 1 addition & 0 deletions open-api/typescript-sdk/src/fetch-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ export type AssetResponseDto = {
height: number | null;
id: string;
isArchived: boolean;
isEdited: boolean;
isFavorite: boolean;
isOffline: boolean;
isTrashed: boolean;
Expand Down
1 change: 1 addition & 0 deletions server/src/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@ export const columns = {
'asset.libraryId',
'asset.width',
'asset.height',
'asset.editCount',
],
syncAlbumUser: ['album_user.albumId as albumId', 'album_user.userId as userId', 'album_user.role'],
syncStack: ['stack.id', 'stack.createdAt', 'stack.updatedAt', 'stack.primaryAssetId', 'stack.ownerId'],
Expand Down
4 changes: 4 additions & 0 deletions server/src/dtos/asset-response.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ export class AssetResponseDto extends SanitizedAssetResponseDto {

@Property({ history: new HistoryBuilder().added('v1').deprecated('v1.113.0') })
resized?: boolean;
@Property({ history: new HistoryBuilder().added('v2.5.0').beta('v2.5.0') })
isEdited!: boolean;
}

export type MapAsset = {
Expand Down Expand Up @@ -137,6 +139,7 @@ export type MapAsset = {
type: AssetType;
width: number | null;
height: number | null;
editCount: number;
};

export class AssetStackResponseDto {
Expand Down Expand Up @@ -245,5 +248,6 @@ export function mapAsset(entity: MapAsset, options: AssetMapOptions = {}): Asset
resized: true,
width: entity.width,
height: entity.height,
isEdited: entity.editCount > 0,
};
}
2 changes: 2 additions & 0 deletions server/src/dtos/sync.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ export class SyncAssetV1 {
width!: number | null;
@ApiProperty({ type: 'integer' })
height!: number | null;
@ApiProperty({ type: 'integer' })
editCount!: number;
}

@ExtraModel()
Expand Down
8 changes: 7 additions & 1 deletion server/src/queries/sync.repository.sql
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ select
"asset"."libraryId",
"asset"."width",
"asset"."height",
"asset"."editCount",
"album_asset"."updateId"
from
"album_asset" as "album_asset"
Expand Down Expand Up @@ -103,6 +104,7 @@ select
"asset"."libraryId",
"asset"."width",
"asset"."height",
"asset"."editCount",
"asset"."updateId"
from
"asset" as "asset"
Expand Down Expand Up @@ -140,7 +142,8 @@ select
"asset"."stackId",
"asset"."libraryId",
"asset"."width",
"asset"."height"
"asset"."height",
"asset"."editCount"
from
"album_asset" as "album_asset"
inner join "asset" on "asset"."id" = "album_asset"."assetId"
Expand Down Expand Up @@ -456,6 +459,7 @@ select
"asset"."libraryId",
"asset"."width",
"asset"."height",
"asset"."editCount",
"asset"."updateId"
from
"asset" as "asset"
Expand Down Expand Up @@ -751,6 +755,7 @@ select
"asset"."libraryId",
"asset"."width",
"asset"."height",
"asset"."editCount",
"asset"."updateId"
from
"asset" as "asset"
Expand Down Expand Up @@ -802,6 +807,7 @@ select
"asset"."libraryId",
"asset"."width",
"asset"."height",
"asset"."editCount",
"asset"."updateId"
from
"asset" as "asset"
Expand Down
28 changes: 28 additions & 0 deletions server/src/schema/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,3 +255,31 @@ export const asset_face_audit = registerFunction({
RETURN NULL;
END`,
});

export const asset_edit_insert = registerFunction({
name: 'asset_edit_insert',
returnType: 'TRIGGER',
language: 'PLPGSQL',
body: `
BEGIN
UPDATE asset
SET "editCount" = "editCount" + 1
WHERE "id" = NEW."assetId";
RETURN NULL;
END
`,
});

export const asset_edit_delete = registerFunction({
name: 'asset_edit_delete',
returnType: 'TRIGGER',
language: 'PLPGSQL',
body: `
BEGIN
UPDATE asset
SET "editCount" = "editCount" - 1
WHERE "id" = OLD."assetId";
RETURN NULL;
END
`,
});
Loading
Loading