chore: 2fa added

This commit is contained in:
mahyargdz
2025-07-26 16:12:58 +03:30
parent e921b00da2
commit c6defaa1d8
9 changed files with 301 additions and 31 deletions
+4 -19
View File
@@ -8,18 +8,6 @@ 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 {
@@ -63,15 +51,12 @@ 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;
// Two-Factor Authentication fields
@Property({ type: "boolean", default: false })
is2FAEnabled: boolean & Opt;
@Property({ type: "timestamptz", nullable: true })
lastPushNotificationAt?: Date;
twoFactorEnabledAt?: Date;
//=========================