forked from wangziqi/gongxue-base
56 lines
1.2 KiB
TypeScript
56 lines
1.2 KiB
TypeScript
import {
|
|
Entity,
|
|
PrimaryGeneratedColumn,
|
|
Column,
|
|
CreateDateColumn,
|
|
ManyToOne,
|
|
JoinColumn,
|
|
} from 'typeorm';
|
|
import { User } from './user.entity';
|
|
|
|
export enum NotificationType {
|
|
BILL_GENERATED = 'bill_generated',
|
|
BILL_PAID = 'bill_paid',
|
|
CHECK_IN = 'check_in',
|
|
CHECK_OUT = 'check_out',
|
|
DEPOSIT_DUE = 'deposit_due',
|
|
DEPOSIT_REFUNDED = 'deposit_refunded',
|
|
CLASS_CHANGE = 'class_change',
|
|
SCHEDULE_CONFLICT = 'schedule_conflict',
|
|
ANNOUNCEMENT = 'announcement',
|
|
}
|
|
|
|
@Entity('notifications')
|
|
export class Notification {
|
|
@PrimaryGeneratedColumn()
|
|
id: number;
|
|
|
|
@Column({ name: 'recipient_id', type: 'integer' })
|
|
recipientId: number;
|
|
|
|
@ManyToOne(() => User, { onDelete: 'CASCADE' })
|
|
@JoinColumn({ name: 'recipient_id' })
|
|
recipient: User;
|
|
|
|
@Column({ name: 'type', length: 30 })
|
|
type: string;
|
|
|
|
@Column({ name: 'title', length: 200 })
|
|
title: string;
|
|
|
|
@Column({ name: 'content', type: 'text', nullable: true })
|
|
content: string;
|
|
|
|
@Column({ name: 'link', length: 500, nullable: true })
|
|
link: string;
|
|
|
|
@Column({ name: 'is_read', type: 'boolean', default: false })
|
|
isRead: boolean;
|
|
|
|
@Column({ name: 'read_at', type: 'datetime', nullable: true })
|
|
readAt: Date;
|
|
|
|
@CreateDateColumn({ name: 'created_at' })
|
|
createdAt: Date;
|
|
}
|