20 lines
565 B
TypeScript
20 lines
565 B
TypeScript
import config from "config";
|
|
|
|
export default class MailTemplate {
|
|
private readonly _template: string;
|
|
private readonly subject: (data: { [p: string]: unknown }) => string;
|
|
|
|
public constructor(template: string, subject: (data: { [p: string]: unknown }) => string) {
|
|
this._template = template;
|
|
this.subject = subject;
|
|
}
|
|
|
|
public get template(): string {
|
|
return this._template;
|
|
}
|
|
|
|
public getSubject(data: { [p: string]: unknown }): string {
|
|
return `${config.get('app.name')} - ${this.subject(data)}`;
|
|
}
|
|
}
|