Mailservice
This commit is contained in:
37
api/src/modules/log/log.service.ts
Normal file
37
api/src/modules/log/log.service.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { EmailLogRepository } from 'src/model/repositories/log';
|
||||
|
||||
@Injectable()
|
||||
export class LogService {
|
||||
constructor(private readonly emailLogRepo: EmailLogRepository) {}
|
||||
|
||||
|
||||
|
||||
log(type: LogType, data: any) {
|
||||
if (type == LogType.Mail) {
|
||||
return this.logEmail(data);
|
||||
}
|
||||
}
|
||||
|
||||
private async logEmail(data: EmailLogDto) {
|
||||
const log = this.emailLogRepo.create(data);
|
||||
const logEntry = await this.emailLogRepo.save(log);
|
||||
console.log(logEntry);
|
||||
}
|
||||
}
|
||||
|
||||
export enum LogType {
|
||||
Mail
|
||||
}
|
||||
|
||||
export enum EmailEvent {
|
||||
GrantSystemAccess,
|
||||
RemoveSystemAccess
|
||||
}
|
||||
|
||||
export interface EmailLogDto {
|
||||
success: boolean;
|
||||
message: string;
|
||||
to: string;
|
||||
type: EmailEvent;
|
||||
}
|
||||
Reference in New Issue
Block a user