Add custom routes, subscription features, and refactor orders

Introduced a new POST route for collected vehicle subscription invoices and enhanced responses with wash subscription transactions. Refactored order handling by adding department-based pricing logic and simplifying reusable methods. Various minor improvements include exception handling, input validation, and updated permissions.
This commit is contained in:
Jepp9350
2025-04-28 14:24:11 +02:00
parent c19ed3389c
commit 6cc5e6bbf0
7 changed files with 299 additions and 132 deletions
+16
View File
@@ -4,6 +4,7 @@ namespace traits;
use classes\authentication;
use classes\recaptcha;
use classes\response;
use objects\logs_o;
trait route_t
@@ -162,6 +163,21 @@ trait route_t
}
}
/**
* Require the max value of the given value
* @param int $value - The value to check
* @param int $max - The max value
*/
public function requireMaxValue(int $value, int $max): void
{
global
/** @var response $response */
$response;
if ($value > $max) {
$response->error('Parameter must be at most ' . $max, 400);
}
}
/**
* Require department access
* @note This checks if the user has access to the department by checking if the user has the permission department_access_{department} (_{permission} if provided)