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:
@@ -1,14 +1,15 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { HiboutikClient } from './hiboutik.client';
|
||||
import { BrandHiboutikDto } from '../models/hiboutikDTO/brand.hiboutik.dto';
|
||||
import { BrandHiboutikDto, brandHiboutikSchema } from '../models/hiboutikDTO/brand.hiboutik.dto';
|
||||
|
||||
/** Reads brands from the Hiboutik API. */
|
||||
@Injectable()
|
||||
export class BrandHiboutikRepository {
|
||||
constructor(private readonly hiboutikClient: HiboutikClient) {}
|
||||
|
||||
/** Walked twice when it spans several pages: it drives the deletion of brands (see `getAllPagesForSync`). */
|
||||
async getBrands(): Promise<BrandHiboutikDto[]> {
|
||||
return this.hiboutikClient.getAllPages<BrandHiboutikDto>('/brands', {
|
||||
return this.hiboutikClient.getAllPagesForSync('/brands', brandHiboutikSchema, (brand) => brand.brand_id, {
|
||||
order_by: 'brand_id',
|
||||
sort: 'ASC',
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user