HiboutikClient handles Basic auth and walks paginated endpoints. One read-only repository per entity (brands, categories, suppliers, products, stocks, customers).
17 lines
524 B
TypeScript
17 lines
524 B
TypeScript
import { Injectable } from '@nestjs/common';
|
|
import { HiboutikClient } from './hiboutik.client';
|
|
import { BrandHiboutikDto } from '../models/hiboutikDTO/brand.hiboutik.dto';
|
|
|
|
/** Reads brands from the Hiboutik API. */
|
|
@Injectable()
|
|
export class BrandHiboutikRepository {
|
|
constructor(private readonly hiboutikClient: HiboutikClient) {}
|
|
|
|
async getBrands(): Promise<BrandHiboutikDto[]> {
|
|
return this.hiboutikClient.getAllPages<BrandHiboutikDto>('/brands', {
|
|
order_by: 'brand_id',
|
|
sort: 'ASC',
|
|
});
|
|
}
|
|
}
|