Files
keyvault/api/src/model/entitites/log/email.log.entity.ts
2026-02-19 12:21:30 +01:00

45 lines
807 B
TypeScript

import {
AfterLoad,
Column,
CreateDateColumn,
Entity,
ManyToOne,
PrimaryGeneratedColumn,
} from 'typeorm';
import { KeySystem } from '../system.entity';
import { EmailEvent } from 'src/modules/log/log.service';
@Entity()
export class EmailLog {
@PrimaryGeneratedColumn('uuid')
id: string;
@CreateDateColumn({ name: 'created_at' })
createdAt: Date;
@Column({ type: 'text'})
to: string;
@Column({ type: 'text'})
message: string;
@Column({ name: 'type', type: 'text',})
type: EmailEvent;
eventName: string;
@ManyToOne(() => KeySystem, { nullable: true })
system: KeySystem;
@Column({type: 'boolean'})
success: boolean;
@Column({type: 'text', default: null})
context: boolean;
@AfterLoad()
setType() {
this.eventName = EmailEvent[this.type]
}
}