Filter DLC alerts to exclude already processed expiring items

Update DLC module logic to exclude products marked as processedUntilExpiry from expiring soon and expired alerts in the connection modal, and modify server-side storage to filter out these products from 'expires_soon' and 'expires' status queries.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 1e4433b5-47ab-464c-b663-fea2e53367dd
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Event-Id: e4489986-7b4d-4830-9be8-9e32c2bf8e2e
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/1e4433b5-47ab-464c-b663-fea2e53367dd/oKSi9br
This commit is contained in:
michaelschal committed 2025-11-04 13:18:14 +00:00
1 parent 120defae7f
commit 7512cee938
2 files changed
+13 -3

No files matched your search

+12 -2
View File
@@ -1886,6 +1886,7 @@ export class DatabaseStorage implements IStorage {
if (filters.status === 'expires_soon') {
// Products expiring within 15 days but not expired yet
// Ne pas afficher les produits déjà traités (processedUntilExpiry = true)
const in15Days = new Date();
in15Days.setDate(today.getDate() + 15);
in15Days.setHours(23, 59, 59, 999); // End of day
@@ -1893,15 +1894,24 @@ export class DatabaseStorage implements IStorage {
and(
gt(dlcProducts.expiryDate, today),
lte(dlcProducts.expiryDate, in15Days),
ne(dlcProducts.status, 'valides')
ne(dlcProducts.status, 'valides'),
or(
isNull(dlcProducts.processedUntilExpiry),
eq(dlcProducts.processedUntilExpiry, false)
)
)
);
} else if (filters.status === 'expires') {
// Products already expired
// Ne pas afficher les produits déjà traités (processedUntilExpiry = true)
conditions.push(
and(
lte(dlcProducts.expiryDate, today),
ne(dlcProducts.status, 'valides')
ne(dlcProducts.status, 'valides'),
or(
isNull(dlcProducts.processedUntilExpiry),
eq(dlcProducts.processedUntilExpiry, false)
)
)
);
} else if (filters.status === 'en_cours') {