feat(server): contact mail notification service

This commit is contained in:
Ahmed Bouhuolia
2023-12-29 17:35:34 +02:00
parent 2a85fe2f3c
commit 0d15c16d40
17 changed files with 441 additions and 310 deletions

View 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)
}
}