Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(server): new full sync return stacked assets individually #9189

Merged
merged 6 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 0 additions & 2 deletions server/src/interfaces/asset.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,6 @@ export interface AssetFullSyncOptions {
lastCreationDate?: Date;
lastId?: string;
updatedUntil: Date;
isArchived?: false;
withStacked?: true;
limit: number;
}

Expand Down
4 changes: 0 additions & 4 deletions server/src/queries/asset.repository.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1059,8 +1059,4 @@ FROM
WHERE
"asset"."isVisible" = true
AND "asset"."ownerId" IN ($1)
AND (
"stack"."primaryAssetId" = "asset"."id"
OR "asset"."stackId" IS NULL
)
AND "asset"."updatedAt" > $2
11 changes: 5 additions & 6 deletions server/src/repositories/asset.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -741,12 +741,11 @@ export class AssetRepository implements IAssetRepository {
],
})
getAllForUserFullSync(options: AssetFullSyncOptions): Promise<AssetEntity[]> {
const { ownerId, isArchived, withStacked, lastCreationDate, lastId, updatedUntil, limit } = options;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remove with stacked from the options interface then?

const { ownerId, lastCreationDate, lastId, updatedUntil, limit } = options;
const builder = this.getBuilder({
userIds: [ownerId],
exifInfo: true,
withStacked,
isArchived,
exifInfo: true, // also joins stack information
withStacked: false, // return all assets individually as expected by the app
});

if (lastCreationDate !== undefined && lastId !== undefined) {
Expand All @@ -767,9 +766,9 @@ export class AssetRepository implements IAssetRepository {

@GenerateSql({ params: [{ userIds: [DummyValue.UUID], updatedAfter: DummyValue.DATE }] })
getChangedDeltaSync(options: AssetDeltaSyncOptions): Promise<AssetEntity[]> {
const builder = this.getBuilder({ userIds: options.userIds, exifInfo: true, withStacked: true })
const builder = this.getBuilder({ userIds: options.userIds, exifInfo: true, withStacked: false })
.andWhere({ updatedAt: MoreThan(options.updatedAfter) })
.take(options.limit)
.limit(options.limit)
.withDeleted();

return builder.getMany();
Expand Down