chore: push notification test
This commit is contained in:
@@ -8,6 +8,18 @@ import { Domain } from "../../domains/entities/domain.entity";
|
||||
import { Template } from "../../templates/entities/template.entity";
|
||||
import { UserRepository } from "../repositories/user.repository";
|
||||
|
||||
export interface WebPushSubscriptionData {
|
||||
endpoint: string;
|
||||
keys: {
|
||||
p256dh: string;
|
||||
auth: string;
|
||||
};
|
||||
deviceType?: string;
|
||||
deviceName?: string;
|
||||
registeredAt?: Date;
|
||||
updatedAt?: Date;
|
||||
}
|
||||
|
||||
@Entity({ repository: () => UserRepository })
|
||||
@Unique({ properties: ["userName", "domain"], name: "unique_user_name_domain", options: { where: "deleted_at is null" } })
|
||||
export class User extends BaseEntity {
|
||||
@@ -51,6 +63,16 @@ export class User extends BaseEntity {
|
||||
@Property({ default: true, nullable: false })
|
||||
isActive: boolean & Opt;
|
||||
|
||||
// Push notification fields - now stores web push subscription objects
|
||||
@Property({ type: "json", nullable: true })
|
||||
pushTokens?: WebPushSubscriptionData[];
|
||||
|
||||
@Property({ type: "boolean", default: true })
|
||||
pushNotificationsEnabled: boolean & Opt;
|
||||
|
||||
@Property({ type: "timestamptz", nullable: true })
|
||||
lastPushNotificationAt?: Date;
|
||||
|
||||
//=========================
|
||||
|
||||
@OneToMany(() => RefreshToken, (token) => token.user)
|
||||
|
||||
Reference in New Issue
Block a user