mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-22 22:48:15 +02:00
fix(types): bring real code to zero TypeScript errors, fix three latent bugs
Continues the cleanup from 164 errors down to 88, all of which now sit in MemStorage — the in-memory dev mock — documented as known debt. Production server code and the entire client are at zero errors. Three genuine defects surfaced by the types and fixed: - deleteAnnouncement returned void while routes check the result and answer 404 "not found" on falsy: deleting an announcement succeeded in DB but the API reported failure on the fallback paths; it now returns a real boolean - AnnouncementMemoryStorage declared getAnnouncement twice; the first implementation was dead at runtime (second definition wins) and is removed - one route called storage.getDeliveryById(), a method that does not exist, crashing with a TypeError whenever hit; it now calls getDelivery() Everything else is type-level only (annotations, null-to-undefined for inline styles, honest signatures for markClientCalled's comment parameter and the invoice verification result's invoiceAmountTTC field), verified behavior-neutral: client build, production server bundle and the SMTP end-to-end test all pass unchanged. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FHdE9nEh8zHhQNGpCgrtYe
This commit is contained in:
19 files changed
+94
-101
No files matched your search
+7
-7
@@ -2688,7 +2688,7 @@ export async function registerRoutes(app: Express): Promise<Server> {
|
||||
}
|
||||
|
||||
// Vérifier que la livraison existe
|
||||
const delivery = await storage.getDeliveryById(id);
|
||||
const delivery = await storage.getDelivery(id);
|
||||
if (!delivery) {
|
||||
return res.status(404).json({ message: "Delivery not found" });
|
||||
}
|
||||
@@ -4729,7 +4729,7 @@ export async function registerRoutes(app: Express): Promise<Server> {
|
||||
res.json({ message: "Publicity deleted successfully" });
|
||||
} catch (error) {
|
||||
console.error(`❌ [API] Error deleting publicity ${publicityId}:`, error);
|
||||
res.status(500).json({ message: "Failed to delete publicity", error: error.message });
|
||||
res.status(500).json({ message: "Failed to delete publicity", error: (error as Error).message });
|
||||
}
|
||||
});
|
||||
|
||||
@@ -4768,7 +4768,7 @@ export async function registerRoutes(app: Express): Promise<Server> {
|
||||
res.json({ message: "Publicity deleted successfully" });
|
||||
} catch (error) {
|
||||
console.error(`❌ [API-POST] Error deleting publicity ${publicityId} via POST:`, error);
|
||||
res.status(500).json({ message: "Failed to delete publicity", error: error.message });
|
||||
res.status(500).json({ message: "Failed to delete publicity", error: (error as Error).message });
|
||||
}
|
||||
});
|
||||
|
||||
@@ -6225,7 +6225,7 @@ RÉSUMÉ DU SCAN
|
||||
if (user.role !== 'admin' && user.role !== 'directeur') {
|
||||
const userGroupIds = user.userGroups?.map((ug: any) => ug.groupId) || [];
|
||||
filters.groupIds = filters.groupIds
|
||||
? filters.groupIds.filter(id => userGroupIds.includes(id))
|
||||
? filters.groupIds.filter((id: number) => userGroupIds.includes(id))
|
||||
: userGroupIds;
|
||||
}
|
||||
|
||||
@@ -6256,7 +6256,7 @@ RÉSUMÉ DU SCAN
|
||||
if (user.role !== 'admin' && user.role !== 'directeur') {
|
||||
const userGroupIds = user.userGroups?.map((ug: any) => ug.groupId) || [];
|
||||
filters.groupIds = filters.groupIds
|
||||
? filters.groupIds.filter(id => userGroupIds.includes(id))
|
||||
? filters.groupIds.filter((id: number) => userGroupIds.includes(id))
|
||||
: userGroupIds;
|
||||
}
|
||||
|
||||
@@ -6285,7 +6285,7 @@ RÉSUMÉ DU SCAN
|
||||
if (user.role !== 'admin' && user.role !== 'directeur') {
|
||||
const userGroupIds = user.userGroups?.map((ug: any) => ug.groupId) || [];
|
||||
filters.groupIds = filters.groupIds
|
||||
? filters.groupIds.filter(id => userGroupIds.includes(id))
|
||||
? filters.groupIds.filter((id: number) => userGroupIds.includes(id))
|
||||
: userGroupIds;
|
||||
}
|
||||
|
||||
@@ -6338,7 +6338,7 @@ RÉSUMÉ DU SCAN
|
||||
if (user.role !== 'admin' && user.role !== 'directeur') {
|
||||
const userGroupIds = user.userGroups?.map((ug: any) => ug.groupId) || [];
|
||||
filters.groupIds = filters.groupIds
|
||||
? filters.groupIds.filter(id => userGroupIds.includes(id))
|
||||
? filters.groupIds.filter((id: number) => userGroupIds.includes(id))
|
||||
: userGroupIds;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user