mirror of
https://github.com/immich-app/immich.git
synced 2025-12-17 17:23:20 +03:00
feat: notifications (#17701)
* feat: notifications * UI works * chore: pr feedback * initial fetch and clear notification upon logging out * fix: merge --------- Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
This commit is contained in:
52
server/src/schema/tables/notification.table.ts
Normal file
52
server/src/schema/tables/notification.table.ts
Normal file
@@ -0,0 +1,52 @@
|
||||
import { UpdatedAtTrigger, UpdateIdColumn } from 'src/decorators';
|
||||
import { NotificationLevel, NotificationType } from 'src/enum';
|
||||
import { UserTable } from 'src/schema/tables/user.table';
|
||||
import {
|
||||
Column,
|
||||
CreateDateColumn,
|
||||
DeleteDateColumn,
|
||||
ForeignKeyColumn,
|
||||
PrimaryGeneratedColumn,
|
||||
Table,
|
||||
UpdateDateColumn,
|
||||
} from 'src/sql-tools';
|
||||
|
||||
@Table('notifications')
|
||||
@UpdatedAtTrigger('notifications_updated_at')
|
||||
export class NotificationTable {
|
||||
@PrimaryGeneratedColumn()
|
||||
id!: string;
|
||||
|
||||
@CreateDateColumn()
|
||||
createdAt!: Date;
|
||||
|
||||
@UpdateDateColumn()
|
||||
updatedAt!: Date;
|
||||
|
||||
@DeleteDateColumn()
|
||||
deletedAt?: Date;
|
||||
|
||||
@UpdateIdColumn({ indexName: 'IDX_notifications_update_id' })
|
||||
updateId?: string;
|
||||
|
||||
@ForeignKeyColumn(() => UserTable, { onDelete: 'CASCADE', onUpdate: 'CASCADE', nullable: true })
|
||||
userId!: string;
|
||||
|
||||
@Column({ default: NotificationLevel.Info })
|
||||
level!: NotificationLevel;
|
||||
|
||||
@Column({ default: NotificationLevel.Info })
|
||||
type!: NotificationType;
|
||||
|
||||
@Column({ type: 'jsonb', nullable: true })
|
||||
data!: any | null;
|
||||
|
||||
@Column()
|
||||
title!: string;
|
||||
|
||||
@Column({ type: 'text', nullable: true })
|
||||
description!: string;
|
||||
|
||||
@Column({ type: 'timestamp with time zone', nullable: true })
|
||||
readAt?: Date | null;
|
||||
}
|
||||
Reference in New Issue
Block a user