vr-models 1.0.20 → 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.
@@ -9,4 +9,6 @@ export * from "./product.models";
9
9
  export * from "./securityClearance.models";
10
10
  export * from "./transaction.models";
11
11
  export * from "./installment.models";
12
- export type { UserModel, TransactionModel, SecurityClearanceModel, ProductModel, PricingModel, PaymentModel, IdempotencyRecordModel, EventLogModel, DevicePaymentPlanModel, DeviceModel, InstallmentModel, } from "./types";
12
+ export * from "./ban.models";
13
+ export * from "./suspension.models";
14
+ export type { UserModel, TransactionModel, SecurityClearanceModel, ProductModel, PricingModel, PaymentModel, IdempotencyRecordModel, EventLogModel, DevicePaymentPlanModel, DeviceModel, InstallmentModel, BanModel, SuspensionModel, } from "./types";
@@ -25,3 +25,5 @@ __exportStar(require("./product.models"), exports);
25
25
  __exportStar(require("./securityClearance.models"), exports);
26
26
  __exportStar(require("./transaction.models"), exports);
27
27
  __exportStar(require("./installment.models"), exports);
28
+ __exportStar(require("./ban.models"), exports);
29
+ __exportStar(require("./suspension.models"), exports);
@@ -9,3 +9,5 @@ export type { EventLogModel } from "./eventLog.models";
9
9
  export type { DevicePaymentPlanModel } from "./devicePaymentPlan.models";
10
10
  export type { DeviceModel } from "./device.models";
11
11
  export type { InstallmentModel } from "./installment.models";
12
+ export type { BanModel } from "./ban.models";
13
+ export type { SuspensionModel } from "./suspension.models";
@@ -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();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vr-models",
3
- "version": "1.0.20",
3
+ "version": "1.0.22",
4
4
  "description": "Shared database models package for VR applications",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
File without changes
File without changes