Commit Graph
852 Commits
Author SHA1 Message Date
Jeppe Bundgaard 2ad9bcfd37 Update Bird module to use AccessKey authorization header instead of Bearer, improve error handling, and add support for workspace/channel configuration. 2026-02-27 03:08:28 +01:00
Jeppe B 6853cdc9ce Merge pull request #131 from copenhagentruckwash/codex/find-and-fix-important-bug
Fix selfserve lane bootstrap failures from eager logging dependencies
2026-02-27 02:04:23 +01:00
Jeppe B 0bb032bd0f Fix selfserve lane logging bootstrap dependency handling 2026-02-27 02:02:30 +01:00
Jeppe Bundgaard 52b467fe59 Update configuration response schemas in OpenAPI documentation to include detailed data structures 2026-02-27 01:55:22 +01:00
Jeppe Bundgaard abd33ed6d9 Add Bird configuration endpoints (GET/POST) and update OpenAPI documentation 2026-02-27 01:38:45 +01:00
Jeppe Bundgaard 32f017778f Add voice call management endpoints and enhance logging for HTTP requests 2026-02-27 01:29:32 +01:00
Jeppe Bundgaard a0727cd14e Add optional per-department weekly targets and update related calculations 2026-02-27 01:11:22 +01:00
Jeppe Bundgaard f74210bca8 Add date range fields to goal criteria and update OpenAPI documentation 2026-02-27 00:46:30 +01:00
Jeppe Bundgaard ddc35fd21a Enhance goal progress schema by adding year and to-date calculations, and improve descriptions for clarity 2026-02-27 00:41:31 +01:00
Jeppe Bundgaard 647b7f2d94 Refactor progress calculation to avoid mutating instance and improve clarity 2026-02-27 00:32:41 +01:00
Jeppe Bundgaard ea7633a908 Enhance departmental goal tracking by adding yearly and to-date progress calculations 2026-02-27 00:31:24 +01:00
Jeppe Bundgaard ece9f5108a Enhance progress tracking by adding yearly and to-date calculations for departmental targets 2026-02-27 00:23:02 +01:00
Jeppe Bundgaard bf636c0108 Add configuration files for HTTP client and Nginx logs visualization 2026-02-26 23:01:59 +01:00
Jeppe Bundgaard fc9d7882ae Refactor user retrieval logic to improve existence check for customer numbers 2026-02-26 22:51:37 +01:00
Jeppe Bundgaard 0ce9e79cb7 Update Traefik configuration to support additional domains and optimize certificate resolvers 2026-02-25 17:09:22 +01:00
Jeppe Bundgaard 88f4f34c34 Update department daily targets to support floats
- Refactored `department_daily_targets` logic to accept and process float values instead of integers.
- Adjusted relevant type declarations, validations, and calculations in `GoalsCriteria`.
- Updated OpenAPI schema to align with new data type for per-department daily targets.
2026-02-25 14:40:26 +01:00
Jeppe Bundgaard 49f07c40c8 Add time-based progress tracking and department-specific target calculations
- Added support for `today`, `week`, and `month` progress tracking in `GoalsCriteria`.
- Introduced `setTimeframeByName` method to manage time-based progress criteria.
- Enhanced `calculateProgressFromArray` and `calculateProgressDetailsFromArray` to include customizable timeframes.
- Updated departmental progress calculations with detailed breakdowns for multiple time periods.
- Replaced obsolete single-value progress tracking with comprehensive progress details.
2026-02-25 14:30:03 +01:00
Jeppe Bundgaard 90959c6b41 Expand criteria type enums and add goal progress tracking schema updates
- Added new enum values (`REVENUE`, `VISITS`, `NONE`) for `Criteria type` in `GoalsCriteria`.
- Introduced `GoalProgressDetails` schema for tracking progress metrics (count, target).
- Extended `DepartmentGoal` to include time-based progress tracking (`today`, `week`, `month`) and departmental distribution of progress.
2026-02-25 14:29:56 +01:00
Jeppe Bundgaard cc494583e0 Add support for time-based departmental progress tracking
- Introduced calculation of departmental progress for today, week, and month in `department_goals_o.php`.
- Removed unnecessary blank line in `object_property.php` for code clarity.
2026-02-25 14:20:25 +01:00
Jeppe Bundgaard 11a677416b Enhance department goal criteria handling
- Refactored department daily targets logic for optimization and better maintainability.
- Ensured department-specific targets are validated, sanitized, and consistently applied in updates.
- Improved database interaction safety by preventing unnecessary updates for unchanged object properties.
- Adjusted route and API behavior for criteria and department updates to handle validations comprehensively.
2026-02-25 14:15:19 +01:00
Jeppe Bundgaard ffc5d6bc21 Add support for per-department custom daily targets
- Introduced `department_daily_targets` field in criteria, renderer, and API to define daily target overrides for departments.
- Enhanced daily target logic to honor per-department overrides while maintaining backward compatibility.
- Updated SMS, email, and Slack renderers for consistent enforcement of text length limits with fallback to non-mbstring functions.
- Refactored order item update logic to improve database interaction safety by using setters.
2026-02-25 13:03:04 +01:00
Jeppe Bundgaard 5cc311ae32 Add Redis-based permission caching for users and subusers
- Introduced Redis-backed caching for user and subuser permission evaluations in the `route_t` trait, reducing database queries.
- Enhanced `Redis` class with methods for permission caching: `cache_permission`, `get_permission`, and `clear_permission`.
- Added test coverage for the new caching logic in `PermissionRedisCacheTest.php`.
- Implemented Redis caching for authentication sessions with `cache_auth_session`, `get_auth_session`, and `clear_auth_session`.
- Improved CORS handling for preflight requests in `index.php`.
2026-02-24 15:00:22 +01:00
Jeppe Bundgaard 2534ffb1b9 Add Redis caching to autoloader for improved class and module loading performance
- Integrated Redis caching in the autoloading process to store and retrieve class and file paths dynamically.
- Added fallback mechanisms for Redis errors to ensure compatibility.
- Cached module directories and individual class paths with expiration to enhance performance and reduce filesystem scans.
2026-02-24 13:55:34 +01:00
Jeppe Bundgaard e8f0c630cf Remove redundant require_once statement in bird.php. 2026-02-24 13:38:30 +01:00
Jeppe Bundgaard 3bf514ce3f Refactor autoloading logic for efficient class, interface, and module loading
- Replaced manual file inclusion with `spl_autoload_register` for dynamic loading of classes, interfaces, traits, and modules.
- Added support for autoloading across core folders (`classes`, `interfaces`, `traits`, etc.) and module directories.
- Introduced a fallback mechanism for module-specific class loading with suffix-based file matching.
- Improved maintainability and scalability by eliminating extensive manual requires.
2026-02-24 13:38:20 +01:00
Jeppe Bundgaard 1050f72aa6 Refactor route and trait loading logic; simplify 404 handling. 2026-02-24 12:56:56 +01:00
Jeppe Bundgaard 817fcb974c Add Redis caching for object properties
- Added a private `getCacheKey()` method for consistent Redis key generation.
- Integrated Redis caching in `get`, `set`, and `delete` methods to improve performance.
- Ensured JSON values are correctly serialized/deserialized with caching.
- Implemented cache expiration and invalidation logic for updates and deletions.
2026-02-24 12:51:56 +01:00
Jeppe Bundgaard 79d0b2f270 Add Redis caching methods for customer-user mappings
- Introduced methods `cache_customer_number_from_user_id`, `get_customer_number_from_user_id`, and `clear_customer_number_from_user_id` to the `Redis` class.
- Updated the `Redis_i` interface to define these new methods.
- Enhances customer-user mapping logic by integrating Redis for efficient caching and retrieval.
2026-02-24 12:44:57 +01:00
Jeppe Bundgaard e143f084e4 Remove language pack logic and introduce Redis caching for customer-user mapping.
- Removed all language pack-related files, traits, and classes.
- Enhanced `users_o.php` with Redis caching for mapping `customer_number` to `user_id` and vice versa.
- Added Redis checks and caching for improved performance in user retrieval methods.
2026-02-24 12:44:43 +01:00
Jeppe Bundgaard f1c0ea2228 Remove language pack management and associated logic; add detailed logging for backups and cron processes. 2026-02-24 12:36:41 +01:00
Jeppe Bundgaard 84020bd051 Simplify customer authentication by removing default password logic and enforcing stricter checks for missing passwords. 2026-02-24 12:36:22 +01:00
Jeppe Bundgaard 9920f1dd27 Refactor token generation to use create_token_by_user_id in customer authentication flow 2026-02-24 11:57:44 +01:00
Jeppe Bundgaard 1368bfc7b5 Update .gitignore to exclude PHP logs directory 2026-02-24 11:46:26 +01:00
Jeppe Bundgaard a49b3a2d01 Add unit tests for authentication and WebAuthn functionality
- Introduced `CreateTokenUserNotFoundTest.php` to validate `create_token` behavior when users are missing.
- Added `WebAuthnLogicCheck.php` to test deserialization handling in `webauthn.php`.
- Created `WebAuthnReproLogic.php` for verifying credential ID and user handle matching.
- These tests aim to enhance coverage and ensure robust handling of edge cases in authentication processes.
2026-02-24 11:46:12 +01:00
Jeppe Bundgaard 76496fc403 Add Nginx test configurations, HTTP scripts for self-serve APIs, and .env example; update .gitignore for IntelliJ files and logs.
- Introduced `PemToCoseConversionTest` for WebAuthn key testing.
- Added example Nginx config (`nginx-example.conf`) with CORS and PHP handling.
- Created HTTP test scripts for self-serve API endpoints.
- Provided `.env` example for Elastic Stack credentials.
- Updated `.gitignore` to include IntelliJ and Nginx logs.
2026-02-24 11:44:09 +01:00
Jeppe Bundgaard ba9f6b7d01 Update .gitignore to exclude IntelliJ IDEA config files, Let's Encrypt files, and log archives 2026-02-24 11:40:12 +01:00
Jeppe Bundgaard b45a990273 Add composer.phar to the repository 2026-02-24 11:40:00 +01:00
Jeppe Bundgaard 50789aca33 Enhance WebAuthn handling and error management
- Improve user verification in `authentication.php` by adding a check for user existence and throwing meaningful exceptions for missing users.
- Refactor `webauthn.php` to handle Base64URL decoding and COSE key normalization for consistent WebAuthn library compatibility.
- Extend error logging with additional context for debugging (e.g., public key hex representation).
- Add utility functions for Base64URL decoding and checking PEM/DER format.
- Update `passkeysRoute.php` to normalize public keys and handle errors gracefully during WebAuthn workflows.
2026-02-24 11:39:15 +01:00
Jeppe Bundgaard 8bccd45fc8 Update README.md with comprehensive project documentation
- Replace outdated TLS certificate setup with a detailed overview of the Copenhagen Truck Wash API.
- Add sections on architecture, stack components, local development, configuration, testing, monitoring, and API documentation.
- Include instructions for running tests, logs inspection, and utilizing tools like Traefik, Jaeger, and Portainer.
2026-02-24 11:38:55 +01:00
Jeppe Bundgaard 860b5ac6e3 Add OpenAPI v1 documentation for Bookings API
- Introduced Writerside topics for multiple endpoints in the Bookings module, including user, admin, and public time booking routes.
- Added `Bookings_OpenAPIv1.json` specification defining API paths, schemas, and security configurations.
- Included endpoint details for operations like booking retrieval, updates, deletion, syncing, and timebookings.
2026-02-24 11:38:41 +01:00
Jeppe Bundgaard d4007bd495 Merge remote-tracking branch 'origin/master' 2026-02-24 10:55:43 +01:00
Jeppe Bundgaard df3db24c49 Add Qodana configuration for PHP code analysis
- Introduce `qodana.yaml` to configure Qodana analysis in PHP projects.
- Set up basic configuration including inspection profile and linter specification.
- Prepare for future CI/CD pipeline integration with commented bootstrap and plugin sections.
2026-02-24 10:55:23 +01:00
Jeppe B 48b625a8a0 Add Qodana code quality workflow 2026-02-24 10:24:21 +01:00
Jeppe Bundgaard 81bcc4f78d Add docker-compose config for host-based Fleet Server and new /ping route
- Introduce `docker-compose.fleet-host.yml` allowing Elastic Agent to connect to a host-installed Fleet Server.
- Add `pingRoute` to provide a simple `/ping` endpoint returning "pong" with a timestamp.
2026-02-24 09:28:41 +01:00
Jeppe Bundgaard b291e959e0 Add WebAuthn integration, reCAPTCHA support, and new tests
- Integrate WebAuthn library for passkey authentication workflows, including assertion verification and improved error handling.
- Add support for reCAPTCHA token validation across multiple endpoints for enhanced security.
- Extend OpenAPI schema to document new fields and restructured payloads.
- Add unit tests for WebAuthn flows, permission initialization, and route validation to ensure robustness and accuracy.
2026-02-24 09:27:51 +01:00
Jeppe Bundgaard 2e88ed7bbd Add binding for acme-io.json in Traefik config 2026-02-24 00:28:17 +01:00
Jeppe Bundgaard 629c13499d Add CORS rule for api.truckwash.io and new preflight route
- Introduce preflight handling for `OPTIONS` method on `api.truckwash.io` with high priority routing and secure headers middleware.
- Extend CORS configuration to include `https://api.truckwash.io`.
2026-02-23 23:45:22 +01:00
Jeppe Bundgaard 356e59bd10 Improve dynamic URL generation and add localhost support for passkey challenges
- Refactor direct download URL generation to dynamically use `HTTP_HOST` and protocol.
- Add support for localhost `rpId` during WebAuthn passkey challenges.
- Extend test cases to validate `localhost` and `truckwash.io` scenarios.
- Update OpenAPI specifications to reflect new `rpId` logic and additional server configurations.
2026-02-23 23:37:15 +01:00
Jeppe Bundgaard 61db62212c Add WebAuthn passkey challenge and verification endpoints
- Introduced endpoints for WebAuthn-based authentication flow (`/auth/passkey/challenge` and `/auth/passkey/verify`).
- Added support for generating and verifying WebAuthn PublicKeyCredentialRequestOptions and challenge tokens.
- Extended routing logic to expose matched route templates for improved parameter handling.
- Updated OpenAPI specifications to document passkey challenge and verification workflows.
- Included unit tests for validating both existing and non-existing user scenarios during passkey challenges.
2026-02-23 23:03:28 +01:00
Jeppe Bundgaard 63c88a463d Refactor passkey and token processing for improved consistency and validation
- Update passkey data mapping to use associative arrays and handle JSON decoding for `transports`.
- Refactor token caching logic to validate database existence and clear stale entries.
- Improve 2FA handling by centralizing `token->type` and `user_id` processing for reuse.
2026-02-23 22:44:06 +01:00