mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
fix: partner asset and exif sync backfill (#19224)
* fix: partner asset sync backfill * fix: add partner asset exif backfill * ci: output content of files that have changed
This commit is contained in:
parent
db68d1af9b
commit
749f63e4a0
21 changed files with 607 additions and 37 deletions
|
|
@ -9,20 +9,23 @@ type Impossible<K extends keyof any> = {
|
|||
type Exact<T, U extends T = T> = U & Impossible<Exclude<keyof U, keyof T>>;
|
||||
|
||||
export const fromAck = (ack: string): SyncAck => {
|
||||
const [type, updateId] = ack.split('|');
|
||||
return { type: type as SyncEntityType, updateId };
|
||||
const [type, updateId, extraId] = ack.split('|');
|
||||
return { type: type as SyncEntityType, updateId, extraId };
|
||||
};
|
||||
|
||||
export const toAck = ({ type, updateId }: SyncAck) => [type, updateId].join('|');
|
||||
export const toAck = ({ type, updateId, extraId }: SyncAck) =>
|
||||
[type, updateId, extraId].filter((v) => v !== undefined).join('|');
|
||||
|
||||
export const mapJsonLine = (object: unknown) => JSON.stringify(object) + '\n';
|
||||
|
||||
export const serialize = <T extends keyof SyncItem, D extends SyncItem[T]>({
|
||||
type,
|
||||
updateId,
|
||||
data,
|
||||
ids,
|
||||
ackType,
|
||||
}: {
|
||||
type: T;
|
||||
updateId: string;
|
||||
data: Exact<SyncItem[T], D>;
|
||||
}) => mapJsonLine({ type, data, ack: toAck({ type, updateId }) });
|
||||
ids: [string] | [string, string];
|
||||
ackType?: SyncEntityType;
|
||||
}) => mapJsonLine({ type, data, ack: toAck({ type: ackType ?? type, updateId: ids[0], extraId: ids[1] }) });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue