pwa notifications
This commit is contained in:
55
listify-api/src/tasks/task-push-subscription.entity.ts
Normal file
55
listify-api/src/tasks/task-push-subscription.entity.ts
Normal file
@@ -0,0 +1,55 @@
|
||||
import {
|
||||
Column,
|
||||
CreateDateColumn,
|
||||
Entity,
|
||||
Index,
|
||||
JoinColumn,
|
||||
ManyToOne,
|
||||
PrimaryColumn,
|
||||
UpdateDateColumn,
|
||||
} from 'typeorm';
|
||||
import { UserEntity } from '../auth/user.entity';
|
||||
|
||||
@Entity('task_push_subscriptions')
|
||||
export class TaskPushSubscriptionEntity {
|
||||
@PrimaryColumn({ type: 'varchar', length: 36 })
|
||||
id!: string;
|
||||
|
||||
@Index()
|
||||
@Column({ type: 'varchar', length: 36 })
|
||||
userId!: string;
|
||||
|
||||
@Index({ unique: true })
|
||||
@Column({ type: 'varchar', length: 512 })
|
||||
endpoint!: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 160 })
|
||||
p256dh!: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 80 })
|
||||
auth!: string;
|
||||
|
||||
@Column({ type: 'datetime', precision: 3, nullable: true })
|
||||
expiresAt?: Date | null;
|
||||
|
||||
@CreateDateColumn({
|
||||
type: 'datetime',
|
||||
precision: 3,
|
||||
default: () => 'CURRENT_TIMESTAMP(3)',
|
||||
})
|
||||
createdAt!: Date;
|
||||
|
||||
@UpdateDateColumn({
|
||||
type: 'datetime',
|
||||
precision: 3,
|
||||
default: () => 'CURRENT_TIMESTAMP(3)',
|
||||
onUpdate: 'CURRENT_TIMESTAMP(3)',
|
||||
})
|
||||
updatedAt!: Date;
|
||||
|
||||
@ManyToOne(() => UserEntity, (user) => user.taskPushSubscriptions, {
|
||||
onDelete: 'CASCADE',
|
||||
})
|
||||
@JoinColumn({ name: 'userId' })
|
||||
user?: UserEntity;
|
||||
}
|
||||
Reference in New Issue
Block a user