Replacing user with businessOwner
MODIFY
src/authorization/AuthorizationsDefinition.ts
src/authorization/AuthorizationsDefinition.ts
@@ -481,7 +481,7 @@ export const AUTHORIZATION_DEFINITION: AuthorizationDefinition = {
resource: Entity.BILLING_ACCOUNT,
action: [Action.LIST, Action.CREATE, Action.READ, Action.UPDATE, Action.DELETE, Action.BILLING_ONBOARD_ACCOUNT],
attributes: [
- 'id', 'accountExternalID', 'businessOwnerID', 'user.id', 'user.firstName', 'user.name', 'user.email', 'status'
+ 'id', 'accountExternalID', 'businessOwnerID', 'businessOwner.id', 'businessOwner.firstName', 'businessOwner.name', 'businessOwner.email', 'status'
]
},
{

MODIFY
src/storage/mongodb/BillingStorage.ts
src/storage/mongodb/BillingStorage.ts
@@ -307,7 +307,7 @@ export default class BillingStorage {
});
// Add Users
DatabaseUtils.pushUserLookupInAggregation({
- tenantID: tenant.id, aggregation: aggregation, asField: 'user', localField: 'businessOwnerID',
+ tenantID: tenant.id, aggregation: aggregation, asField: 'businessOwner', localField: 'businessOwnerID',
foreignField: '_id', oneToOneCardinality: true, oneToOneCardinalityNotNull: false
});
// Add Last Changed / Created

MODIFY
src/types/Billing.ts
src/types/Billing.ts
@@ -164,8 +164,8 @@ export interface BillingPlatformFeeStrategy {
export interface BillingAccount extends CreatedUpdatedProps, BillingTransferAuthorizationActions {
id?: string;
- businessOwnerID?: string;
- user?: User;
+ businessOwnerID: string;
+ businessOwner?: User;
status: BillingAccountStatus;
activationLink?: string;
accountExternalID: string;

Replacing user with businessOwner