feat(nestjs): migrate to NestJS

This commit is contained in:
Ahmed Bouhuolia
2025-04-07 11:51:24 +02:00
parent f068218a16
commit 55fcc908ef
3779 changed files with 631 additions and 195332 deletions

View File

@@ -0,0 +1,25 @@
import { TenancyContext } from '@/modules/Tenancy/TenancyContext.service';
import { throwIfTenantNotExists } from '../Organization/_utils';
import { TenantModel } from '@/modules/System/models/TenantModel';
import { Injectable } from '@nestjs/common';
@Injectable()
export class GetCurrentOrganizationService {
constructor(private readonly tenancyContext: TenancyContext) {}
/**
* Retrieve the current organization metadata.
* @param {number} tenantId
* @returns {Promise<ITenant[]>}
*/
async getCurrentOrganization(): Promise<TenantModel> {
const tenant = await this.tenancyContext
.getTenant()
.withGraphFetched('subscriptions')
.withGraphFetched('metadata');
throwIfTenantNotExists(tenant);
return tenant;
}
}