feat(sync): add converters from Hiboutik DTOs to Prisma inputs

Includes helpers for Hiboutik dates ("0000-00-00" is ignored) and optional prices ("0.00" means no value).
This commit is contained in:
MastersGame
2026-11-05 23:00:48 +01:00
parent 2424a086e0
commit db699822f9
12 changed files with 294 additions and 0 deletions

10
src/utils/price.ts Normal file
View File

@@ -0,0 +1,10 @@
/**
* Parses an optional Hiboutik price (discount price, size price override).
* Hiboutik sends "0.00" when the value is not set: returns null for empty, zero or invalid values.
*/
export function parseOptionalHiboutikPrice(value: string | null | undefined): string | null {
if (!value) return null;
const price = Number(value);
return Number.isFinite(price) && price > 0 ? value : null;
}