MCPcopy
hub / github.com/immich-app/immich / syncPartnerAssetExifsV1

Method syncPartnerAssetExifsV1

server/src/services/sync.service.ts:379–427  ·  view source on GitHub ↗
(
    options: SyncQueryOptions,
    response: Writable,
    checkpointMap: CheckpointMap,
    sessionId: string,
  )

Source from the content-addressed store, hash-verified

377 }
378
379 private async syncPartnerAssetExifsV1(
380 options: SyncQueryOptions,
381 response: Writable,
382 checkpointMap: CheckpointMap,
383 sessionId: string,
384 ) {
385 const backfillType = SyncEntityType.PartnerAssetExifBackfillV1;
386 const backfillCheckpoint = checkpointMap[backfillType];
387 const partners = await this.syncRepository.partner.getCreatedAfter({
388 ...options,
389 afterCreateId: backfillCheckpoint?.updateId,
390 });
391
392 const upsertType = SyncEntityType.PartnerAssetExifV1;
393 const upsertCheckpoint = checkpointMap[upsertType];
394 if (upsertCheckpoint) {
395 const endId = upsertCheckpoint.updateId;
396
397 for (const partner of partners) {
398 const createId = partner.createId;
399 if (isEntityBackfillComplete(createId, backfillCheckpoint)) {
400 continue;
401 }
402
403 const startId = getStartId(createId, backfillCheckpoint);
404 const backfill = this.syncRepository.partnerAssetExif.getBackfill(
405 { ...options, afterUpdateId: startId, beforeUpdateId: endId },
406 partner.sharedById,
407 );
408
409 for await (const { updateId, ...data } of backfill) {
410 send(response, { type: backfillType, ids: [partner.createId, updateId], data });
411 }
412
413 sendEntityBackfillCompleteAck(response, backfillType, partner.createId);
414 }
415 } else if (partners.length > 0) {
416 await this.upsertBackfillCheckpoint({
417 type: backfillType,
418 sessionId,
419 createId: partners.at(-1)!.createId,
420 });
421 }
422
423 const upserts = this.syncRepository.partnerAssetExif.getUpserts({ ...options, ack: checkpointMap[upsertType] });
424 for await (const { updateId, ...data } of upserts) {
425 send(response, { type: upsertType, ids: [updateId], data });
426 }
427 }
428
429 private async syncAlbumsV1(options: SyncQueryOptions, response: Writable, checkpointMap: CheckpointMap) {
430 const deleteType = SyncEntityType.AlbumDeleteV1;

Callers 1

streamMethod · 0.95

Calls 8

isEntityBackfillCompleteFunction · 0.85
getStartIdFunction · 0.85
sendFunction · 0.85
getCreatedAfterMethod · 0.45
getBackfillMethod · 0.45
getUpsertsMethod · 0.45

Tested by

no test coverage detected