feat(hiboutik): add Hiboutik API client, repositories and DTOs

HiboutikClient handles Basic auth and walks paginated endpoints. One read-only repository per entity (brands, categories, suppliers, products, stocks, customers).
This commit is contained in:
MastersGame
2026-11-05 23:00:47 +01:00
parent 8f377a1fe9
commit 2424a086e0
13 changed files with 334 additions and 0 deletions

View File

@@ -0,0 +1,79 @@
/** Customer summary as returned by Hiboutik `GET /customers` (no addresses nor sales). */
export interface CustomerHiboutikDto {
customers_id: number;
last_name: string;
first_name: string;
company: string;
email: string;
phone: string;
vat: string;
country: string;
/** "YYYY-MM-DD", "0000-00-00" when unknown. */
date_of_birth: string;
customers_code: string;
loyalty_points: number;
intial_loyalty_points: number;
validity: string;
prepaid_purchases: string;
store_credit: string;
turnover: string;
orders: number;
customer_ref_ext: string;
last_order_date: string;
/** Local time, "YYYY-MM-DD HH:mm:ss". */
updated_at: string;
}
/** Full customer as returned by Hiboutik `GET /customer/:customers_id`, with its addresses and sales. */
export interface FullCustomerHiboutikDto extends CustomerHiboutikDto {
gender: number;
comments: string;
customers_id_referrer: number;
customers_misc: string;
accounting_account: string;
addresses: CustomerAddressHiboutikDto[];
sales: CustomerSaleHiboutikDto[];
tags: unknown[];
customers_referee: unknown[];
}
/** Address of a customer, embedded in {@link FullCustomerHiboutikDto}. Name and phone can differ from the customer's. */
export interface CustomerAddressHiboutikDto {
address_id: number;
gender: string;
first_name: string;
last_name: string;
creation_date: string;
email: string;
phone: string;
company: string;
address: string;
zip_code: string;
city: string;
state: string;
country: string;
customers_id: number;
display: number;
editable: number;
/** 1 for the customer's default address. */
default: number;
other: string;
}
/** Sale header embedded in {@link FullCustomerHiboutikDto}: no sale lines, they come from `GET /sales/:sale_id`. */
export interface CustomerSaleHiboutikDto {
sale_id: number;
created_at: string;
completed_at: string;
date_z: number;
store_id: number;
vendor_id: number;
unique_sale_id: string;
customer_id: number;
currency: string;
/** Decimal as a string. */
total: string;
points: number;
billing_address: number;
shipping_address: number;
}