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,9 @@
import { Module } from '@nestjs/common';
import { MailTenancy } from './MailTenancy.service';
import { TenancyContext } from '../Tenancy/TenancyContext.service';
@Module({
providers: [MailTenancy, TenancyContext],
exports: [MailTenancy],
})
export class MailTenancyModule {}

View File

@@ -0,0 +1,27 @@
import { Injectable } from '@nestjs/common';
import { TenancyContext } from '../Tenancy/TenancyContext.service';
import { ConfigService } from '@nestjs/config';
@Injectable()
export class MailTenancy {
constructor(
private readonly tenancyContext: TenancyContext,
private readonly config: ConfigService
) {}
/**
* Retrieves the senders mails of the given tenant.
*/
public async senders() {
const tenantMetadata = await this.tenancyContext.getTenantMetadata();
const from = this.config.get('mail.from');
return [
{
mail: from,
label: tenantMetadata.name,
primary: true,
}
].filter((item) => item.mail)
}
}