Adding initial changes to display business owner instead of id
MODIFY
src/storage/mongodb/CompanyStorage.ts
src/storage/mongodb/CompanyStorage.ts
@@ -190,6 +190,21 @@ export default class CompanyStorage {
DatabaseUtils.pushSiteLookupInAggregation(
{ tenantID: tenant.id, aggregation, localField: '_id', foreignField: 'companyID', asField: 'sites' });
}
+ // if (params.withAccount) {
+ // With Accounts
+ DatabaseUtils.pushAccountLookupInAggregation({
+ tenantID: tenant.id, aggregation,
+ asField: 'accountData.account', localField: 'accountData.accountID',
+ foreignField: '_id', oneToOneCardinality: true, oneToOneCardinalityNotNull: false
+ });
+ // With Account owner
+ DatabaseUtils.pushUserLookupInAggregation({
+ tenantID: tenant.id, aggregation: aggregation,
+ asField: 'accountData.account.businessOwner',
+ localField: 'accountData.account.businessOwnerID',
+ foreignField: '_id', oneToOneCardinality: true, oneToOneCardinalityNotNull: false
+ });
+ // }
// Company Logo
if (params.withLogo) {
aggregation.push({

MODIFY
src/types/Billing.ts
src/types/Billing.ts
@@ -173,6 +173,7 @@ export interface BillingAccount extends CreatedUpdatedProps, BillingTransferAuth
export interface BillingAccountData {
accountID: string;
+ account?: BillingAccount;
platformFeeStrategy?: BillingPlatformFeeStrategy;
}

Adding initial changes to display business owner instead of id