vr-models 1.0.21 → 1.0.22
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 { Device } from "./device.models";
|
|
3
3
|
import type { Payment } from "./payment.models";
|
|
4
4
|
import type { SecurityClearance } from "./securityClearance.models";
|
|
5
|
+
import { Ban } from "./ban.models";
|
|
6
|
+
import { Suspension } from "./suspension.models";
|
|
5
7
|
export interface DeletionStatus {
|
|
6
8
|
deleted: boolean;
|
|
7
9
|
deletedAt?: Date | null;
|
|
@@ -20,11 +22,6 @@ export interface UserAttributes {
|
|
|
20
22
|
plateNumber: string | null;
|
|
21
23
|
nationalId: string;
|
|
22
24
|
isActive: boolean;
|
|
23
|
-
isSuspended: boolean;
|
|
24
|
-
bannedAt: Date | null;
|
|
25
|
-
banReason: string | null;
|
|
26
|
-
suspendedAt: Date | null;
|
|
27
|
-
suspensionReason: string | null;
|
|
28
25
|
forgotPassword: boolean;
|
|
29
26
|
otp: string | null;
|
|
30
27
|
otpExpiresAt: Date | null;
|
|
@@ -37,6 +34,8 @@ export interface UserAttributes {
|
|
|
37
34
|
devices?: Device[];
|
|
38
35
|
payments?: Payment[];
|
|
39
36
|
securityClearance?: SecurityClearance;
|
|
37
|
+
bans?: Ban[];
|
|
38
|
+
suspensions?: Suspension[];
|
|
40
39
|
}
|
|
41
40
|
export interface UserCreationAttributes extends Omit<UserAttributes, "id" | "createdAt" | "isActive" | "isSuspended" | "forgotPassword" | "isDeactivated" | "tokenVersion"> {
|
|
42
41
|
id?: string;
|
|
@@ -82,10 +81,6 @@ export declare class User extends Model<InferAttributes<User>, InferCreationAttr
|
|
|
82
81
|
generateOTP(): Promise<string>;
|
|
83
82
|
clearOTP(): Promise<void>;
|
|
84
83
|
validateOTP(otp: string): Promise<boolean>;
|
|
85
|
-
suspend(reason: string): Promise<void>;
|
|
86
|
-
unsuspend(): Promise<void>;
|
|
87
|
-
ban(reason: string): Promise<void>;
|
|
88
|
-
unban(): Promise<void>;
|
|
89
84
|
deactivate(): Promise<void>;
|
|
90
85
|
activate(): Promise<void>;
|
|
91
86
|
}
|
|
@@ -199,28 +199,6 @@ class User extends vr_migrations_1.Model {
|
|
|
199
199
|
}
|
|
200
200
|
return new Date() < this.otpExpiresAt;
|
|
201
201
|
}
|
|
202
|
-
async suspend(reason) {
|
|
203
|
-
this.isSuspended = true;
|
|
204
|
-
this.suspendedAt = new Date();
|
|
205
|
-
this.suspensionReason = reason;
|
|
206
|
-
await this.save();
|
|
207
|
-
}
|
|
208
|
-
async unsuspend() {
|
|
209
|
-
this.isSuspended = false;
|
|
210
|
-
this.suspendedAt = null;
|
|
211
|
-
this.suspensionReason = null;
|
|
212
|
-
await this.save();
|
|
213
|
-
}
|
|
214
|
-
async ban(reason) {
|
|
215
|
-
this.bannedAt = new Date();
|
|
216
|
-
this.banReason = reason;
|
|
217
|
-
await this.save();
|
|
218
|
-
}
|
|
219
|
-
async unban() {
|
|
220
|
-
this.bannedAt = null;
|
|
221
|
-
this.banReason = null;
|
|
222
|
-
await this.save();
|
|
223
|
-
}
|
|
224
202
|
async deactivate() {
|
|
225
203
|
this.isDeactivated = true;
|
|
226
204
|
this.deactivatedAt = new Date();
|