Add customer order tracking and management features to the platform

Adds customerOrders and customerOrderProducts tables to shared/schema.ts.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 4b008663-bd72-492b-b0b6-fa252367e730
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/0715008c-7244-40f4-befc-26c014852236/4b008663-bd72-492b-b0b6-fa252367e730/gfGF2TH
This commit is contained in:
michaelschal committed 2025-07-25 11:10:35 +00:00
1 parent e03165bcc0
commit 430ab669aa
2 files changed
+36

No files matched your search

Binary file not shown.

After

Width:  |  Height:  |  Size: 294 KiB

+36
View File
@@ -91,6 +91,42 @@ export const saleProducts = pgTable("sale_products", {
createdAt: timestamp("created_at").defaultNow(),
});
// Customer Orders table
export const customerOrders = pgTable("customer_orders", {
id: serial("id").primaryKey(),
storeId: integer("store_id").references(() => stores.id).notNull(),
userId: integer("user_id").references(() => users.id).notNull(),
timestamp: timestamp("timestamp").defaultNow(),
// Client information
nom: varchar("nom", { length: 255 }).notNull(),
prenom: varchar("prenom", { length: 255 }).notNull(),
telephone: varchar("telephone", { length: 20 }),
email: varchar("email", { length: 255 }),
adresse: text("adresse"),
// Order details
statut: varchar("statut", { length: 50 }).notNull().default("En attente de commande"),
dateCommande: timestamp("date_commande"),
dateLivraison: timestamp("date_livraison"),
montant: integer("montant"), // En centimes
commentaire: text("commentaire"), // Champ commentaire principal
createdAt: timestamp("created_at").defaultNow(),
updatedAt: timestamp("updated_at").defaultNow(),
});
// Customer Order Products table
export const customerOrderProducts = pgTable("customer_order_products", {
id: serial("id").primaryKey(),
orderId: integer("order_id").references(() => customerOrders.id, { onDelete: "cascade" }).notNull(),
produit: varchar("produit", { length: 255 }).notNull(),
quantite: integer("quantite").notNull().default(1),
prixUnitaire: integer("prix_unitaire"), // En centimes
total: integer("total"), // En centimes
createdAt: timestamp("created_at").defaultNow(),
});
// Relations
export const storesRelations = relations(stores, ({ many }) => ({
users: many(users),