Switched SiteImage to public endpoint
MODIFY
src/server/rest/v1/router/api/SiteRouter.ts
src/server/rest/v1/router/api/SiteRouter.ts
@@ -24,7 +24,6 @@ export default class SiteRouter {
this.buildRouteSetSiteOwner();
this.buildRouteUpdateSite();
this.buildRouteDeleteSite();
- this.buildRouteGetSiteImage();
return this.router;
}
@@ -95,11 +94,4 @@ export default class SiteRouter {
await RouterUtils.handleServerAction(SiteService.handleDeleteSite.bind(this), ServerAction.SITE_DELETE, req, res, next);
});
}
-
- private buildRouteGetSiteImage(): void {
- this.router.get(`/${ServerRoute.REST_SITE_IMAGE}`, async (req: Request, res: Response, next: NextFunction) => {
- req.query.ID = req.params.id;
- await RouterUtils.handleServerAction(SiteService.handleGetSiteImage.bind(this), ServerAction.SITE_IMAGE, req, res, next);
- });
- }
}

MODIFY
src/server/rest/v1/router/util/UtilRouter.ts
src/server/rest/v1/router/util/UtilRouter.ts
@@ -8,6 +8,7 @@ import ChargingStationService from '../../service/ChargingStationService';
import CompanyService from '../../service/CompanyService';
import RouterUtils from '../RouterUtils';
import SiteAreaService from '../../service/SiteAreaService';
+import SiteService from '../../service/SiteService';
import { StatusCodes } from 'http-status-codes';
export default class UtilRouter {
@@ -24,6 +25,7 @@ export default class UtilRouter {
this.buildRouteGetCompanyLogo();
this.buildRouteGetSiteAreaImage();
this.buildRouteChargingStationDownloadFirmware();
+ this.buildRouteGetSiteImage();
return this.router;
}
@@ -68,4 +70,11 @@ export default class UtilRouter {
await RouterUtils.handleServerAction(ChargingStationService.handleGetFirmware.bind(this), ServerAction.FIRMWARE_DOWNLOAD, req, res, next);
});
}
+
+ private buildRouteGetSiteImage(): void {
+ this.router.get(`/${ServerRoute.REST_SITE_IMAGE}`, async (req: Request, res: Response, next: NextFunction) => {
+ req.query.ID = req.params.id;
+ await RouterUtils.handleServerAction(SiteService.handleGetSiteImage.bind(this), ServerAction.SITE_IMAGE, req, res, next);
+ });
+ }
}

Switched SiteImage to public endpoint