feat(plan5): types création + modèle Prisma ProductCreation
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
/** Un produit en attente de création, extrait d'un onglet Sheets */
|
||||
export interface PendingProduct {
|
||||
tab: string // nom de l'onglet (famille)
|
||||
rowNumber: number // numéro de ligne 1-indexé dans le sheet
|
||||
sku: string // UGS
|
||||
title: string // Nom
|
||||
priceMarket: string // Prix marché (compare_at_price), ex: "29.99"
|
||||
priceActual: string // Prix remisé (price), ex: "19.99"
|
||||
stock: number
|
||||
weightKg: number
|
||||
vendor: string // Marque
|
||||
famille: string // Famille (contexte IA)
|
||||
sousFamille: string
|
||||
comment: string // Commentaire
|
||||
collectionId: string // ID FAMILLE → collection Shopify
|
||||
subCollectionId: string // ID SOUS FAMILLE
|
||||
hasPhoto: boolean
|
||||
specificFields: Record<string, string> // header → valeur pour les métachamps
|
||||
}
|
||||
|
||||
/** Définition de métachamp existante dans Shopify */
|
||||
export interface MetafieldDefinition {
|
||||
id: string // ex: "123"
|
||||
namespace: string // ex: "custom"
|
||||
key: string // ex: "puissance"
|
||||
name: string // ex: "Puissance"
|
||||
type: string // ex: "single_line_text_field"
|
||||
}
|
||||
|
||||
/** Résolution d'une colonne spécifique vers un métachamp */
|
||||
export interface MetafieldResolution {
|
||||
columnHeader: string // en-tête colonne Sheets, ex: "Puissance (AN)"
|
||||
action: 'create' | 'map' | 'skip'
|
||||
namespace: string // "custom" par défaut
|
||||
key: string // clé normalisée
|
||||
existingDefinitionId?: string // si action === 'map'
|
||||
}
|
||||
|
||||
/** Événement streamé par /api/creation/execute */
|
||||
export type CreationStreamEvent =
|
||||
| { type: 'progress'; current: number; total: number; tab: string; title: string; step: string }
|
||||
| { type: 'error'; title: string; message: string }
|
||||
| { type: 'done'; summary: { created: number; errors: number; status: 'success' | 'partial' | 'error' } }
|
||||
|
||||
/** Résumé d'une création (stocké en DB) */
|
||||
export interface CreationRecord {
|
||||
id: string
|
||||
createdAt: string
|
||||
userName: string
|
||||
sheetTab: string
|
||||
sheetRow: number
|
||||
shopifyId: string
|
||||
sku: string
|
||||
title: string
|
||||
status: 'success' | 'error'
|
||||
errorMessage?: string
|
||||
}
|
||||
Reference in New Issue
Block a user