forked from wangziqi/gongxue-base
feat: add Notification entity
This commit is contained in:
@@ -22,3 +22,5 @@ export { AttendanceRecord } from './attendance-record.entity';
|
|||||||
export { DingAttendanceRaw } from './ding-attendance-raw.entity';
|
export { DingAttendanceRaw } from './ding-attendance-raw.entity';
|
||||||
export { SyncLog } from './sync-log.entity';
|
export { SyncLog } from './sync-log.entity';
|
||||||
export { SyncState } from './sync-state.entity';
|
export { SyncState } from './sync-state.entity';
|
||||||
|
export { ExpenseType } from './expense-type.entity';
|
||||||
|
export { Notification, NotificationType } from './notification.entity';
|
||||||
|
|||||||
55
apps/server/src/entities/notification.entity.ts
Normal file
55
apps/server/src/entities/notification.entity.ts
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
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;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user