import { Column , Entity , ManyToOne , PrimaryGeneratedColumn } from 'typeorm' ; import { NotificationTypeEnum } from '../enum/notification-type.enum' ; import { User } from '../../UserModule/entity/user.entity' ; import { Audit } from '../../CommonsModule/entity/audit.entity' ; @ Entity ( ) export class Notification < T = unknown > extends Audit { @ PrimaryGeneratedColumn ( 'uuid' ) id : string ; @ ManyToOne ( ( ) => User , ( user ) => user . notifications ) user : User ; @ Column ( { default : false , } ) seen : boolean = false ; @ Column ( { default : true , } ) enabled : boolean = true ; @ Column ( { default : false , } ) important : boolean = false ; @ Column ( { type : 'enum' , enum : NotificationTypeEnum , nullable : false , } ) type : NotificationTypeEnum ; @ Column ( { type : 'json' , nullable : false , } ) content : T ; }