vr-models 1.0.49 → 1.0.51

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.
@@ -79,19 +79,19 @@ class Ban extends vr_migrations_1.Model {
79
79
  this.belongsTo(models.User, {
80
80
  foreignKey: "userId",
81
81
  as: "user",
82
- onDelete: "CASCADE",
82
+ onDelete: "SET NULL", // ← This is SET NULL, not CASCADE
83
83
  onUpdate: "CASCADE",
84
84
  });
85
85
  this.belongsTo(models.User, {
86
86
  foreignKey: "adminId",
87
87
  as: "admin",
88
- onDelete: "CASCADE",
88
+ onDelete: "SET NULL", // ← This is SET NULL, not CASCADE
89
89
  onUpdate: "CASCADE",
90
90
  });
91
91
  this.belongsTo(models.User, {
92
92
  foreignKey: "revokedBy",
93
93
  as: "revokingAdmin",
94
- onDelete: "CASCADE",
94
+ onDelete: "SET NULL", // ← This is SET NULL, not CASCADE
95
95
  onUpdate: "CASCADE",
96
96
  });
97
97
  }
@@ -88,7 +88,7 @@ class DevicePaymentPlan extends vr_migrations_1.Model {
88
88
  this.hasMany(models.Installment, {
89
89
  foreignKey: "devicePaymentPlanId",
90
90
  as: "installments",
91
- onDelete: "CASCADE",
91
+ onDelete: "SET NULL", // ← This is SET NULL, not CASCADE
92
92
  onUpdate: "CASCADE",
93
93
  });
94
94
  }
@@ -106,7 +106,7 @@ class Installment extends vr_migrations_1.Model {
106
106
  this.belongsTo(models.DevicePaymentPlan, {
107
107
  foreignKey: "devicePaymentPlanId",
108
108
  as: "paymentPlan",
109
- onDelete: "CASCADE",
109
+ onDelete: "SET NULL", // ← This is SET NULL, not CASCADE
110
110
  onUpdate: "CASCADE",
111
111
  });
112
112
  this.belongsTo(models.Payment, {
@@ -63,6 +63,8 @@ class PhoneContact extends vr_migrations_1.Model {
63
63
  defaultValue: {
64
64
  otpAttempts: 0,
65
65
  isLocked: false,
66
+ lockedUntil: null,
67
+ lastFailedAttemptAt: null,
66
68
  },
67
69
  },
68
70
  createdAt: {
@@ -72,7 +72,7 @@ class Pricing extends vr_migrations_1.Model {
72
72
  this.belongsTo(models.Product, {
73
73
  foreignKey: "productId",
74
74
  as: "product",
75
- onDelete: "CASCADE",
75
+ onDelete: "SET NULL", // ← This is SET NULL, not CASCADE
76
76
  onUpdate: "CASCADE",
77
77
  });
78
78
  }
@@ -34,7 +34,7 @@ class Product extends vr_migrations_1.Model {
34
34
  this.hasMany(models.Pricing, {
35
35
  foreignKey: "productId",
36
36
  as: "pricings",
37
- onDelete: "CASCADE",
37
+ onDelete: "SET NULL", // ← This is SET NULL, not CASCADE
38
38
  onUpdate: "CASCADE",
39
39
  });
40
40
  this.hasMany(models.Device, {
@@ -85,19 +85,19 @@ class Suspension extends vr_migrations_1.Model {
85
85
  this.belongsTo(models.User, {
86
86
  foreignKey: "userId",
87
87
  as: "user",
88
- onDelete: "CASCADE",
88
+ onDelete: "SET NULL", // ← This is SET NULL, not CASCADE
89
89
  onUpdate: "CASCADE",
90
90
  });
91
91
  this.belongsTo(models.User, {
92
92
  foreignKey: "adminId",
93
93
  as: "admin",
94
- onDelete: "CASCADE",
94
+ onDelete: "SET NULL", // ← This is SET NULL, not CASCADE
95
95
  onUpdate: "CASCADE",
96
96
  });
97
97
  this.belongsTo(models.User, {
98
98
  foreignKey: "revokedBy",
99
99
  as: "revokingAdmin",
100
- onDelete: "CASCADE",
100
+ onDelete: "SET NULL", // ← This is SET NULL, not CASCADE
101
101
  onUpdate: "CASCADE",
102
102
  });
103
103
  }
@@ -42,7 +42,7 @@ class Transaction extends vr_migrations_1.Model {
42
42
  this.belongsTo(models.Payment, {
43
43
  foreignKey: "paymentId",
44
44
  as: "payment",
45
- onDelete: "CASCADE",
45
+ onDelete: "SET NULL", // ← This is SET NULL, not CASCADE
46
46
  onUpdate: "CASCADE",
47
47
  });
48
48
  this.belongsTo(models.User, {
@@ -122,25 +122,25 @@ class User extends vr_migrations_1.Model {
122
122
  this.hasMany(models.Device, {
123
123
  foreignKey: "userId",
124
124
  as: "devices",
125
- onDelete: "CASCADE",
125
+ onDelete: "SET NULL", // ← This is SET NULL, not CASCADE
126
126
  onUpdate: "CASCADE",
127
127
  });
128
128
  this.hasMany(models.Payment, {
129
129
  foreignKey: "userId",
130
130
  as: "payments",
131
- onDelete: "CASCADE",
131
+ onDelete: "SET NULL", // ← This is SET NULL, not CASCADE
132
132
  onUpdate: "CASCADE",
133
133
  });
134
134
  this.hasMany(models.Suspension, {
135
135
  foreignKey: "userId",
136
136
  as: "suspensions",
137
- onDelete: "CASCADE",
137
+ onDelete: "SET NULL", // ← This is SET NULL, not CASCADE
138
138
  onUpdate: "CASCADE",
139
139
  });
140
140
  this.hasMany(models.Ban, {
141
141
  foreignKey: "userId",
142
142
  as: "bans",
143
- onDelete: "CASCADE",
143
+ onDelete: "SET NULL", // ← This is SET NULL, not CASCADE
144
144
  onUpdate: "CASCADE",
145
145
  });
146
146
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vr-models",
3
- "version": "1.0.49",
3
+ "version": "1.0.51",
4
4
  "description": "Shared database models package for VR applications",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",