vr-models 1.0.53 → 1.0.55
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.
|
@@ -4,6 +4,7 @@ import type { SecurityClearance } from "./securityClearance.models";
|
|
|
4
4
|
import type { PhoneContact } from "./phoneContact.models";
|
|
5
5
|
import { Ban } from "./ban.models";
|
|
6
6
|
import { Suspension } from "./suspension.models";
|
|
7
|
+
import { DevicePaymentPlan } from "./devicePaymentPlan.models";
|
|
7
8
|
export interface DeletionStatus {
|
|
8
9
|
deleted: boolean;
|
|
9
10
|
deletedAt?: Date | null;
|
|
@@ -64,6 +65,7 @@ export declare class User extends Model<InferAttributes<User>, InferCreationAttr
|
|
|
64
65
|
deletion: CreationOptional<DeletionStatus>;
|
|
65
66
|
readonly createdAt: CreationOptional<Date>;
|
|
66
67
|
payments?: NonAttribute<Payment[]>;
|
|
68
|
+
paymentPlans?: NonAttribute<DevicePaymentPlan[]>;
|
|
67
69
|
securityClearance?: NonAttribute<SecurityClearance>;
|
|
68
70
|
primaryPhone?: NonAttribute<PhoneContact>;
|
|
69
71
|
phones?: NonAttribute<PhoneContact[]>;
|
|
@@ -119,6 +119,12 @@ class User extends vr_migrations_1.Model {
|
|
|
119
119
|
onDelete: "SET NULL",
|
|
120
120
|
onUpdate: "CASCADE",
|
|
121
121
|
});
|
|
122
|
+
this.hasMany(models.DevicePaymentPlan, {
|
|
123
|
+
foreignKey: "userId",
|
|
124
|
+
as: "paymentPlans",
|
|
125
|
+
onDelete: "CASCADE", // ← This is SET NULL, not CASCADE
|
|
126
|
+
onUpdate: "CASCADE",
|
|
127
|
+
});
|
|
122
128
|
this.hasMany(models.Payment, {
|
|
123
129
|
foreignKey: "userId",
|
|
124
130
|
as: "payments",
|
|
@@ -154,6 +160,7 @@ class User extends vr_migrations_1.Model {
|
|
|
154
160
|
}
|
|
155
161
|
async deactivate() {
|
|
156
162
|
this.isDeactivated = true;
|
|
163
|
+
this.isActive = false;
|
|
157
164
|
this.deactivatedAt = new Date();
|
|
158
165
|
await this.save();
|
|
159
166
|
}
|