Unifomized imge retrieval in endpoints
MODIFY
src/server/rest/v1/service/CompanyService.ts
src/server/rest/v1/service/CompanyService.ts
@@ -68,6 +68,8 @@ export default class CompanyService {
UtilsService.assertIdIsProvided(action, filteredRequest.ID, MODULE_NAME, 'handleGetCompanyLogo', req.user);
// Fetch Tenant Object by Tenant ID
const tenant = await TenantStorage.getTenant(filteredRequest.TenantID);
+ UtilsService.assertObjectExists(action, tenant, `Tenant ID '${filteredRequest.TenantID}' does not exist`,
+ MODULE_NAME, 'handleGetCompanyLogo', req.user);
// Get the Logo
const companyLogo = await CompanyStorage.getCompanyLogo(tenant, filteredRequest.ID);
// Return

MODIFY
src/server/rest/v1/service/SiteService.ts
src/server/rest/v1/service/SiteService.ts
@@ -313,10 +313,6 @@ export default class SiteService {
const tenant = await TenantStorage.getTenant(filteredRequest.TenantID);
UtilsService.assertObjectExists(action, tenant, `Tenant ID '${filteredRequest.TenantID}' does not exist`,
MODULE_NAME, 'handleGetSiteImage', req.user);
- // Get
- const site = await SiteStorage.getSite(tenant, filteredRequest.ID);
- UtilsService.assertObjectExists(action, site, `Site ID '${filteredRequest.ID}' does not exist`,
- MODULE_NAME, 'handleDeleteSite', req.user);
// Get the image
const siteImage = await SiteStorage.getSiteImage(tenant, filteredRequest.ID);
if (siteImage?.image) {

Unifomized imge retrieval in endpoints