feat(25-01): Zod schemas, upsert service functions, passing tests

- Add upsertGlobalItemSchema and bulkUpsertGlobalItemsSchema to schemas.ts
- Add UpsertGlobalItemInput and BulkUpsertGlobalItemsInput types to types.ts
- Implement upsertGlobalItem with onConflictDoUpdate and tag sync
- Implement bulkUpsertGlobalItems processing array in single transaction
- Fix migration 0003 to only add new columns + unique constraint
- All 21 tests pass including 8 new upsert operation tests
This commit is contained in:
2026-04-10 10:58:36 +02:00
parent 9093a2c8f6
commit c8ebbf8139
5 changed files with 212 additions and 15 deletions

View File

@@ -312,9 +312,13 @@ describe("Global Item Service", () => {
imageSourceUrl: "https://apidura.com/images/handlebar-pack.jpg",
});
expect(result.item.sourceUrl).toBe("https://apidura.com/shop/handlebar-pack/");
expect(result.item.sourceUrl).toBe(
"https://apidura.com/shop/handlebar-pack/",
);
expect(result.item.imageCredit).toBe("Apidura Ltd");
expect(result.item.imageSourceUrl).toBe("https://apidura.com/images/handlebar-pack.jpg");
expect(result.item.imageSourceUrl).toBe(
"https://apidura.com/images/handlebar-pack.jpg",
);
});
it("upsertGlobalItem with tags creates tags and links them", async () => {