feat(sync): harden the Hiboutik sync, share rate limits across instances, update dependencies (#4)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-08 13:45:08 +00:00
parent 8c8a2ccf15
commit cc3dcd3f0a
62 changed files with 1546 additions and 639 deletions

View File

@@ -1,6 +1,6 @@
import { Injectable } from '@nestjs/common';
import { HiboutikClient } from './hiboutik.client';
import { SaleHiboutikDto } from '../models/hiboutikDTO/sale.hiboutik.dto';
import { SaleHiboutikDto, saleHiboutikSchema } from '../models/hiboutikDTO/sale.hiboutik.dto';
/** Reads sales from the Hiboutik API. */
@Injectable()
@@ -8,12 +8,11 @@ export class SaleHiboutikRepository {
constructor(private readonly hiboutikClient: HiboutikClient) {}
/**
* Full sale, with its lines (Hiboutik answers with a one-element array).
* Full sale, with its lines.
* @throws if the sale does not exist.
*/
async getSaleById(id: number): Promise<SaleHiboutikDto> {
const data = await this.hiboutikClient.get<SaleHiboutikDto[]>('/sales/' + String(id));
const sale = data[0];
const sale = await this.hiboutikClient.getOne(`/sales/${id}`, saleHiboutikSchema);
if (!sale) throw new Error(`Hiboutik sale ${id} not found`);
return sale;
}