fix(mobile): add partial index based on library ID to remote assets (#20214)

* feat: add libraryId to SyncAssetV1

* add partial index

# Conflicts:
#	mobile/drift_schemas/main/drift_schema_v5.json
#	mobile/lib/infrastructure/repositories/db.repository.dart
#	mobile/lib/infrastructure/repositories/db.repository.steps.dart
#	mobile/test/drift/main/generated/schema_v5.dart

* chore: make build

* rebase

---------

Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
This commit is contained in:
shenlong
2025-07-30 23:59:00 +05:30
committed by GitHub
parent f85d8add01
commit 641a3baadd
18 changed files with 6985 additions and 11 deletions

View File

@@ -354,6 +354,7 @@ export const columns = {
'asset.duration',
'asset.livePhotoVideoId',
'asset.stackId',
'asset.libraryId',
],
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'],

View File

@@ -115,6 +115,7 @@ export class SyncAssetV1 {
visibility!: AssetVisibility;
livePhotoVideoId!: string | null;
stackId!: string | null;
libraryId!: string | null;
}
@ExtraModel()

View File

@@ -66,6 +66,7 @@ select
"asset"."duration",
"asset"."livePhotoVideoId",
"asset"."stackId",
"asset"."libraryId",
"asset"."updateId"
from
"asset"
@@ -95,6 +96,7 @@ select
"asset"."duration",
"asset"."livePhotoVideoId",
"asset"."stackId",
"asset"."libraryId",
"asset"."updateId"
from
"asset"
@@ -357,6 +359,7 @@ select
"asset"."duration",
"asset"."livePhotoVideoId",
"asset"."stackId",
"asset"."libraryId",
"asset"."updateId"
from
"asset"
@@ -605,6 +608,7 @@ select
"asset"."duration",
"asset"."livePhotoVideoId",
"asset"."stackId",
"asset"."libraryId",
"asset"."updateId"
from
"asset"
@@ -652,6 +656,7 @@ select
"asset"."duration",
"asset"."livePhotoVideoId",
"asset"."stackId",
"asset"."libraryId",
"asset"."updateId"
from
"asset"

View File

@@ -382,6 +382,7 @@ export class JobService extends BaseService {
visibility: asset.visibility,
livePhotoVideoId: asset.livePhotoVideoId,
stackId: asset.stackId,
libraryId: asset.libraryId,
},
exif: {
assetId: exif.assetId,

View File

@@ -38,6 +38,7 @@ describe(SyncRequestType.AlbumAssetsV1, () => {
duration: '0:10:00.00000',
livePhotoVideoId: null,
stackId: null,
libraryId: null,
});
const { album } = await ctx.newAlbum({ ownerId: user2.id });
await ctx.newAlbumAsset({ albumId: album.id, assetId: asset.id });
@@ -64,6 +65,7 @@ describe(SyncRequestType.AlbumAssetsV1, () => {
duration: asset.duration,
livePhotoVideoId: asset.livePhotoVideoId,
stackId: asset.stackId,
libraryId: asset.libraryId,
},
type: SyncEntityType.AlbumAssetV1,
},

View File

@@ -36,6 +36,7 @@ describe(SyncEntityType.AssetV1, () => {
localDateTime: date,
deletedAt: null,
duration: '0:10:00.00000',
libraryId: null,
});
const response = await ctx.syncStream(auth, [SyncRequestType.AssetsV1]);
@@ -59,6 +60,7 @@ describe(SyncEntityType.AssetV1, () => {
duration: asset.duration,
stackId: null,
livePhotoVideoId: null,
libraryId: asset.libraryId,
},
type: 'AssetV1',
},

View File

@@ -40,6 +40,7 @@ describe(SyncRequestType.PartnerAssetsV1, () => {
localDateTime: date,
deletedAt: null,
duration: '0:10:00.00000',
libraryId: null,
});
await ctx.newPartner({ sharedById: user2.id, sharedWithId: auth.user.id });
@@ -65,6 +66,7 @@ describe(SyncRequestType.PartnerAssetsV1, () => {
duration: asset.duration,
stackId: null,
livePhotoVideoId: null,
libraryId: asset.libraryId,
},
type: SyncEntityType.PartnerAssetV1,
},