import { Injectable } from '@nestjs/common'; import { HiboutikClient } from './hiboutik.client'; import { ProductHiboutikDto, productHiboutikSchema } from '../models/hiboutikDTO/product.hiboutik.dto'; /** Reads products from the Hiboutik API. */ @Injectable() export class ProductHiboutikRepository { constructor(private readonly hiboutikClient: HiboutikClient) {} /** * All products, archived ones included, with their sizes and per-size rules. Walked twice when it spans several * pages: it drives the deletion of products (see `getAllPagesForSync`). */ async getProducts(): Promise { return this.hiboutikClient.getAllPagesForSync('/products', productHiboutikSchema, (product) => product.product_id, { order_by: 'product_id', sort: 'ASC', }); } }