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:
17
src/hiboutik/supplier.hiboutik.repository.ts
Normal file
17
src/hiboutik/supplier.hiboutik.repository.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { HiboutikClient } from './hiboutik.client';
|
||||
import { SupplierHiboutikDto } from '../models/hiboutikDTO/supplier.hiboutik.dto';
|
||||
|
||||
/** Reads suppliers from the Hiboutik API. */
|
||||
@Injectable()
|
||||
export class SupplierHiboutikRepository {
|
||||
constructor(private readonly hiboutikClient: HiboutikClient) {}
|
||||
|
||||
/** `/suppliers` is not paginated: everything comes in one call. */
|
||||
async getSuppliers(): Promise<SupplierHiboutikDto[]> {
|
||||
return this.hiboutikClient.get<SupplierHiboutikDto[]>('/suppliers', {
|
||||
order_by: 'supplier_id',
|
||||
sort: 'ASC',
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user