vr-models 1.0.58 → 1.0.60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -2,6 +2,8 @@ import { Model, InferAttributes, InferCreationAttributes, CreationOptional, NonA
|
|
|
2
2
|
import type { User } from "./user.models";
|
|
3
3
|
export declare const CONTACT_TYPES: readonly ["EMAIL", "PHONE", "WHATSAPP"];
|
|
4
4
|
export type ContactType = (typeof CONTACT_TYPES)[number];
|
|
5
|
+
export declare const VERIFICATION_METHODS: readonly ["OTP", "0AUTH", "EMAIL", "MANUAL"];
|
|
6
|
+
export type VerificationMethod = (typeof VERIFICATION_METHODS)[number];
|
|
5
7
|
export interface VerificationMetadata {
|
|
6
8
|
lastOtpSentAt?: Date;
|
|
7
9
|
otpAttempts?: number;
|
|
@@ -22,6 +24,7 @@ export interface ContactAttributes {
|
|
|
22
24
|
userId: string | null;
|
|
23
25
|
isVerified: boolean;
|
|
24
26
|
verifiedAt: Date | null;
|
|
27
|
+
verificationMethod: VerificationMethod;
|
|
25
28
|
isPrimary: boolean;
|
|
26
29
|
isActive: boolean;
|
|
27
30
|
otp: string | null;
|
|
@@ -39,6 +42,7 @@ export declare class Contact extends Model<InferAttributes<Contact>, InferCreati
|
|
|
39
42
|
id: CreationOptional<string>;
|
|
40
43
|
contactValue: string;
|
|
41
44
|
type: ContactType;
|
|
45
|
+
verificationMethod: VerificationMethod;
|
|
42
46
|
userId: CreationOptional<string | null>;
|
|
43
47
|
isVerified: CreationOptional<boolean>;
|
|
44
48
|
verifiedAt: CreationOptional<Date | null>;
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Contact = exports.CONTACT_TYPES = void 0;
|
|
3
|
+
exports.Contact = exports.VERIFICATION_METHODS = exports.CONTACT_TYPES = void 0;
|
|
4
4
|
// src/models/contact.models.ts
|
|
5
5
|
const vr_migrations_1 = require("vr-migrations");
|
|
6
6
|
// ==================== CONTACT TYPES ====================
|
|
7
7
|
exports.CONTACT_TYPES = ["EMAIL", "PHONE", "WHATSAPP"];
|
|
8
|
+
exports.VERIFICATION_METHODS = [
|
|
9
|
+
"OTP",
|
|
10
|
+
"0AUTH",
|
|
11
|
+
"EMAIL",
|
|
12
|
+
"MANUAL",
|
|
13
|
+
];
|
|
8
14
|
class Contact extends vr_migrations_1.Model {
|
|
9
15
|
// Static initialization method
|
|
10
16
|
static initialize(sequelize) {
|
|
@@ -20,7 +26,11 @@ class Contact extends vr_migrations_1.Model {
|
|
|
20
26
|
allowNull: false,
|
|
21
27
|
},
|
|
22
28
|
type: {
|
|
23
|
-
type: vr_migrations_1.DataTypes.ENUM(
|
|
29
|
+
type: vr_migrations_1.DataTypes.ENUM(...exports.CONTACT_TYPES),
|
|
30
|
+
allowNull: false,
|
|
31
|
+
},
|
|
32
|
+
verificationMethod: {
|
|
33
|
+
type: vr_migrations_1.DataTypes.ENUM(...exports.VERIFICATION_METHODS),
|
|
24
34
|
allowNull: false,
|
|
25
35
|
},
|
|
26
36
|
userId: {
|
|
@@ -42,6 +42,7 @@ export interface UserAttributes {
|
|
|
42
42
|
bans?: Ban[];
|
|
43
43
|
suspensions?: Suspension[];
|
|
44
44
|
devices?: Device[];
|
|
45
|
+
registeredBy?: string | null;
|
|
45
46
|
}
|
|
46
47
|
export interface UserCreationAttributes extends Omit<UserAttributes, "id" | "createdAt" | "isActive" | "forgotPassword" | "isDeactivated" | "tokenVersion" | "primaryContactId"> {
|
|
47
48
|
id?: string;
|
|
@@ -79,6 +80,7 @@ export declare class User extends Model<InferAttributes<User>, InferCreationAttr
|
|
|
79
80
|
contacts?: NonAttribute<Contact[]>;
|
|
80
81
|
bans?: NonAttribute<Ban[]>;
|
|
81
82
|
suspensions?: NonAttribute<Suspension[]>;
|
|
83
|
+
registeredBy?: CreationOptional<string | null>;
|
|
82
84
|
static initialize(sequelize: any): void;
|
|
83
85
|
static associate(models: Record<string, ModelStatic<Model>>): void;
|
|
84
86
|
softDelete(deletedBy: string, reason?: string): Promise<void>;
|
|
@@ -75,6 +75,10 @@ class User extends vr_migrations_1.Model {
|
|
|
75
75
|
type: vr_migrations_1.DataTypes.UUID,
|
|
76
76
|
allowNull: true,
|
|
77
77
|
},
|
|
78
|
+
registeredBy: {
|
|
79
|
+
type: vr_migrations_1.DataTypes.UUID,
|
|
80
|
+
allowNull: true,
|
|
81
|
+
},
|
|
78
82
|
isActive: {
|
|
79
83
|
type: vr_migrations_1.DataTypes.BOOLEAN,
|
|
80
84
|
defaultValue: true,
|