feat: implement BAP webhook configuration management and customer order tracking support

This commit is contained in:
Michael committed 2026-04-02 12:52:20 +02:00
1 parent 576db2d7f4
commit 55191c511b
6 files changed
+208 -21

No files matched your search

+7
View File
@@ -36,6 +36,13 @@ export async function runMigrations() {
// Ajouter les migrations hardcodées directement dans le code pour éviter les problèmes de chemins
const hardcodedMigrations = [
{
filename: '20260402000002_add_notified_fields_to_customer_orders.sql',
content: `
ALTER TABLE customer_orders ADD COLUMN IF NOT EXISTS notified_at TIMESTAMP;
ALTER TABLE customer_orders ADD COLUMN IF NOT EXISTS notified_comment TEXT;
`
},
{
filename: '20260402000000_add_codefou_to_suppliers.sql',
content: `ALTER TABLE suppliers ADD COLUMN IF NOT EXISTS codefou VARCHAR;`
+2 -3
View File
@@ -3352,9 +3352,8 @@ export async function registerRoutes(app: Express): Promise<Server> {
}
}
const updatedOrder = await storage.markClientCalled(id, user.id);
console.log(`📞 Client marked as called: order ${id} by user ${user.id} (${user.role})`);
const { comment } = req.body;
const updatedOrder = await storage.markClientCalled(id, user.id, comment);
res.json(updatedOrder);
} catch (error) {
console.error("Error marking client as called:", error);
+3 -1
View File
@@ -1848,11 +1848,13 @@ export class DatabaseStorage implements IStorage {
}));
}
async markClientCalled(customerOrderId: number, calledBy: string): Promise<CustomerOrder> {
async markClientCalled(customerOrderId: number, calledBy: string, comment?: string): Promise<CustomerOrder> {
const [updated] = await db
.update(customerOrders)
.set({
customerNotified: true,
notifiedAt: new Date(),
notifiedComment: comment || null,
updatedAt: new Date()
})
.where(eq(customerOrders.id, customerOrderId))