mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 05:10:31 +00:00
feat(server): contact mail notification service
This commit is contained in:
25
packages/server/src/services/MailTenancy/MailTenancy.ts
Normal file
25
packages/server/src/services/MailTenancy/MailTenancy.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import config from '@/config';
|
||||
import { Tenant } from "@/system/models";
|
||||
import { Service } from 'typedi';
|
||||
|
||||
|
||||
@Service()
|
||||
export class MailTenancy {
|
||||
/**
|
||||
* Retrieves the senders mails of the given tenant.
|
||||
* @param {number} tenantId
|
||||
*/
|
||||
public async senders(tenantId: number) {
|
||||
const tenant = await Tenant.query()
|
||||
.findById(tenantId)
|
||||
.withGraphFetched('metadata');
|
||||
|
||||
return [
|
||||
{
|
||||
mail: config.mail.from,
|
||||
label: tenant.metadata.name,
|
||||
primary: true,
|
||||
}
|
||||
].filter((item) => item.mail)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user