feat(sync): synchronize customer adresses and orders from Hiboutik sales (#1)

This commit is contained in:
2026-11-07 09:56:53 +00:00
parent 358e99c1ba
commit c91a510c56
16 changed files with 755 additions and 17 deletions

View File

@@ -2,3 +2,11 @@ import { Prisma } from '../generated/client';
/** Product loaded with its versions (`include: { versions: true }`). */
export type ProductWithVersions = Prisma.ProductGetPayload<{ include: { versions: true } }>;
/**
* Order to save with its lines. Lines are kept apart from the nested Prisma input so that the repository can link
* them to the current catalog (`productVersion`) and replace them on update.
*/
export type OrderWithLinesInput = Omit<Prisma.OrderCreateInput, 'lines'> & {
lines: Prisma.OrderLineCreateWithoutOrderInput[];
};

View File

@@ -146,17 +146,30 @@ model Customer {
@@map("customers")
}
/// Address of a customer, mirrored from Hiboutik (sync not implemented yet).
/// Address of a customer, mirrored from Hiboutik. Its recipient (name, company, phone) can differ from the customer.
model CustomerAddress {
id String @id @default(uuid())
updatedAt DateTime @updatedAt
address String
city String
country String
hiboutikId Int @unique
isDefault Boolean @default(false)
zipCode String
address String
city String
company String?
/// Company registration number (SIRET...), only for an address with a company
companyNumber String?
country String
firstName String
hiboutikId Int @unique
isDefault Boolean @default(false)
lastName String
/// Company legal status (SAS, SARL...), only for an address with a company
legalStatus String?
/// Free complement (building, floor, door code...)
other String?
phone String?
state String?
/// Company VAT number, only for an address with a company
taxNumber String?
zipCode String
customer Customer @relation(fields: [customerId], references: [id], onDelete: Cascade)
customerId String