vr-models 1.0.25 → 1.0.27
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.
|
@@ -15,6 +15,7 @@ export interface BanAttributes {
|
|
|
15
15
|
revocationReason?: string;
|
|
16
16
|
user: User;
|
|
17
17
|
admin: User;
|
|
18
|
+
revokingAdmin?: User;
|
|
18
19
|
}
|
|
19
20
|
export interface BanCreationAttributes extends Omit<BanAttributes, "id" | "createdAt" | "updatedAt"> {
|
|
20
21
|
id?: string;
|
|
@@ -34,6 +35,7 @@ export declare class Ban extends Model<InferAttributes<Ban>, InferCreationAttrib
|
|
|
34
35
|
revocationReason: CreationOptional<string | undefined>;
|
|
35
36
|
user: NonAttribute<User>;
|
|
36
37
|
admin: NonAttribute<User>;
|
|
38
|
+
revokingAdmin?: NonAttribute<User>;
|
|
37
39
|
static initialize(sequelize: any): void;
|
|
38
40
|
static associate(models: Record<string, ModelStatic<Model>>): void;
|
|
39
41
|
}
|
|
@@ -80,6 +80,12 @@ class Ban extends vr_migrations_1.Model {
|
|
|
80
80
|
onDelete: "CASCADE",
|
|
81
81
|
onUpdate: "CASCADE",
|
|
82
82
|
});
|
|
83
|
+
this.belongsTo(models.User, {
|
|
84
|
+
foreignKey: "revokedBy",
|
|
85
|
+
as: "revokingAdmin",
|
|
86
|
+
onDelete: "CASCADE",
|
|
87
|
+
onUpdate: "CASCADE",
|
|
88
|
+
});
|
|
83
89
|
}
|
|
84
90
|
}
|
|
85
91
|
exports.Ban = Ban;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Model, InferAttributes, InferCreationAttributes, CreationOptional, NonAttribute, ModelStatic } from "vr-migrations";
|
|
2
2
|
import type { User } from "./user.models";
|
|
3
|
+
import { UserRole } from "./securityClearance.models";
|
|
3
4
|
export declare const EVENT_ACTIONS: readonly ["USER_READ", "USER_CREATED", "USER_UPDATED", "USER_DELETED", "USER_SUSPENDED", "USER_BANNED", "USERS_LISTED", "ADMIN_FORGOT_PASSWORD", "ADMIN_LOGGED_IN", "ADMIN_LOGGED_OUT", "PASSENGER_ACCOUNT_DEACTIVATED", "PASSENGER_ACCOUNT_DELETED", "AGENT_CREATED_RIDER", "AGENT_UPDATED_RIDER", "ADMIN_CREATED_USER", "ADMIN_UPDATED_USER", "SUPER_ADMIN_PASSWORD_CHANGED", "SUPER_ADMIN_CHANGED_USER_ACCOUNT_STATUS", "SUPER_ADMIN_UPDATED_USER", "SUPER_ADMIN_CREATED_USER", "PRODUCT_CREATED", "PRODUCT_READ", "PRODUCT_UPDATED", "PRODUCT_DELETED", "PRODUCTS_LISTED", "PRODUCTS_ACTIVATED", "PRODUCTS_DEACTIVATED", "PRODUCTS_LISTED", "PRODUCT_STOCK_SET_MANUALLY", "PRODUCT_STOCK_INCREMENTED", "PRODUCT_STOCK_DECREMENTED", "PRICING_CREATED", "PRICING_READ", "PRICING_UPDATED", "PRICING_DELETED", "DEVICE_CREATED", "DEVICES_BULK_CREATED", "DEVICE_ASSIGNED", "DEVICE_READ", "DEVICE_UPDATED", "DEVICES_LISTED", "DEVICE_LOCKED", "DEVICE_UNLOCKED", "DEVICE_DISABLED", "DEVICE_REACTIVATED", "DEVICE_DELETED_PERMANENTLY", "DEVICE_REPOSSESSED", "DEVICE_PAYMENT_PLAN_CREATED", "DEVICE_PAYMENT_PLAN_READ", "DEVICE_PAYMENT_PLAN_UPDATED", "DEVICE_PAYMENT_PLAN_MARKED_DEFAULTED", "DEVICE_PAYMENT_PLAN_SOFT_DELETED", "DEVICE_PAYMENT_PLAN_DELETED_PERMANENTLY", "PAYMENT_RECORDED", "PAYMENT_READ", "PAYMENTS_LISTED", "TRANSACTION_READ", "TRANSACTIONS_LISTED", "EVENT_LOG_READ", "EVENT_LOGS_LISTED", "SECURITY_CLEARANCE_MANAGED", "DEVICE_LOCK_OVERRIDDEN"];
|
|
4
5
|
export type EventAction = (typeof EVENT_ACTIONS)[number];
|
|
5
|
-
export type EventActorType = "USER" | "SYSTEM";
|
|
6
6
|
export interface EventLogAttributes {
|
|
7
7
|
id: string;
|
|
8
|
-
actorType:
|
|
8
|
+
actorType: UserRole;
|
|
9
9
|
actorId: string | null;
|
|
10
10
|
action: EventAction;
|
|
11
11
|
entity: string;
|
|
@@ -19,11 +19,11 @@ export interface EventLogAttributes {
|
|
|
19
19
|
export interface EventLogCreationAttributes extends Omit<EventLogAttributes, "id" | "createdAt" | "metadata" | "actorType"> {
|
|
20
20
|
id?: string;
|
|
21
21
|
metadata?: Record<string, any>;
|
|
22
|
-
actorType
|
|
22
|
+
actorType: UserRole;
|
|
23
23
|
}
|
|
24
24
|
export declare class EventLog extends Model<InferAttributes<EventLog>, InferCreationAttributes<EventLog>> implements EventLogAttributes {
|
|
25
25
|
id: CreationOptional<string>;
|
|
26
|
-
actorType:
|
|
26
|
+
actorType: UserRole;
|
|
27
27
|
actorId: CreationOptional<string | null>;
|
|
28
28
|
action: EventAction;
|
|
29
29
|
entity: string;
|
|
@@ -79,7 +79,7 @@ class EventLog extends vr_migrations_1.Model {
|
|
|
79
79
|
actorType: {
|
|
80
80
|
type: vr_migrations_1.DataTypes.ENUM("RIDER", "PASSENGER", "AGENT", "ADMIN", "SUPER_ADMIN"),
|
|
81
81
|
allowNull: false,
|
|
82
|
-
defaultValue: "
|
|
82
|
+
defaultValue: "ADMIN",
|
|
83
83
|
},
|
|
84
84
|
actorId: {
|
|
85
85
|
type: vr_migrations_1.DataTypes.UUID,
|