Trim registration input in vehicle creation and add contactName parameter to OpenAPI spec and related routes.

This commit is contained in:
Jeppe Bundgaard
2026-01-08 13:16:32 +01:00
parent 338c244e53
commit 0d96bf6219
3 changed files with 11 additions and 1 deletions
+5
View File
@@ -252,6 +252,7 @@ paths:
- invoiceEmail
- contactEmail
- contactPhone
- contactName
properties:
cvr:
type: string
@@ -285,6 +286,10 @@ paths:
minimum: 10000000
maximum: 9999999999
example: 21754690
contactName:
type: string
description: Contact person name
example: "Mikkel"
responses:
'201':
description: Customer registered successfully
+4 -1
View File
@@ -168,12 +168,13 @@ class authRoute
/**
* Parameters:
*/
self::requireParameters(['cvr', 'companyPhone', 'invoiceEmail', 'contactEmail', 'contactPhone']);
self::requireParameters(['cvr', 'companyPhone', 'invoiceEmail', 'contactEmail', 'contactPhone', 'contactName']);
$cvr = self::getParameter('cvr');
$companyPhone = (int)self::getParameter('companyPhone');
$invoiceEmail = self::getParameter('invoiceEmail');
$contactEmail = self::getParameter('contactEmail');
$contactPhone = (int)self::getParameter('contactPhone');
$contactName = self::getParameter('contactName');
/**
* Validate
*/
@@ -201,6 +202,7 @@ class authRoute
self::requireMinValue($contactPhone, 10000000);
self::requireMaxValue($contactPhone, 9999999999);
}
/**
* If the contact phone is empty, default to company phone
*/
@@ -216,6 +218,7 @@ class authRoute
if (empty($contactEmail)) {
$contactEmail = 'jb@truckwash.dk';
}
/**
* Check if the cvr already exists
*/
@@ -193,6 +193,8 @@ class vehiclesRoute
$reg = (string)self::getParameter('reg');
$type = (int)self::getParameter('type');
$subscription = (bool)self::getParameter('wash_subscription');
// Strip the registration number of whitespace
$reg = trim($reg);
// Create a new vehicle
$vehicle = new customer_vehicles_o();
$vehicle->add(