Trim registration input in vehicle creation and add contactName parameter to OpenAPI spec and related routes.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user