Add canCreate to Company list
MODIFY
src/server/rest/v1/service/CompanyService.ts
src/server/rest/v1/service/CompanyService.ts
@@ -170,6 +170,7 @@ export default class CompanyService {
);
// Add Auth flags
await AuthorizationService.addCompaniesAuthorizations(req.tenant, req.user, companies.result);
+ // companies.canCreate = Authorizations.canCreateCompany(req.user);
// Return
res.json(companies);
next();

MODIFY
src/types/DataResult.ts
src/types/DataResult.ts
@@ -2,6 +2,7 @@ import { Transaction } from '@google-cloud/firestore';
export interface DataResult<T> {
count: number;
+ canCreate?: boolean;
result: T[];
}

Add canCreate to Company list