agrs-sequelize-sdk 1.2.70 → 1.2.72
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.
- package/models/Rule.js +3 -28
- package/models/RuleAction.js +2 -12
- package/models/RuleCondition.js +2 -15
- package/models/RuleExecution.js +2 -15
- package/package.json +1 -1
package/models/Rule.js
CHANGED
|
@@ -2,7 +2,7 @@ const { DataTypes } = require("sequelize");
|
|
|
2
2
|
|
|
3
3
|
module.exports = (sequelize) => {
|
|
4
4
|
const Rule = sequelize.define(
|
|
5
|
-
"
|
|
5
|
+
"AutomationRule", // Change model name to avoid conflict
|
|
6
6
|
{
|
|
7
7
|
id: {
|
|
8
8
|
type: DataTypes.UUID,
|
|
@@ -35,7 +35,7 @@ module.exports = (sequelize) => {
|
|
|
35
35
|
type: DataTypes.UUID,
|
|
36
36
|
allowNull: true,
|
|
37
37
|
references: {
|
|
38
|
-
model: "
|
|
38
|
+
model: "RulesValues",
|
|
39
39
|
key: "id",
|
|
40
40
|
},
|
|
41
41
|
onDelete: "CASCADE",
|
|
@@ -122,32 +122,7 @@ module.exports = (sequelize) => {
|
|
|
122
122
|
{
|
|
123
123
|
tableName: "RulesValues", // Use the existing table name
|
|
124
124
|
timestamps: true,
|
|
125
|
-
indexes
|
|
126
|
-
{
|
|
127
|
-
fields: ["code"],
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
fields: ["feature"],
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
fields: ["parentId"],
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
fields: ["isActive"],
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
fields: ["ruleType"],
|
|
140
|
-
},
|
|
141
|
-
{
|
|
142
|
-
fields: ["targetLevel"],
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
fields: ["scheduleType"],
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
fields: ["nextExecution"],
|
|
149
|
-
},
|
|
150
|
-
],
|
|
125
|
+
// Remove indexes from model definition - they will be created by migration
|
|
151
126
|
}
|
|
152
127
|
);
|
|
153
128
|
|
package/models/RuleAction.js
CHANGED
|
@@ -71,23 +71,13 @@ module.exports = (sequelize) => {
|
|
|
71
71
|
{
|
|
72
72
|
tableName: "RuleActions",
|
|
73
73
|
timestamps: true,
|
|
74
|
-
indexes
|
|
75
|
-
{
|
|
76
|
-
fields: ["ruleId"],
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
fields: ["actionType"],
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
fields: ["order"],
|
|
83
|
-
},
|
|
84
|
-
],
|
|
74
|
+
// Remove indexes from model definition - they will be created by migration
|
|
85
75
|
}
|
|
86
76
|
);
|
|
87
77
|
|
|
88
78
|
RuleAction.associate = (models) => {
|
|
89
79
|
// An action belongs to a rule
|
|
90
|
-
RuleAction.belongsTo(models.
|
|
80
|
+
RuleAction.belongsTo(models.AutomationRule, {
|
|
91
81
|
foreignKey: "ruleId",
|
|
92
82
|
as: "rule",
|
|
93
83
|
});
|
package/models/RuleCondition.js
CHANGED
|
@@ -70,26 +70,13 @@ module.exports = (sequelize) => {
|
|
|
70
70
|
{
|
|
71
71
|
tableName: "RuleConditions",
|
|
72
72
|
timestamps: true,
|
|
73
|
-
indexes
|
|
74
|
-
{
|
|
75
|
-
fields: ["ruleId"],
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
fields: ["field"],
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
fields: ["operator"],
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
fields: ["order"],
|
|
85
|
-
},
|
|
86
|
-
],
|
|
73
|
+
// Remove indexes from model definition - they will be created by migration
|
|
87
74
|
}
|
|
88
75
|
);
|
|
89
76
|
|
|
90
77
|
RuleCondition.associate = (models) => {
|
|
91
78
|
// A condition belongs to a rule
|
|
92
|
-
RuleCondition.belongsTo(models.
|
|
79
|
+
RuleCondition.belongsTo(models.AutomationRule, {
|
|
93
80
|
foreignKey: "ruleId",
|
|
94
81
|
as: "rule",
|
|
95
82
|
});
|
package/models/RuleExecution.js
CHANGED
|
@@ -86,26 +86,13 @@ module.exports = (sequelize) => {
|
|
|
86
86
|
{
|
|
87
87
|
tableName: "RuleExecutions",
|
|
88
88
|
timestamps: true,
|
|
89
|
-
indexes
|
|
90
|
-
{
|
|
91
|
-
fields: ["ruleId"],
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
fields: ["status"],
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
fields: ["startTime"],
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
fields: ["executionType"],
|
|
101
|
-
},
|
|
102
|
-
],
|
|
89
|
+
// Remove indexes from model definition - they will be created by migration
|
|
103
90
|
}
|
|
104
91
|
);
|
|
105
92
|
|
|
106
93
|
RuleExecution.associate = (models) => {
|
|
107
94
|
// An execution belongs to a rule
|
|
108
|
-
RuleExecution.belongsTo(models.
|
|
95
|
+
RuleExecution.belongsTo(models.AutomationRule, {
|
|
109
96
|
foreignKey: "ruleId",
|
|
110
97
|
as: "rule",
|
|
111
98
|
});
|