Commit Graph
154 Commits
Author SHA1 Message Date
michaelschal 15cf7f32a1 Restored to 'c6c9369fcb5c7d3e28183ea74a5639cbc7677de6'
Replit-Restored-To: c6c9369fcb
2025-08-16 07:37:28 +00:00
michaelschal 7613b257cc Add debugging tools to help diagnose order display issues
Introduce new API endpoints and enhanced logging in `routes.ts` and `storage.ts` to allow for granular inspection of customer order data and filtering logic, aiding in the diagnosis of production discrepancies.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: a3de0820-9397-41b2-b000-7931ee9c29de
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/a3de0820-9397-41b2-b000-7931ee9c29de/mKF47ul
2025-08-16 07:34:56 +00:00
michaelschal f21d807968 Improve store data handling and user authentication for multiple stores
Update storage and authentication logic to support multiple stores, including specific configurations for "Magasin 1" and "Magasin 2", and add new development user credentials.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: a3de0820-9397-41b2-b000-7931ee9c29de
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/a3de0820-9397-41b2-b000-7931ee9c29de/mKF47ul
2025-08-16 07:27:13 +00:00
michaelschal c6c9369fcb Allow invoice verification using delivery's bill of lading number
Update the invoice verification process to accept either a direct invoice reference or a bill of lading number. This change enables the system to correctly identify and process invoices when only the bill of lading information is available, ensuring that all relevant deliveries are reconciled. The backend service has been enhanced to search for invoices using the bill of lading and supplier name, with improved caching and error handling for missing configurations.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: a3de0820-9397-41b2-b000-7931ee9c29de
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/a3de0820-9397-41b2-b000-7931ee9c29de/AO4neXk
2025-08-16 07:00:46 +00:00
michaelschal 7e7b2ec9ea Enable specific user roles to validate products in the DLC module
Update DLC validation permissions to allow admin, director, and manager roles, and add console logs for validation attempts.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: a3de0820-9397-41b2-b000-7931ee9c29de
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/a3de0820-9397-41b2-b000-7931ee9c29de/T1jqUpI
2025-08-15 18:59:01 +00:00
michaelschal 7595727b0a Restrict task visibility based on user roles and group assignments
Update task retrieval logic to filter tasks based on user's assigned groups and roles. Admins can view all tasks or filter by store, while non-admins can only see tasks from their explicitly assigned groups, ensuring data segregation.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: a3de0820-9397-41b2-b000-7931ee9c29de
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/a3de0820-9397-41b2-b000-7931ee9c29de/b8xUC40
2025-08-15 14:07:25 +00:00
michaelschal 663f50d534 Update weather data to show accurate local conditions
Ensure weather data is refreshed when location changes by invalidating and refetching queries on the client, and clearing the weather cache on the server.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: d43bd811-9372-45a7-8ac9-4a954c0538e1
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/d43bd811-9372-45a7-8ac9-4a954c0538e1/zoZabWF
2025-08-15 11:43:33 +00:00
michaelschal 5133f52d2a Update location lookup to use OpenStreetMap for better accuracy
Switch from Visual Crossing to Nominatim (OpenStreetMap) for reverse geocoding to improve city and country identification from GPS coordinates.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: d43bd811-9372-45a7-8ac9-4a954c0538e1
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/d43bd811-9372-45a7-8ac9-4a954c0538e1/zoZabWF
2025-08-15 11:33:17 +00:00
michaelschal 5045c98692 Improve location accuracy for weather data fetching
Add logging to show parsed location details and handle cases where resolved address is missing in the weather API response.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: d43bd811-9372-45a7-8ac9-4a954c0538e1
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/d43bd811-9372-45a7-8ac9-4a954c0538e1/zoZabWF
2025-08-15 11:31:25 +00:00
michaelschal c65860cb85 Add ability to detect user's city using geolocation
Implement geolocation functionality in the weather widget to automatically detect and set the user's city based on GPS coordinates, updating weather data accordingly.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: d43bd811-9372-45a7-8ac9-4a954c0538e1
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/d43bd811-9372-45a7-8ac9-4a954c0538e1/zoZabWF
2025-08-15 11:20:09 +00:00
michaelschal 8eb0458ce2 Improve invoice verification stability and error handling
Enhance InvoiceVerificationService to cache API errors and "not found" results, preventing repetitive calls. Add validation for NocoDB search parameters and improve error logging for production stability.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: d43bd811-9372-45a7-8ac9-4a954c0538e1
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/d43bd811-9372-45a7-8ac9-4a954c0538e1/IhbIRSa
2025-08-15 11:13:31 +00:00
michaelschal 80ca426a33 Improve invoice verification caching with conflict resolution and error handling
Implement unique constraint on invoice verification cache key and handle duplicate entries gracefully in the backend.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: d43bd811-9372-45a7-8ac9-4a954c0538e1
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/d43bd811-9372-45a7-8ac9-4a954c0538e1/g5c0JYM
2025-08-15 09:48:29 +00:00
michaelschal 7a083a0203 Show current date alongside weather and force French translations for conditions
Move weather condition translation logic to the backend and display the current date in the weather widget.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: d43bd811-9372-45a7-8ac9-4a954c0538e1
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/d43bd811-9372-45a7-8ac9-4a954c0538e1/IljTqYl
2025-08-15 08:46:54 +00:00
michaelschal 5f5da0bc77 Improve weather analysis by comparing same day of week from previous year
Update weather service to calculate the date of the same day of the week from the previous year for more relevant weather pattern analysis.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: d43bd811-9372-45a7-8ac9-4a954c0538e1
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/d43bd811-9372-45a7-8ac9-4a954c0538e1/gqQIolA
2025-08-15 08:41:13 +00:00
michaelschal 60efc7ef88 Make weather data fully French for better localization
Update weather service to include French language parameter in API requests and remove unused translation logic from the frontend.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: d43bd811-9372-45a7-8ac9-4a954c0538e1
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/d43bd811-9372-45a7-8ac9-4a954c0538e1/oizLDz5
2025-08-15 08:37:55 +00:00
michaelschal cc4d013dfc Handle duplicate weather data entries and improve historical fetching
Address the "duplicate key value violates unique constraint" error by adding a try-catch block around weather data creation to gracefully handle existing entries and fetch them instead. Also, improve error logging for historical weather data fetching.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: d43bd811-9372-45a7-8ac9-4a954c0538e1
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/d43bd811-9372-45a7-8ac9-4a954c0538e1/xi5G4qi
2025-08-15 08:26:14 +00:00
michaelschal d635bfb7c0 Make weather display operational with correct API usage
Fixes 401 error for historical weather data by correcting the API URL syntax from `forecastBasisDate` to `/timeline/location/date`. Updates data formatting for temperature and conditions, ensures weather is visible to all users, and improves production logging for easier debugging.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: d43bd811-9372-45a7-8ac9-4a954c0538e1
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/d43bd811-9372-45a7-8ac9-4a954c0538e1/xi5G4qi
2025-08-15 08:21:16 +00:00
michaelschal 62803e7b39 Restrict weather data access to administrators only
Remove direct weather data access for all users and enforce administrator-only viewing of weather information by implementing role-based access control on the API endpoint. Refactor weather system initialization to use a new auto-configuration module that fetches API keys from environment variables.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: d43bd811-9372-45a7-8ac9-4a954c0538e1
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/d43bd811-9372-45a7-8ac9-4a954c0538e1/cp1Ryg6
2025-08-15 08:14:23 +00:00
michaelschal c6b2120f06 Restrict weather endpoint access to administrators
Add role-based access control to the /api/weather/current endpoint in server/routes.ts, ensuring only admin users can access it.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: d43bd811-9372-45a7-8ac9-4a954c0538e1
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/d43bd811-9372-45a7-8ac9-4a954c0538e1/zF4XCWA
2025-08-15 08:11:55 +00:00
michaelschal 654062bd88 Improve access control for administrative features
Refactor routes to enforce admin role check for backup management and weather settings via `isAuthenticated` middleware.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: d43bd811-9372-45a7-8ac9-4a954c0538e1
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/d43bd811-9372-45a7-8ac9-4a954c0538e1/zF4XCWA
2025-08-15 06:45:37 +00:00
michaelschal e70e860097 Add weather information display and configuration options
Integrate weather data fetching, display in a widget, and provide a settings page for configuration.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: d43bd811-9372-45a7-8ac9-4a954c0538e1
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/d43bd811-9372-45a7-8ac9-4a954c0538e1/BIZe1t3
2025-08-15 06:34:37 +00:00
michaelschal 48bfc884ed Improve product search functionality and data caching
Add server-side search and filtering for DLC products, and implement client-side debouncing for search terms. Optimize data fetching with extended stale times for stores, suppliers, and DLC stats to improve performance.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 78d55416-09d3-4c00-b411-444299b0da00
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/78d55416-09d3-4c00-b411-444299b0da00/WSwf4nZ
2025-08-14 17:34:11 +00:00
michaelschal fb4a4733f1 Update product data to correctly display expiry dates
Map the expiryDate field to dlcDate in the product data retrieval to resolve undefined date issues.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 31f9bd88-0285-4787-81b3-31ceeea5a08b
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/31f9bd88-0285-4787-81b3-31ceeea5a08b/Qz6UlZZ
2025-08-14 12:03:47 +00:00
michaelschal 483dfc4936 Ensure order taker information is provided for customer orders
Update the customer order form to include the order taker's name and other previously missing fields, and add backend logging for debugging failed submissions related to the 'order_taker' column.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 31f9bd88-0285-4787-81b3-31ceeea5a08b
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/31f9bd88-0285-4787-81b3-31ceeea5a08b/5hCjnif
2025-08-14 11:58:17 +00:00
michaelschal cd436070cd Show assigned groups for users in the system
Update the API to include user groups in the user data endpoint and add frontend logging for user details.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 31f9bd88-0285-4787-81b3-31ceeea5a08b
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/31f9bd88-0285-4787-81b3-31ceeea5a08b/7ff921U
2025-08-14 11:52:52 +00:00
michaelschal 2da7a21908 Fix issue preventing employees from creating customer orders
Address an issue where employee users could not create customer orders due to incorrect group ID type comparison in the `registerRoutes.ts` file. The fix ensures that the `groupId` is correctly parsed as an integer before comparison, resolving the access denial for employees in their assigned groups.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 31f9bd88-0285-4787-81b3-31ceeea5a08b
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/31f9bd88-0285-4787-81b3-31ceeea5a08b/hI0UUHG
2025-08-14 11:27:24 +00:00
michaelschal bce8f91e77 Allow employees to create customer orders and fix SAV ticket visibility
Enable employees to create customer orders by adjusting permission checks for their assigned groups, and ensure SAV ticket detail and edit buttons are visible and functional based on user roles.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 31f9bd88-0285-4787-81b3-31ceeea5a08b
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/31f9bd88-0285-4787-81b3-31ceeea5a08b/hI0UUHG
2025-08-14 11:24:28 +00:00
michaelschal 2b42c97e20 Correct SAV ticket history actions for better data integrity
Fixes an issue where the SAV ticket history recorded 'ticket_created' instead of the standardized 'created' action, resolving a database constraint violation.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 31f9bd88-0285-4787-81b3-31ceeea5a08b
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/31f9bd88-0285-4787-81b3-31ceeea5a08b/1izfX0o
2025-08-14 10:25:06 +00:00
michaelschal 18ec91e4ff Generate unique ticket numbers for service requests
Add server-side generation of unique ticket numbers for SAV tickets, omitting `ticketNumber` from client-side schema validation in `insertSavTicketSchema` and including it in the ticket data sent to `storage.createSavTicket`.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 31f9bd88-0285-4787-81b3-31ceeea5a08b
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/31f9bd88-0285-4787-81b3-31ceeea5a08b/kCBjAsQ
2025-08-14 10:07:44 +00:00
michaelschal 3080c0d064 Enable creating new support tickets within the SAV module
Add a modal and mutation to create new SAV tickets, including form handling and error feedback.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 31f9bd88-0285-4787-81b3-31ceeea5a08b
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/31f9bd88-0285-4787-81b3-31ceeea5a08b/tftmNHr
2025-08-14 09:46:17 +00:00
michaelschal c734ea0ca2 Update database connection to use standard PG client for migrations
Switches the production migration script from Neon's `neon` client to the standard `pg` client, improving connection robustness and compatibility. Also includes error handling and connection closing for migrations.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 31f9bd88-0285-4787-81b3-31ceeea5a08b
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/31f9bd88-0285-4787-81b3-31ceeea5a08b/hP2S4TA
2025-08-14 09:39:37 +00:00
michaelschal 27ae1a836f Fix critical production issue with missing SAV ticket data and add emergency recovery
Implement an automatic migration script and an emergency API route to resolve missing columns in the SAV production database, ensuring data integrity and system stability.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 31f9bd88-0285-4787-81b3-31ceeea5a08b
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/31f9bd88-0285-4787-81b3-31ceeea5a08b/nCX75tE
2025-08-14 09:33:19 +00:00
michaelschal a4e02d2fd1 Update SAV ticket table by adding missing columns and constraints
Modify database migration script to add missing 'priority', 'problem_type', 'resolution_description', 'resolved_at', 'closed_at', and 'status' columns to the 'sav_tickets' table, and also add foreign key constraints for 'supplier_id' and 'group_id'.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 31f9bd88-0285-4787-81b3-31ceeea5a08b
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/31f9bd88-0285-4787-81b3-31ceeea5a08b/rqPDkQ6
2025-08-14 09:26:16 +00:00
michaelschal 37092a95ba Enable automatic database updates for production environments
Adds automatic execution of database migrations, including schema modifications for the Service After-Sales (SAV) module, upon server startup.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 31f9bd88-0285-4787-81b3-31ceeea5a08b
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/31f9bd88-0285-4787-81b3-31ceeea5a08b/EXHO0Ia
2025-08-14 09:24:47 +00:00
michaelschal d678b3fe7a Add new service for managing customer support tickets
Introduce the Service Après-Vente (SAV) module with API endpoints for ticket creation, retrieval, and filtering, integrated with the sidebar navigation and utilizing React Query for frontend state management.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 31f9bd88-0285-4787-81b3-31ceeea5a08b
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/31f9bd88-0285-4787-81b3-31ceeea5a08b/Dkpn0ry
2025-08-14 08:54:02 +00:00
michaelschal da4a46156e Include delivery details when fetching order information
Update the database storage to fetch associated delivery details for each order, enhancing order and delivery synchronization and providing a more comprehensive view of order status and related logistics.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 7c468936-2a88-4686-ac0a-84921a45222d
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/7c468936-2a88-4686-ac0a-84921a45222d/Fs7Hj3b
2025-08-14 06:03:00 +00:00
michaelschal 4df74a66f2 Fix order status and delivery linking errors in production
Implement comprehensive PostgreSQL fixes to ensure correct order status updates and accurate display of order-delivery relationships, aligning production behavior with development environments.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 7c468936-2a88-4686-ac0a-84921a45222d
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/7c468936-2a88-4686-ac0a-84921a45222d/r577GWu
2025-08-13 21:59:47 +00:00
michaelschal 9a65f694b9 Fix order status incorrectly showing as delivered in production
Correctly set delivery and order statuses to 'planned' in production to resolve an issue where orders were incorrectly marked as 'delivered' upon delivery creation.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 7c468936-2a88-4686-ac0a-84921a45222d
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/7c468936-2a88-4686-ac0a-84921a45222d/r577GWu
2025-08-13 21:53:41 +00:00
michaelschal 91be24e93a Correctly plan orders when creating deliveries and linking them
Adjust delivery creation logic in server/routes.ts and server/storage.ts to set the initial delivery status to 'planned' instead of 'delivered'. This change also ensures that linked orders are updated to a 'planned' status, preventing incorrect 'delivered' status assignments and resolving the issue where orders were being marked as delivered prematurely.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 7c468936-2a88-4686-ac0a-84921a45222d
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/7c468936-2a88-4686-ac0a-84921a45222d/I42UgiS
2025-08-13 21:49:47 +00:00
michaelschal 00a95954d0 Restore visibility of linked order and delivery information in calendar views
Update storage logic to include associated deliveries within order details and link orders to delivery details.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 7c468936-2a88-4686-ac0a-84921a45222d
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/7c468936-2a88-4686-ac0a-84921a45222d/tzcQQt9
2025-08-13 21:40:57 +00:00
michaelschal 0a565ea490 Add management capability for system backups to the platform
Implement and expose new API endpoints for managing backups including listing, downloading, and deleting, enhancing the existing backup system.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 7c468936-2a88-4686-ac0a-84921a45222d
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/7c468936-2a88-4686-ac0a-84921a45222d/2HHgup2
2025-08-13 21:10:58 +00:00
michaelschal b079d35e3a Improve production stability by fixing backup directory permissions
Adjust Dockerfile to create and grant permissions for backup directories, install PostgreSQL client for backups, and update BackupService to use the correct production backup path to resolve EACCES errors.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 7c468936-2a88-4686-ac0a-84921a45222d
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/7c468936-2a88-4686-ac0a-84921a45222d/K3Lzcje
2025-08-13 21:03:48 +00:00
michaelschal 1c126fb77a Resolve production issues by implementing a PostgreSQL backup module and fixing ESM compatibility
Replace `node-cron` with native `setTimeout` in `backupService.ts` to address dynamic require errors in ESM, and introduce a PostgreSQL backup module with administrative interface and automated scheduling.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 7c468936-2a88-4686-ac0a-84921a45222d
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/7c468936-2a88-4686-ac0a-84921a45222d/fhCGgjv
2025-08-13 21:01:25 +00:00
michaelschal fbeb36c04a Add system for managing and scheduling data backups
Introduce a new backup management feature with automated scheduling, manual backups, and a dedicated interface for viewing backup status and details. This includes integrating `node-cron` for scheduling, updating the database schema to store backup information, and creating new routes and components for the backup manager.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 7c468936-2a88-4686-ac0a-84921a45222d
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/7c468936-2a88-4686-ac0a-84921a45222d/9xfbVBU
2025-08-13 20:55:27 +00:00
michaelschal bfc90053f0 Add database backup and restore functionality for administrators
Introduce endpoints and UI for managing PostgreSQL database backups, including automatic nightly backups, manual backups, and the ability to download and delete backup files.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 7c468936-2a88-4686-ac0a-84921a45222d
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/7c468936-2a88-4686-ac0a-84921a45222d/B7k6m01
2025-08-13 20:42:59 +00:00
michaelschal 947896c212 Improve invoice verification saving and update user permission handling
Add `saveInvoiceVerificationCache` to storage interfaces, implement it in `DatabaseStorage` and `MemStorage`, adjust user type in `AuthRequest` to `any`, and initialize group/supplier counters in `MemStorage`.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 7c468936-2a88-4686-ac0a-84921a45222d
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/7c468936-2a88-4686-ac0a-84921a45222d/ce6DSX9
2025-08-13 15:06:14 +00:00
michaelschal 4a8bdc5cf0 Fix delivery validation issue by correctly formatting date for PostgreSQL
Corrected the `deliveredDate` to use a `Date` object directly instead of `toISOString()` when validating deliveries, resolving a `TypeError` in Drizzle ORM and restoring production functionality.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 7c468936-2a88-4686-ac0a-84921a45222d
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/7c468936-2a88-4686-ac0a-84921a45222d/ce6DSX9
2025-08-13 14:53:55 +00:00
michaelschal c9cb1ad23e Restore delivery validation by fixing complex database joins
Fix delivery validation errors in production by simplifying SQL joins in the getDelivery function and handling user data loading separately.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 7c468936-2a88-4686-ac0a-84921a45222d
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/7c468936-2a88-4686-ac0a-84921a45222d/ce6DSX9
2025-08-13 14:46:08 +00:00
michaelschal a55f75a438 Fix issue preventing delivery validation and update admin password reset
Resolve production authentication error preventing users from validating deliveries, and enhance the admin password reset mechanism for improved security.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 7c468936-2a88-4686-ac0a-84921a45222d
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/7c468936-2a88-4686-ac0a-84921a45222d/jMd9JtM
2025-08-13 14:40:25 +00:00
michaelschal 5ef170b38c Show who created each order and delivery in the system
Add a `creator` object to the order and delivery retrieval queries, joining the `users` table on the `createdBy` column to include creator details.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 7c468936-2a88-4686-ac0a-84921a45222d
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/7c468936-2a88-4686-ac0a-84921a45222d/jMd9JtM
2025-08-13 14:33:30 +00:00