Commit Graph
27 Commits
Author SHA1 Message Date
Jeppe BandJeppe Bundgaard 3f41eebdf6 Default vehicle subscriptions to false (#288)
Co-authored-by: Jeppe Bundgaard <jb@truckwash.dk>
2026-07-06 09:21:31 +02:00
Jeppe Bundgaard dc79352f40 Add unit tests for vehicle search metadata alignment and extend API fixtures for vehicle and order item creation. Refactor booking and route handling logic for booked vehicle searches. 2026-04-13 21:42:37 +02:00
Jeppe Bundgaard 4ef20a1c90 Add economic V2 modules for history backfill, comparison, and distribution services. 2026-03-12 17:57:27 +01:00
Jeppe Bundgaard 6302fd25df Extend subuser permission system and refactor route permission handling
- Update `subusersRoute` to support subuser authentication and permission checks dynamically.
- Add new permission nodes (`SELFSERVE_LIST`, `SELFSERVE_EDIT`, `SELFSERVE_DELETE`) in `subusers_permission_node_key`.
- Fix typos in vehicle permission constants and ensure proper resolution.
- Enhance `vehiclesRoute` with effective customer context and scoped permission checks.
- Localize new permission nodes with descriptions in Danish.
2026-02-12 16:26:29 +01:00
Jeppe Bundgaard 16094575a7 Refactor ordersRoute, vehiclesRoute, and related routes for subuser permission handling
- Integrate `subusers_permission_node_key` for dynamic subuser-specific permission checks.
- Refactor authentication and permission logic to streamline checks for own vs. department-level access.
- Simplify error handling and enforce scoped permissions for vehicles, orders, and their attachments.
- Localize permission labels and descriptions to Danish for relevant modules.
2026-02-12 15:52:37 +01:00
Jeppe Bundgaard 0d96bf6219 Trim registration input in vehicle creation and add contactName parameter to OpenAPI spec and related routes. 2026-01-08 13:16:32 +01:00
Jeppe Bundgaard 0eddf69ae4 Replace getCustomerByIdOrCustomerNumber with getUserByCustomerNumber across services and remove deprecated method. 2026-01-06 15:50:59 +01:00
Jeppe Bundgaard 49589de98e Update getUserByCustomerNumber references to getCustomerByIdOrCustomerNumber and enhance null-checking in requireSelected. 2026-01-06 15:40:05 +01:00
Jeppe Bundgaard 449908c833 Handle null values consistently and add deleted_at checks in vehiclesRoute queries
- Updated `db_object_t` to treat both `null` and string `'null'` as null values for filtering.
- Added `deleted_at IS NULL` condition in `vehiclesRoute` booking-related queries to exclude soft-deleted entries.
2025-11-24 15:48:15 +01:00
Jeppe Bundgaard 36d902d833 Add department-based filtering to vehicle search
- Introduced optional `department` parameter in `vehiclesRoute` for filtering booked registrations.
- Validated `department` input to ensure existence and access rights.
- Updated `getBookedRegs` to support dynamic filtering with department-specific criteria.
2025-11-24 13:23:44 +01:00
Jeppe Bundgaard 67927f8ab8 Refactor booking logic and table references for order_bookings
- Updated booking-related queries to use `order_bookings_o` for improved consistency and clarity.
- Replaced `regNrTraekker`/`regNrTrailer` with `reg_1`/`reg_2` in queries and results.
- Added `NULL` condition handling in `db_object_t` to support filtering by null field values.
- Enhanced booking data extraction with renamed fields (`reference_number` → `reference`, `notes` → `note`).
2025-11-20 15:54:00 +01:00
Jeppe Bundgaard 94bbf0a106 Enhance vehiclesRoute to include customer status checks for known vehicles
- Added logic to determine if a known vehicle has been assigned to a specific customer and retrieve the customer name.
- Integrated checks to handle barred customers by resetting vehicle status to `unknown` and clearing customer details.
- Ensured support for scenarios with multiple known customers, marking vehicles accordingly.
2025-09-18 10:13:29 +02:00
Jeppe Bundgaard b87950654b Clarify comment formatting in vehiclesRoute to improve readability. 2025-09-15 15:38:07 +02:00
Jeppe Bundgaard 9ee486a49e Add /vehicles/search route for vehicle registration search
- Introduced a new route `/vehicles/search` to enable searching for vehicles by registration number across multiple categories (e.g., verified, known, booked, unknown).
- Added validation for search parameters, including length and format checks.
- Ensured proper classification of vehicles with clear prioritization and deduplication logic.
- Implemented helper methods to retrieve matching registrations from various sources like bookings, orders, and scanned plates.
- Enhanced response format to include vehicle status, customer details, and references for improved usability.
2025-09-15 15:09:36 +02:00
Jeppe Bundgaard 5b00e47276 Add /vehicles/status route to retrieve vehicle status details
- Introduced a new route `/vehicles/status` to provide detailed vehicle status, including verification, booking, and last order information.
- Added `getLastOrderByPlate` method in `customer_vehicles_o` to retrieve the last order for a vehicle plate.
- Implemented validation for registration number and optional department parameter.
- Enhanced response with multiple status indicators like `verified`, `known`, `booked`, and `card`.
2025-09-15 11:58:32 +02:00
Jepp9350 112f28228d Enhance vehiclesRoute: strip whitespace from vehicle registration numbers before setting values. 2025-07-03 12:23:02 +02:00
Jepp9350 6b80637208 Refactor InvoicingPeriodRoute and vehiclesRoute: streamline invoicing period data retrieval, enhance transaction handling across customer types, introduce new methods for efficient object construction, and add improved type validation in object_property. 2025-06-30 14:37:37 +02:00
Jepp9350 29aa63bb08 Add vehicle type handling in customer_vehicles_o, including vehicle type retrieval, setting, and creation in XLVask. Extend route logic to support vehicle type updates and auto-start on LPR configurations, incorporating enhanced validation and permission checks. Refactor and streamline helper classes for consistency and functionality expansion. 2025-06-19 15:01:22 +02:00
Jepp9350 27ca81ba8f Add support for invoicing period retrieval and enhanced filtering options for wash subscription transactions 2025-06-02 14:08:57 +02:00
Jepp9350 e3d67acd07 Allow vehicle type to be unset and improve related checks
Updated logic to allow vehicle type to be set to 0 and handle related subscription behavior. Added safeguards to prevent setting subscriptions when type is unset. Introduced `isPlateSeenBefore` in `orders_o` and enhanced `plateScansRoute` to include `seen_before` data.
2025-05-06 16:36:24 +02:00
Jepp9350 45faa7c56a Add 'barred' status to customer and vehicle data
Introduced the 'barred' property to identify barred customers and vehicles. Updated relevant classes, methods, and API endpoints to handle this new field. Enhanced plate scans to include the barred status for vehicles based on customer association.
2025-05-06 12:14:21 +02:00
Jepp9350 b1ba8a2e34 Add support for vehicle reference field
Introduce a new "reference" field for vehicles to allow storing and validating additional information. Updates include parameter handling, validation, and database integration for creating, modifying, and retrieving the "reference" field.
2025-05-06 09:09:17 +02:00
Jepp9350 8ae3a35a91 Add endpoints for unknown customer vehicles and suggestions
Introduced two new endpoints: one for listing unknown customer vehicles and another for fetching customer suggestions based on a vehicle registration. These changes include authentication, input validation, and proper logging for each new route.
2025-04-30 14:37:53 +02:00
Jepp9350 3ad09e9367 Fix type comparison in vehicle deletion logic
Ensure correct comparison between customer ID and user number by explicitly casting both to integers. This prevents potential logical errors when checking permissions for vehicle deletion.
2025-04-09 15:55:31 +02:00
Jepp9350 1a71da0526 Refactor vehicle management and add vehicle add-on functionality.
This update refactors vehicle-related routes to include consistent endpoints, enhanced functionality, and stricter permission checks. It introduces vehicle add-on management with toggling and retrieval APIs, enabling detailed customization and user control. Additionally, the new `asArray` methods and updated logic improve data handling and validation.
2025-04-09 09:02:17 +02:00
Jepp9350 d28cb172a0 Add permission definitions to route handlers
This update introduces explicit permission definitions for various route handlers across multiple routes. These changes enhance clarity and allow for more granular control over route access based on defined permissions. The updates ensure better manageability and scalability of endpoint permissions.
2025-02-20 14:33:42 +01:00
Jepp9350 707df910b0 Refactor: migrate files 2025-01-29 14:27:44 +01:00