Commit Graph
47 Commits
Author SHA1 Message Date
Jepp9350 367dfc44e4 Add role and permission management functionality
Introduce classes `groups_o` and `groups_permissions_o` for managing roles and permissions. Add new routes `rolesRoute` and `permissionsRoute` to handle role and permission-related operations. Enhance `users_o` with the `getGroup` method and update `db_object_t` for improved table handling and pagination support.
2025-02-20 17:04:35 +01: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 d9638406d3 Implement route-level permission handling.
Added support for defining and registering permissions for API routes. Updated methods across the router and route traits to accommodate permission details, enabling better access control. Enhanced department license plate lookup with session validation and additional endpoints.
2025-02-20 14:12:21 +01:00
Jepp9350 b659b07d4c Add caching support for license plate lookups in MotorAPI
Introduced caching functionality to improve efficiency and reduce redundant API calls for license plate lookups. Added methods to check and retrieve cached entries while ensuring proper validation. Enhanced error handling for invalid responses and updated related routes and interfaces accordingly.
2025-02-20 10:59:09 +01:00
Jepp9350 9536b67998 Refactor unfulfilled bookings notification logic
Introduce a function to aggregate unfulfilled bookings by department. Replace individual Slack notifications with a single summary per department, improving efficiency and reducing redundant calls.
2025-02-19 17:54:53 +01:00
Jepp9350 53b61654bf Add Stripe invoice generation and customer management
Introduced functionality for creating and managing invoices using Stripe APIs, replacing the previous payment link system. Added customer account creation and retrieval, invoice line-item handling, and extended database object structures to support invoices. Updated order routing to include Stripe customer and invoice details.
2025-02-19 17:25:19 +01:00
Jepp9350 ea6c675826 Add support for Stripe economic customer number.
Introduced a new configuration variable `stripe_economic_customer_number_c` to handle the Economic customer number for invoicing. Updated the Stripe module to include this variable in initialization and allow updates. This enhancement enables better integration with invoicing workflows.
2025-02-19 14:16:17 +01:00
Jepp9350 afe0e1e3d6 Add MailerSend email service integration and templates
Introduced MailerSend as an email provider with essential configuration options, including API key management and "reply-to" support. Enhanced email functionality by implementing a modular template system (header, footer, and content) for both text and HTML formats. Updated the existing email infrastructure to handle Stripe invoice notifications via MailerSend with conditional fallback planned for default SMTP services.
2025-02-19 14:12:55 +01:00
Jepp9350 98879bf5b6 Update dependencies in composer.lock
Added new library dependencies, including `beberlei/assert`, `illuminate/collections`, `mailersend/mailersend`, and others, to `composer.lock`. These updates ensure compatibility and improve functionality by integrating the latest versions of required packages.
2025-02-19 12:00:16 +01:00
Jepp9350 143b024f78 Introduce Economic customer helper class and customer route
Added a helper class `economic_customer` to standardize customer data handling within the Economic API. Introduced a new route, `/modules/economic/customer`, for retrieving customers using their customer number. Updated `economic` class to integrate the helper and support streamlined customer operations.
2025-02-19 11:58:58 +01:00
Jepp9350 156f036d4c Add reference to Stripe API documentation in stripe.php
Include a docblock with a link to the Stripe API customer creation docs. This provides developers with quick access to relevant documentation, improving code clarity and usability.
2025-02-19 09:24:34 +01:00
Jepp9350 410ca84bf1 Add Stripe integration for customers, payments, and products
This commit introduces a comprehensive Stripe module with support for managing customers, products, prices, and payment links. It also includes endpoint routes, helpers, and database updates to support Stripe operations, such as creating and retrieving entities or handling payment workflows. Additionally, a stripe module was integrated into existing routes and objects to enable seamless interaction with Stripe APIs.
2025-02-18 18:31:23 +01:00
Jepp9350 20841858ac Add Stripe PHP library to composer dependencies
Included `stripe/stripe-php` library (v16.5.1) in the project for handling Stripe API interactions. Updated both `composer.json` and `composer.lock` to reflect the new dependency.
2025-02-18 13:07:14 +01:00
Jepp9350 8702b41777 Add MotorAPI integration and Economic products support
Implemented MotorAPI lookup functionality with proper validation and logging. Added Economic products endpoint for fetching product details. Enhanced route parameter validation with length constraints and improved response handling for objects.
2025-02-18 12:34:26 +01:00
Jepp9350 5af6fc5aa5 Add MotorAPI module with configuration management
Introduced the MotorAPI module, including its configuration classes, interface, and integration with the router. The configuration supports enabling, managing API tokens, and daily request limits. Added support for fetching and updating MotorAPI settings via new API routes.
2025-02-18 09:03:06 +01:00
Jepp9350 9272342c3a Fix undefined discountPercentage by providing default value
Previously, the absence of a discountPercentage caused issues. The code now uses a default value of 0 to ensure stability and prevent potential errors when the discount is not set.
2025-02-17 13:12:57 +01:00
Jepp9350 67e6bb8bf2 Add product options and department categories API
Introduce endpoints for managing product options and department categories, including listing, creating, editing, and deleting functionalities. Updated related objects and traits to support new operations, including added array serialization methods and improved query handling for better flexibility.
2025-02-17 11:38:00 +01:00
Jepp9350 2151cf2b7b Add customer listing and import functionality for Economic
Implemented endpoints to list and import customers from the Economic API, including query filtering, pagination, and validation. Added supporting trait methods, database functions, and error handling. Expanded the user object for Economic integration and introduced utilities for type checking and parameter extraction.
2025-02-13 12:50:35 +01:00
Jepp9350 7525a89154 Refactor database operations and enhance routes for consistency
Refactored database methods to improve code readability, reusability, and error handling. Introduced input validation helper functions and parsing capabilities for objects with optional callbacks. Added new routes for handling categories and improved product-related functionality to align with the new architecture.
2025-02-12 16:39:52 +01:00
Jepp9350 c240bbd94f Refactor database object trait and improve data handling
Added `delete`, `restore`, and other utility methods to enhance CRUD operations, including support for soft deletes. Introduced `objectChanged` hooks across objects for better cache or event handling, ensuring scalability and maintainability. Refactored and standardized object property handling while restructuring related methods.
2025-02-12 09:23:35 +01:00
Jepp9350 555d4e9918 Add comprehensive backup functionality and refactor email handling
Implemented server, database, and environment backups with configurable modules. Introduced new routes and configuration classes for backups alongside improved zip and S3 storage. Replaced PHPMailer with a cURL-based email service for streamlined message sending.
2025-02-11 17:41:57 +01:00
Jepp9350 797630d8bd Add backup and email enhancements with PHPMailer integration
Introduced a backup system managing database and metadata files using Minio/S3, alongside routes for handling these. Integrated PHPMailer for robust email functionalities, including configuration testing and SMTP handling. Updated Dockerfile, composer dependencies, and minor code improvements to support new features.
2025-02-11 14:25:26 +01:00
Jepp9350 61de9cdb45 Add email configuration module and enable invoice PDF retrieval
Introduce an email configuration module to manage SMTP settings, including encryption, host, username, and more. Implement functionality for retrieving invoice PDFs, storing them, and providing secure download links. Added relevant endpoint, routes, and helper methods to support these features.
2025-02-10 18:07:51 +01:00
Jepp9350 172e37d3a2 Add reCAPTCHA support and enhance Economic configurations
Introduce reCAPTCHA integration with validation and configuration handling. Update Economic module to include layout management and dynamic configuration via API. Added traits for managing module settings and encapsulated new endpoint routes for expanded functionality.
2025-02-10 15:27:32 +01:00
Jepp9350 ac657d6130 Add endpoint to close invoice drafts and refactor routes
Introduced a new POST endpoint `/invoices/draft/close` to allow closing of draft invoices, enforcing user authentication and permissions. Refactored and reorganized route and utility methods to improve readability and maintainability, including restoring `match_route` and restructuring `fromRequest`. Removed unused methods for cleaner code.
2025-02-07 13:03:22 +01:00
Jepp9350 f8cd736154 Add new endpoints and support for fetching user keys
Introduced functionality to fetch all user keys with associated data. Implemented new endpoints for deleting user bookings and retrieving user IDs, alongside permission checks and validation. Minor adjustments made for better error handling and improved debug logging behavior.
2025-02-07 10:33:41 +01:00
Jepp9350 588c9d68ef Remove unused '/orders/pending' route from ordersRoute.php
This route was unused and marked with a TODO for removal. Its deletion simplifies the code and eliminates unnecessary maintenance for an unused endpoint.
2025-02-06 14:28:19 +01:00
Jepp9350 ad2075a7d1 Update order and invoice handling logic
Added functionality to retrieve and list pending orders, as well as improved invoice draft management based on customer preferences (e.g., invoice per order). Simplified error handling and removed redundant operations in economic invoice logic.
2025-02-06 14:27:09 +01:00
Jepp9350 f2dcb6e5ba Add draft invoice handling and enhance endpoint functionality
Introduced endpoints and routes for managing draft invoices, enabling retrieval and updates. Extended object handling to include filters for deleted entries and added custom parsing for pagination results. Refactored code for improved structure and consistency.
2025-02-06 11:57:42 +01:00
Jepp9350 7186b27b74 Improve invoice fetching and add vehicle plate lookup API
Refactored the invoice retrieval to handle pagination for both drafts and booked invoices, ensuring all results are fetched when exceeding the limit. Added a new route for vehicle plate lookup, allowing retrieval of order history for a specified vehicle plate. Implemented the corresponding database query method in `orders_o`.
2025-02-05 16:18:52 +01:00
Jepp9350 6404ba65b2 Enhance invoice line formatting and content handling.
Standardize line formatting by prefixing notes and references with '#'. Refactor handling of registration numbers and discounts for improved clarity. Ensure empty lines are added for better visual separation in invoices.
2025-02-05 13:56:47 +01:00
Jepp9350 d022982b77 Add functionality for handling draft invoices in statistics
Introduced new endpoints and methods to incorporate draft invoice data into economic statistics. This includes calculating totals across various timeframes and aggregations by departments. Updated routes and traits to support these additions, ensuring seamless integration with the existing economic module.
2025-02-04 16:53:41 +01:00
Jepp9350 c82c201ff1 Add support for handling booked invoices and department stats
Introduced functionality for fetching and processing booked invoices with department-specific statistics. Added pagination and filtering capabilities for economic endpoints, including department data handling. Updated nginx configuration to support additional HTTP methods (PUT, DELETE).
2025-02-04 11:46:35 +01:00
Jepp9350 6ebea5504e Add endpoints and routes for economic statistics management
Implemented economic-related classes, endpoints, and routes to support fetching invoice totals, sent invoices, and department data. These changes enhance functionality by exposing APIs for economic statistics and integrating them into the statistics module.
2025-02-04 08:36:05 +01:00
Jepp9350 0960f35007 Add force_all parameter to getDepartmentById method
This update enhances the `getDepartmentById` method by adding an optional `force_all` parameter to bypass caching and fetch data directly from the database. Adjusted related calls in `orders_o` to use this new parameter where needed. This ensures greater control over data retrieval behavior.
2025-02-03 13:57:42 +01:00
Jepp9350 1e8c60e33a Refactor booking status handling and enhance file checks.
Updated booking logic to include completed bookings in cancellation handling. Added `isFileInStore` to improve file existence checks in the wash certificate store. Adjusted file server logic to use the new method for enhanced clarity and maintenance.
2025-02-03 09:34:09 +01:00
Jepp9350 bcbb4c0164 Add order statistics functionality
Introduced functionality to calculate and retrieve order statistics, including monthly counts per department. Updated statistics interface, routes, and supporting logic to handle new "orders" data type alongside bookings. Refactored code to streamline label generation by year and month ranges.
2025-01-31 16:17:34 +01:00
Jepp9350 e09eedb010 Add statistics feature with bookings tracking functionality
Introduce a scalable statistics architecture including `statistics` class, interface, and related implementations. Added support for tracking new bookings with routes and data handling through `bookings_s` and `statistic_t`. Integrated the feature into the application using autoloaders and response mechanisms.
2025-01-31 12:32:22 +01:00
Jepp9350 ca52d3b248 Update API endpoints, add wash certificate handling
Replaced legacy 'nnks.truckwash.dk' endpoint with 'api.truckwash.dk' across the codebase for consistency. Implemented a feature to handle certificate downloads, including file serving and validation. Updated PHP configuration to support additional dependencies like PHPMailer, and introduced necessary route and configuration changes for wash certificate processing.
2025-01-31 09:25:18 +01:00
Jepp9350 13fb3a10ae Simplify department name retrieval logic in Redis class
Replaced JSON decoding with direct object casting for department data, reducing unnecessary parsing overhead. This change ensures a more efficient and straightforward handling of the `get_department_name` function.
2025-01-30 16:59:33 +01:00
Jepp9350 2663c09455 Improve plate scanner handling and add pagination support
Refactored listObjects to include searchable fields and support for pagination. Enhanced validation logic for clearer error handling of required fields. Removed unused import to clean up the codebase.
2025-01-30 16:17:06 +01:00
Jepp9350 2e61eaa414 Add support for customizable searchable fields in queries
Introduced a `setSearchableFields` method to restrict searchable fields in database queries, enhancing security by preventing unintended access to sensitive data. Updated user and department routes to leverage this feature. Default behavior remains unchanged when no searchable fields are specified.
2025-01-30 15:29:21 +01:00
Jepp9350 562788e9ff Update backup service to use periodic execution with curl
The Dockerfile now uses a loop to run the backup script every 60 seconds. Added `curl` installation and a curl command in `backup.sh` for external script execution. Removed unused echo statements for clarity.
2025-01-29 17:20:39 +01:00
Jepp9350 d5e3991bf8 Add initial backup service with Docker and scripts
This commit introduces a Dockerized backup service, including a Dockerfile, a placeholder `backup.sh` script, and a functional `database_export.sh` script for creating database backups. The setup ensures required validations and dependencies for safely exporting database content. Further implementation is needed in `backup.sh`.
2025-01-29 16:51:19 +01:00
Jepp9350 3f9e6310f4 Remove unnecessary app directory copy in Nginx Dockerfile
The COPY command for transferring /app to /var/www/html was commented out as it is redundant. Nginx is not being used to serve static files in this setup with separate PHP and Nginx containers. This helps avoid unnecessary actions and aligns the configuration with the intended architecture.
2025-01-29 15:29:32 +01:00
Jepp9350 b97881ff05 Update database table references and clean up whitespace
Replaced all references to `maintenancemode_dbtest.customer_attributes` with `customer_attributes` in `users_o.php` for clarity and consistency. Additionally, removed unnecessary empty line in `redis_t.php` to improve code formatting.
2025-01-29 15:14:17 +01:00
Jepp9350 707df910b0 Refactor: migrate files 2025-01-29 14:27:44 +01:00