(
options: SyncQueryOptions,
response: Writable,
checkpointMap: CheckpointMap,
sessionId: string,
)
| 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; |
no test coverage detected