mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-15 04:10:32 +00:00
feat(nestjs): migrate to NestJS
This commit is contained in:
@@ -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 {}
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user