Add alert for clients not contacted when their order status is available

Update `getPendingClientCalls` to filter customer orders where the client has not been notified and the order status is one of 'Disponible', 'disponible', 'Arrivé', 'arrivé', 'Prêt', or 'prêt' in both database and in-memory storage.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 95e8aab4-f39f-4b48-aa57-a759ec15ba3d
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/95e8aab4-f39f-4b48-aa57-a759ec15ba3d/TckvSqR
This commit is contained in:
michaelschal committed 2025-09-11 11:18:37 +00:00
1 parent 7ae93cc4b8
commit 967fe14a33
2 files changed
+11 -11

No files matched your search

+4
View File
@@ -15,6 +15,10 @@ run = ["npm", "run", "start"]
localPort = 5000
externalPort = 80
[[ports]]
localPort = 35077
externalPort = 3003
[[ports]]
localPort = 38451
externalPort = 3002
+7 -11
View File
@@ -1682,8 +1682,8 @@ export class DatabaseStorage implements IStorage {
async getPendingClientCalls(groupIds?: number[]): Promise<CustomerOrderWithRelations[]> {
const conditions = [
eq(dlcProducts.status, 'valides'),
eq(customerOrders.customerNotified, false)
eq(customerOrders.customerNotified, false),
inArray(customerOrders.status, ['Disponible', 'disponible', 'Arrivé', 'arrivé', 'Prêt', 'prêt'])
];
if (groupIds && groupIds.length > 0) {
@@ -1697,7 +1697,6 @@ export class DatabaseStorage implements IStorage {
group: groups
})
.from(customerOrders)
.innerJoin(dlcProducts, eq(customerOrders.gencode, dlcProducts.gencode))
.leftJoin(suppliers, eq(customerOrders.supplierId, suppliers.id))
.leftJoin(groups, eq(customerOrders.groupId, groups.id))
.where(and(...conditions))
@@ -3477,15 +3476,12 @@ export class MemStorage implements IStorage {
orders = orders.filter(order => groupIds.includes(order.groupId));
}
// Find orders where client not notified and product is available
// Find orders where client not notified and status is 'Disponible'
const pendingOrders = orders.filter(order => {
if (order.customerNotified) return false;
// Check if there's a DLC product with status 'valides' matching this gencode
const matchingDlcProduct = Array.from(this.dlcProducts.values())
.find(dlc => dlc.gencode === order.gencode && dlc.status === 'valides');
return !!matchingDlcProduct;
return !order.customerNotified &&
(order.status === 'Disponible' || order.status === 'disponible' ||
order.status === 'Arrivé' || order.status === 'arrivé' ||
order.status === 'Prêt' || order.status === 'prêt');
});
return pendingOrders.map(order => ({