mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 04:40:32 +00:00
25 lines
551 B
TypeScript
25 lines
551 B
TypeScript
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)
|
|
}
|
|
} |