diff --git a/backend/src/entities/company-info/application/dto/found-company-white-label-properties.ro.ts b/backend/src/entities/company-info/application/dto/found-company-white-label-properties.ro.ts index 778d26186..984c69a70 100644 --- a/backend/src/entities/company-info/application/dto/found-company-white-label-properties.ro.ts +++ b/backend/src/entities/company-info/application/dto/found-company-white-label-properties.ro.ts @@ -1,5 +1,6 @@ import { ApiProperty } from '@nestjs/swagger'; import { FoundCompanyImageInfo } from './found-company-logo.ro.js'; +import { SubscriptionLevelEnum } from '../../../../enums/subscription-level.enum.js'; export class FoundCompanyWhiteLabelPropertiesRO { @ApiProperty({ type: FoundCompanyImageInfo, required: false }) @@ -10,4 +11,7 @@ export class FoundCompanyWhiteLabelPropertiesRO { @ApiProperty({ type: String, required: false }) tab_title: string; + + @ApiProperty({ enum: SubscriptionLevelEnum }) + subscriptionLevel: SubscriptionLevelEnum; } diff --git a/backend/src/entities/company-info/use-cases/find-company-white-label-properties.use.case.ts b/backend/src/entities/company-info/use-cases/find-company-white-label-properties.use.case.ts index 384beb2d5..dd3445df2 100644 --- a/backend/src/entities/company-info/use-cases/find-company-white-label-properties.use.case.ts +++ b/backend/src/entities/company-info/use-cases/find-company-white-label-properties.use.case.ts @@ -5,6 +5,8 @@ import { IGetCompanyWhiteLabelProperties } from './company-info-use-cases.interf import { BaseType } from '../../../common/data-injection.tokens.js'; import { IGlobalDatabaseContext } from '../../../common/application/global-database-context.interface.js'; import { Messages } from '../../../exceptions/text/messages.js'; +import { isSaaS } from '../../../helpers/app/is-saas.js'; +import { SaasCompanyGatewayService } from '../../../microservices/gateways/saas-gateway.ts/saas-company-gateway.service.js'; @Injectable() export class FindCompanyWhiteLabelPropertiesUseCase @@ -14,6 +16,7 @@ export class FindCompanyWhiteLabelPropertiesUseCase constructor( @Inject(BaseType.GLOBAL_DB_CONTEXT) protected _dbContext: IGlobalDatabaseContext, + private readonly saasCompanyGatewayService: SaasCompanyGatewayService, ) { super(); } @@ -24,6 +27,15 @@ export class FindCompanyWhiteLabelPropertiesUseCase throw new NotFoundException(Messages.COMPANY_NOT_FOUND); } + let companySubscriptionLevel = null; + if (isSaaS()) { + const companyInfoFromSaas = await this.saasCompanyGatewayService.getCompanyInfo(companyId); + if (!companyInfoFromSaas) { + throw new NotFoundException(Messages.COMPANY_NOT_FOUND); + } + companySubscriptionLevel = companyInfoFromSaas.subscriptionLevel; + } + return { logo: company.logo ? { @@ -38,6 +50,7 @@ export class FindCompanyWhiteLabelPropertiesUseCase } : null, tab_title: company.tab_title?.text ?? null, + subscriptionLevel: companySubscriptionLevel, }; } }