- Hiboutik payloads are zod schemas, validated by HiboutikClient (getOne added for single resources: null on 404 or empty answer). - Hiboutik dates are read as Europe/Paris whatever the server time zone. - Paginated lists driving deletions are walked twice when they span several pages (brands, categories, products); categories are sorted by id. - A customer missing from the list is deleted only once Hiboutik confirms it; completed orders that lost their customer are linked back. - Each product and its versions are written in one transaction. - An email removed in Hiboutik is erased in database. - A 429 is retried with backoff, then stops the synchronization. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
14 lines
582 B
TypeScript
14 lines
582 B
TypeScript
import { z } from 'zod';
|
|
import { hiboutikId, hiboutikNumber, hiboutikRef } from './hiboutik.schema';
|
|
|
|
/** Available stock of one product size, as returned by Hiboutik `GET /stock_available/all_wh` (all warehouses). */
|
|
export const stockHiboutikSchema = z.object({
|
|
product_id: hiboutikId,
|
|
/** Size id, 0 for a product without sizes. */
|
|
product_size: hiboutikRef,
|
|
/** Sent as a decimal string, e.g. "3". Stays at 0 while stock management is disabled in Hiboutik. */
|
|
stock_available: hiboutikNumber,
|
|
});
|
|
|
|
export type StockHiboutikDto = z.output<typeof stockHiboutikSchema>;
|