mirror of
https://github.com/R0m1k3/Regisflow.git
synced 2026-10-21 06:08:18 +02:00
Make sales history update reliably after adding or removing sales
Invalidate all sales queries instead of exact matches and handle missing store ID. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 91318273-c764-4fd4-be04-bdc12c38af32 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/0715008c-7244-40f4-befc-26c014852236/aec99dd8-53a6-474d-8bf0-cdc42edf20c7.jpg
This commit is contained in:
1 parent
4384818f63
commit
b71148da46
3 files changed
+12
-5
No files matched your search
+8
-3
@@ -149,9 +149,14 @@ export async function registerRoutes(app: Express): Promise<Server> {
|
||||
|
||||
// Determine which store to query
|
||||
let targetStoreId: number;
|
||||
if (user.role === 'admin' && storeId) {
|
||||
// Admin can query any store
|
||||
targetStoreId = parseInt(storeId as string);
|
||||
if (user.role === 'admin') {
|
||||
if (storeId) {
|
||||
// Admin querying a specific store
|
||||
targetStoreId = parseInt(storeId as string);
|
||||
} else {
|
||||
// Admin without specific store - should not happen with the new frontend
|
||||
return res.status(400).json({ error: "Store ID required for admin queries" });
|
||||
}
|
||||
} else {
|
||||
// Non-admin users can only query their own store
|
||||
if (!user.storeId) {
|
||||
|
||||
Reference in new issue
Block a user