Endpoint for car image
MODIFY
src/server/rest/CentralRestServerService.ts
src/server/rest/CentralRestServerService.ts
@@ -285,6 +285,9 @@ export default {
case ServerAction.PING:
res.sendStatus(200);
break;
+ case ServerAction.CAR_IMAGE:
+ await CarService.handleGetCarImage(action, req, res, next);
+ break;
// FirmwareDownload
case ServerAction.FIRMWARE_DOWNLOAD:
try {

MODIFY
src/server/rest/service/CarService.ts
src/server/rest/service/CarService.ts
@@ -102,6 +102,18 @@ export default class CarService {
next();
}
+
+ public static async handleGetCarImage(action: ServerAction, req: Request, res: Response, next: NextFunction): Promise<void> {
+ // Filter
+ const filteredRequest = CarSecurity.filterCarCatalogRequest(req.query);
+ UtilsService.assertIdIsProvided(action, filteredRequest.ID, MODULE_NAME, 'handleGetCarCatalog', req.user);
+ let carCatalog;
+ // Get the car Image
+ carCatalog = await CarStorage.getCarCatalog(filteredRequest.ID, ['image']);
+ // Return
+ res.send(carCatalog.image);
+ }
+
public static async handleGetCarCatalogImages(action: ServerAction, req: Request, res: Response, next: NextFunction): Promise<void> {
if (!Authorizations.isSuperAdmin(req.user)) {
// Check if component is active

MODIFY
src/types/Server.ts
src/types/Server.ts
@@ -62,6 +62,7 @@ export enum ServerAction {
CAR_CREATE = 'CarCreate',
CAR_UPDATE = 'CarUpdate',
CAR_DELETE = 'CarDelete',
+ CAR_IMAGE = 'CarImage',
CARS = 'Cars',
CAR = 'Car',
CAR_USERS = 'CarUsers',

Endpoint for car image