diff --git a/src/app/api/products/list/route.ts b/src/app/api/products/list/route.ts index aab5eec..2885833 100644 --- a/src/app/api/products/list/route.ts +++ b/src/app/api/products/list/route.ts @@ -19,6 +19,7 @@ export async function GET(req: NextRequest): Promise Référence + Images Titre Prix Stock @@ -48,6 +49,18 @@ export function ProductTable({ products, loading }: Props) { {displayed.map((p) => ( {p.ref} + + {p.images.length > 0 ? ( +
+ + {p.images.length > 1 && ( + +{p.images.length - 1} + )} +
+ ) : ( + + )} + {p.title} {p.price} € {p.stock} diff --git a/src/lib/shopifySync.ts b/src/lib/shopifySync.ts index 4f4b57f..9a3613a 100644 --- a/src/lib/shopifySync.ts +++ b/src/lib/shopifySync.ts @@ -31,6 +31,7 @@ interface ShopifyAPIProduct { body_html: string status: string variants: ShopifyVariant[] + images: Array<{ src: string }> } function toSyncProduct(p: ShopifyAPIProduct): ShopifyProductFull { @@ -43,6 +44,7 @@ function toSyncProduct(p: ShopifyAPIProduct): ShopifyProductFull { price: p.variants[0]?.price ?? '0.00', stock: p.variants[0]?.inventory_quantity ?? 0, status: p.status === 'active' ? 'active' : 'draft', + images: (p.images ?? []).map(i => i.src), } } @@ -69,7 +71,7 @@ async function fetchByStatus(status: 'active' | 'draft'): Promise + shopifyUrl: string + images: string[] } /** Filtres appliqués à la liste */ diff --git a/src/types/sync.ts b/src/types/sync.ts index cb57966..f365e80 100644 --- a/src/types/sync.ts +++ b/src/types/sync.ts @@ -13,7 +13,8 @@ export interface SyncProduct { /** Produit Shopify enrichi pour la comparaison */ export interface ShopifyProductFull extends SyncProduct { - shopifyId: string // ID numérique Shopify (string) + shopifyId: string + images?: string[] } /** Un changement unitaire calculé par computeDiff */