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.
This commit is contained in:
Jepp9350
2025-02-13 12:50:35 +01:00
parent 7525a89154
commit 2151cf2b7b
10 changed files with 336 additions and 1 deletions
+35
View File
@@ -20,6 +20,41 @@ trait route_t
// Add the routes here
}
/**
* Require type
* @param mixed $value
* @param string $type
* @return bool
*/
public function requireType(mixed $value, string $type): bool
{
// Get the type of the value
$value_type = gettype($value);
// Check if the value is of the required type
if ($value_type !== $type) {
global $response;
$response->error('Invalid type. Expected: ' . $type . ' Got: ' . $value_type, 400);
}
return true;
}
public function type_int(): string
{
return 'integer';
}
/**
* Get the parameter from the request by name
* This is a shorthand for the response class method
* @param string $parameter
* @return mixed|null
*/
public function getParameter(string $parameter): mixed
{
global $response;
return $response->getRequestParameter($parameter);
}
public function requireParameters(array $parameters): void
{
global $response;