mirror of
https://github.com/immich-app/immich
synced 2025-10-17 18:19:27 +00: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:
parent
58e516c766
commit
103cb60a57
26 changed files with 1178 additions and 13 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue