1
0
mirror of https://github.com/immich-app/immich.git synced 2025-07-17 15:47:54 +02:00

feat(server): efficient full app sync (#8755)

* feat(server): efficient full app sync

* add SQL, fix test compile issues

* fix linter warning

* new sync controller+service, add tests

* enable new sync controller+service

* Update server/src/services/sync.service.ts

Co-authored-by: Daniel Dietzler <36593685+danieldietzler@users.noreply.github.com>

---------

Co-authored-by: Daniel Dietzler <36593685+danieldietzler@users.noreply.github.com>
This commit is contained in:
Fynn Petersen-Frey
2024-04-16 07:26:37 +02:00
committed by GitHub
parent 58e516c766
commit 103cb60a57
26 changed files with 1178 additions and 13 deletions

View File

@ -835,6 +835,11 @@ export type AssetIdsResponseDto = {
error?: Error2;
success: boolean;
};
export type AssetDeltaSyncResponseDto = {
deleted: string[];
needsFullSync: boolean;
upserted: AssetResponseDto[];
};
export type SystemConfigFFmpegDto = {
accel: TranscodeHWAccel;
acceptedAudioCodecs: AudioCodec[];
@ -2507,6 +2512,40 @@ export function addSharedLinkAssets({ id, key, assetIdsDto }: {
body: assetIdsDto
})));
}
export function getDeltaSync({ updatedAfter, userIds }: {
updatedAfter: string;
userIds: string[];
}, opts?: Oazapfts.RequestOpts) {
return oazapfts.ok(oazapfts.fetchJson<{
status: 200;
data: AssetDeltaSyncResponseDto;
}>(`/sync/delta-sync${QS.query(QS.explode({
updatedAfter,
userIds
}))}`, {
...opts
}));
}
export function getAllForUserFullSync({ lastCreationDate, lastId, limit, updatedUntil, userId }: {
lastCreationDate?: string;
lastId?: string;
limit: number;
updatedUntil: string;
userId?: string;
}, opts?: Oazapfts.RequestOpts) {
return oazapfts.ok(oazapfts.fetchJson<{
status: 200;
data: AssetResponseDto[];
}>(`/sync/full-sync${QS.query(QS.explode({
lastCreationDate,
lastId,
limit,
updatedUntil,
userId
}))}`, {
...opts
}));
}
export function getConfig(opts?: Oazapfts.RequestOpts) {
return oazapfts.ok(oazapfts.fetchJson<{
status: 200;