import { Column , Entity , BeforeInsert , BeforeUpdate , PrimaryGeneratedColumn } from 'typeorm' ; import { BaseModel } from './BaseModel' ; import moment = require ( 'moment/moment' ) ; @ Entity ( 'email_template' ) export class EmailTemplate extends BaseModel { @ PrimaryGeneratedColumn ( { name : 'id' } ) public emailTemplateId : number ; @ Column ( { name : 'shortname' } ) public title : string ; @ Column ( { name : 'subject' } ) public subject : string ; @ Column ( { name : 'message' } ) public content : string ; @ Column ( { name : 'is_active' } ) public isActive : number ; @ BeforeInsert ( ) public async createDetails ( ) { this . createdDate = moment ( ) . format ( 'YYYY-MM-DD HH:mm:ss' ) ; } @ BeforeUpdate ( ) public async updateDetails ( ) { this . modifiedDate = moment ( ) . format ( 'YYYY-MM-DD HH:mm:ss' ) ; } }