High performance self-hosted photo and video management solution.
TypeScript backup-toolfluttergoogle-photosgoogle-photos-alternativejavascriptmobile-appnestjsnodejsphoto-galleryphotosphotos-managementself-hostedsveltesveltekittypescriptvideos
chore: asset sync FKs (#19927)
Jason Rasmussen805ec3e351e2
diff --git a/mobile/openapi/lib/model/sync_asset_v1.dart b/mobile/openapi/lib/model/sync_asset_v1.dartindex 1ca6e20cff..4c42d08a5f 100644--- a/mobile/openapi/lib/model/sync_asset_v1.dart+++ b/mobile/openapi/lib/model/sync_asset_v1.dart@@ -20,9 +20,11 @@ class SyncAssetV1 {required this.fileModifiedAt,required this.id,required this.isFavorite,+ required this.livePhotoVideoId,required this.localDateTime,required this.originalFileName,required this.ownerId,+ required this.stackId,required this.thumbhash,required this.type,required this.visibility,@@ -42,12 +44,16 @@ class SyncAssetV1 {bool isFavorite;+ String? livePhotoVideoId;+DateTime? localDateTime;String originalFileName;String ownerId;+ String? stackId;+String? thumbhash;AssetTypeEnum type;@@ -63,9 +69,11 @@ class SyncAssetV1 {other.fileModifiedAt == fileModifiedAt &&other.id == id &&other.isFavorite == isFavorite &&+ other.livePhotoVideoId == livePhotoVideoId &&other.localDateTime == localDateTime &&other.originalFileName == originalFileName &&other.ownerId == ownerId &&+ other.stackId == stackId &&other.thumbhash == thumbhash &&other.type == type &&other.visibility == visibility;@@ -80,15 +88,17 @@ class SyncAssetV1 {(fileModifiedAt == null ? 0 : fileModifiedAt!.hashCode) +(id.hashCode) +(isFavorite.hashCode) ++ (livePhotoVideoId == null ? 0 : livePhotoVideoId!.hashCode) +(localDateTime == null ? 0 : localDateTime!.hashCode) +(originalFileName.hashCode) +(ownerId.hashCode) ++ (stackId == null ? 0 : stackId!.hashCode) +(thumbhash == null ? 0 : thumbhash!.hashCode) +(type.hashCode) +(visibility.hashCode);@override- String toString() => 'SyncAssetV1[checksum=$checksum, deletedAt=$deletedAt, duration=$duration, fileCreatedAt=$fileCreatedAt, fileModifiedAt=$fileModifiedAt, id=$id, isFavorite=$isFavorite, localDateTime=$localDateTime, originalFileName=$originalFileName, ownerId=$ownerId, thumbhash=$thumbhash, type=$type, visibility=$visibility]';+ String toString() => 'SyncAssetV1[checksum=$checksum, deletedAt=$deletedAt, duration=$duration, fileCreatedAt=$fileCreatedAt, fileModifiedAt=$fileModifiedAt, id=$id, isFavorite=$isFavorite, livePhotoVideoId=$livePhotoVideoId, localDateTime=$localDateTime, originalFileName=$originalFileName, ownerId=$ownerId, stackId=$stackId, thumbhash=$thumbhash, type=$type, visibility=$visibility]';Map<String, dynamic> toJson() {final json = <String, dynamic>{};@@ -115,6 +125,11 @@ class SyncAssetV1 {}json[r'id'] = this.id;json[r'isFavorite'] = this.isFavorite;+ if (this.livePhotoVideoId != null) {+ json[r'livePhotoVideoId'] = this.livePhotoVideoId;+ } else {+ // json[r'livePhotoVideoId'] = null;+ }if (this.localDateTime != null) {json[r'localDateTime'] = this.localDateTime!.toUtc().toIso8601String();} else {@@ -122,6 +137,11 @@ class SyncAssetV1 {}json[r'originalFileName'] = this.originalFileName;json[r'ownerId'] = this.ownerId;+ if (this.stackId != null) {+ json[r'stackId'] = this.stackId;+ } else {+ // json[r'stackId'] = null;+ }if (this.thumbhash != null) {json[r'thumbhash'] = this.thumbhash;} else {@@ -148,9 +168,11 @@ class SyncAssetV1 {fileModifiedAt: mapDateTime(json, r'fileModifiedAt', r''),id: mapValueOfType<String>(json, r'id')!,isFavorite: mapValueOfType<bool>(json, r'isFavorite')!,+ livePhotoVideoId: mapValueOfType<String>(json, r'livePhotoVideoId'),localDateTime: mapDateTime(json, r'localDateTime', r''),originalFileName: mapValueOfType<String>(json, r'originalFileName')!,ownerId: mapValueOfType<String>(json, r'ownerId')!,+ stackId: mapValueOfType<String>(json, r'stackId'),thumbhash: mapValueOfType<String>(json, r'thumbhash'),type: AssetTypeEnum.fromJson(json[r'type'])!,visibility: AssetVisibility.fromJson(json[r'visibility'])!,@@ -208,9 +230,11 @@ class SyncAssetV1 {'fileModifiedAt','id','isFavorite',+ 'livePhotoVideoId','localDateTime','originalFileName','ownerId',+ 'stackId','thumbhash','type','visibility',diff --git a/open-api/immich-openapi-specs.json b/open-api/immich-openapi-specs.jsonindex 492d3cfec1..71329c3f75 100644--- a/open-api/immich-openapi-specs.json+++ b/open-api/immich-openapi-specs.json@@ -13818,6 +13818,10 @@"isFavorite": {"type": "boolean"},+ "livePhotoVideoId": {+ "nullable": true,+ "type": "string"+ },"localDateTime": {"format": "date-time","nullable": true,@@ -13829,6 +13833,10 @@"ownerId": {"type": "string"},+ "stackId": {+ "nullable": true,+ "type": "string"+ },"thumbhash": {"nullable": true,"type": "string"@@ -13856,9 +13864,11 @@"fileModifiedAt","id","isFavorite",+ "livePhotoVideoId","localDateTime","originalFileName","ownerId",+ "stackId","thumbhash","type","visibility"diff --git a/server/src/database.ts b/server/src/database.tsindex a89299fbeb..d42b2618a4 100644--- a/server/src/database.ts+++ b/server/src/database.ts@@ -349,6 +349,8 @@ export const columns = {'asset.isFavorite','asset.visibility','asset.duration',+ 'asset.livePhotoVideoId',+ 'asset.stackId',],syncAlbumUser: ['album_user.albumsId as albumId', 'album_user.usersId as userId', 'album_user.role'],syncStack: ['stack.id', 'stack.createdAt', 'stack.updatedAt', 'stack.primaryAssetId', 'stack.ownerId'],diff --git a/server/src/dtos/sync.dto.ts b/server/src/dtos/sync.dto.tsindex abd7d7b694..8ba73271e6 100644--- a/server/src/dtos/sync.dto.ts+++ b/server/src/dtos/sync.dto.ts@@ -96,6 +96,8 @@ export class SyncAssetV1 {isFavorite!: boolean;@ApiProperty({ enumName: 'AssetVisibility', enum: AssetVisibility })visibility!: AssetVisibility;+ livePhotoVideoId!: string | null;+ stackId!: string | null;}@ExtraModel()diff --git a/server/src/queries/sync.repository.sql b/server/src/queries/sync.repository.sqlindex 2f484f6d52..4782eedf1d 100644--- a/server/src/queries/sync.repository.sql+++ b/server/src/queries/sync.repository.sql@@ -64,6 +64,8 @@ select"asset"."isFavorite","asset"."visibility","asset"."duration",+ "asset"."livePhotoVideoId",+ "asset"."stackId","asset"."updateId"from"asset"@@ -91,6 +93,8 @@ select"asset"."isFavorite","asset"."visibility","asset"."duration",+ "asset"."livePhotoVideoId",+ "asset"."stackId","asset"."updateId"from"asset"@@ -351,6 +355,8 @@ select"asset"."isFavorite","asset"."visibility","asset"."duration",+ "asset"."livePhotoVideoId",+ "asset"."stackId","asset"."updateId"from"asset"@@ -539,6 +545,8 @@ select"asset"."isFavorite","asset"."visibility","asset"."duration",+ "asset"."livePhotoVideoId",+ "asset"."stackId","asset"."updateId"from"asset"@@ -584,6 +592,8 @@ select"asset"."isFavorite","asset"."visibility","asset"."duration",+ "asset"."livePhotoVideoId",+ "asset"."stackId","asset"."updateId"from"asset"diff --git a/server/src/services/job.service.ts b/server/src/services/job.service.tsindex 645b22249f..37a66706c0 100644--- a/server/src/services/job.service.ts+++ b/server/src/services/job.service.ts@@ -380,6 +380,8 @@ export class JobService extends BaseService {deletedAt: asset.deletedAt,isFavorite: asset.isFavorite,visibility: asset.visibility,+ livePhotoVideoId: asset.livePhotoVideoId,+ stackId: asset.stackId,},exif: {assetId: exif.assetId,diff --git a/server/test/medium/specs/sync/sync-album-asset.spec.ts b/server/test/medium/specs/sync/sync-album-asset.spec.tsindex 6bfb6b5d27..41700d29d4 100644--- a/server/test/medium/specs/sync/sync-album-asset.spec.ts+++ b/server/test/medium/specs/sync/sync-album-asset.spec.ts@@ -36,6 +36,8 @@ describe(SyncRequestType.AlbumAssetsV1, () => {localDateTime: date,deletedAt: null,duration: '0:10:00.00000',+ livePhotoVideoId: null,+ stackId: null,});const { album } = await ctx.newAlbum({ ownerId: user2.id });await ctx.newAlbumAsset({ albumId: album.id, assetId: asset.id });@@ -60,6 +62,8 @@ describe(SyncRequestType.AlbumAssetsV1, () => {type: asset.type,visibility: asset.visibility,duration: asset.duration,+ livePhotoVideoId: asset.livePhotoVideoId,+ stackId: asset.stackId,},type: SyncEntityType.AlbumAssetV1,},diff --git a/server/test/medium/specs/sync/sync-asset.spec.ts b/server/test/medium/specs/sync/sync-asset.spec.tsindex 8603296028..52d6bcb524 100644--- a/server/test/medium/specs/sync/sync-asset.spec.ts+++ b/server/test/medium/specs/sync/sync-asset.spec.ts@@ -57,6 +57,8 @@ describe(SyncEntityType.AssetV1, () => {type: asset.type,visibility: asset.visibility,duration: asset.duration,+ stackId: null,+ livePhotoVideoId: null,},type: 'AssetV1',},diff --git a/server/test/medium/specs/sync/sync-partner-asset.spec.ts b/server/test/medium/specs/sync/sync-partner-asset.spec.tsindex d9655add57..2daa750bf3 100644--- a/server/test/medium/specs/sync/sync-partner-asset.spec.ts+++ b/server/test/medium/specs/sync/sync-partner-asset.spec.ts@@ -63,6 +63,8 @@ describe(SyncRequestType.PartnerAssetsV1, () => {type: asset.type,visibility: asset.visibility,duration: asset.duration,+ stackId: null,+ livePhotoVideoId: null,},type: SyncEntityType.PartnerAssetV1,},