agrs-sequelize-sdk 1.3.78 → 1.3.79

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.
Files changed (63) hide show
  1. package/migrations/add-requested-from-dashboard-to-articles.js +17 -17
  2. package/migrations/change-adset-name-to-text.js +79 -79
  3. package/models/AICampaignQueue.js +136 -136
  4. package/models/AIGenerationLog.js +85 -85
  5. package/models/AIGenerationRequest.js +212 -212
  6. package/models/AdAccountValues.js +25 -25
  7. package/models/AdHistory.js +30 -30
  8. package/models/AdPerformance.js +94 -94
  9. package/models/AdSet.js +289 -289
  10. package/models/AdSetHistory.js +30 -30
  11. package/models/AdsetPerformance.js +126 -126
  12. package/models/AiArticleRetryQueue.js +150 -150
  13. package/models/Article.js +196 -196
  14. package/models/AutomationRule.js +173 -173
  15. package/models/BannerTemplate.js +129 -129
  16. package/models/Buyers.js +25 -25
  17. package/models/Campaign.js +157 -157
  18. package/models/CampaignActionHistory.js +86 -86
  19. package/models/CampaignCreationLog.js +309 -309
  20. package/models/CampaignCreationLogV2.js +314 -314
  21. package/models/CampaignHistory.js +33 -33
  22. package/models/Channel.js +55 -55
  23. package/models/Domain.js +40 -35
  24. package/models/DynamicFeed.js +212 -212
  25. package/models/ExplorAdsChannel.js +61 -61
  26. package/models/Feed.js +33 -33
  27. package/models/FeedArticleConfiguration.js +80 -80
  28. package/models/FrontStoryChannel.js +59 -59
  29. package/models/FrontStoryChannelV2.js +60 -60
  30. package/models/GenericFlowRequest.js +114 -114
  31. package/models/MidoWebChannel.js +47 -47
  32. package/models/MineChannel.js +42 -42
  33. package/models/Pages.js +92 -92
  34. package/models/PipelineExecution.js +59 -59
  35. package/models/PolicyDogsCreativeCache.js +50 -50
  36. package/models/PolicyDogsImageCache.js +30 -30
  37. package/models/Presets.js +34 -34
  38. package/models/RSOCFeedCampaign.js +375 -375
  39. package/models/RsocKeywordPerformance.js +110 -110
  40. package/models/RuleAction.js +90 -90
  41. package/models/RuleCondition.js +137 -137
  42. package/models/RuleExecution.js +107 -107
  43. package/models/RulesValues.js +56 -56
  44. package/models/SupportedLocale.js +23 -23
  45. package/models/SyncHistory.js +249 -249
  46. package/models/TTQChannel.js +42 -42
  47. package/models/TemplateMetadata.js +260 -260
  48. package/models/Tier2_AdAccounts.js +110 -110
  49. package/models/Tier2_Assets.js +70 -70
  50. package/models/Tier2_BusinessManagers.js +105 -105
  51. package/models/Tier2_CreditLines.js +99 -99
  52. package/models/Tier2_Pages.js +91 -91
  53. package/models/Tier2_Pixels.js +82 -82
  54. package/models/Tier2_Tokens.js +64 -64
  55. package/models/Tier2_UserAdAccounts.js +83 -83
  56. package/models/TokenRotationState.js +121 -121
  57. package/models/TonicRSOCKeywordPerformance.js +122 -122
  58. package/models/Users.js +138 -138
  59. package/models/Vertical.js +25 -25
  60. package/models/newFiles.js +137 -137
  61. package/package.json +21 -19
  62. package/run.sh +214 -214
  63. package/services/sequelizeService.js +110 -110
@@ -1,111 +1,111 @@
1
- module.exports = (sequelize, DataTypes) => {
2
- const RsocKeywordPerformance = sequelize.define('RsocKeywordPerformance', {
3
- id: {
4
- type: DataTypes.INTEGER,
5
- primaryKey: true,
6
- autoIncrement: true,
7
- allowNull: false
8
- },
9
- ts: {
10
- type: DataTypes.DATE,
11
- allowNull: false,
12
- comment: 'Timestamp of the record'
13
- },
14
- channel_id: {
15
- type: DataTypes.STRING,
16
- allowNull: false,
17
- comment: 'Channel identifier'
18
- },
19
- style_id: {
20
- type: DataTypes.STRING,
21
- allowNull: true,
22
- comment: 'Style identifier'
23
- },
24
- country_code: {
25
- type: DataTypes.STRING(2),
26
- allowNull: true,
27
- comment: 'Country code (ISO 2-letter)'
28
- },
29
- custom_query: {
30
- type: DataTypes.TEXT,
31
- allowNull: true,
32
- comment: 'Custom search query'
33
- },
34
- query: {
35
- type: DataTypes.TEXT,
36
- allowNull: true,
37
- comment: 'Standard search query'
38
- },
39
- funnel_page_views: {
40
- type: DataTypes.INTEGER,
41
- allowNull: true,
42
- defaultValue: 0,
43
- comment: 'Number of funnel page views'
44
- },
45
- funnel_impressions: {
46
- type: DataTypes.INTEGER,
47
- allowNull: true,
48
- defaultValue: 0,
49
- comment: 'Number of funnel impressions'
50
- },
51
- funnel_clicks: {
52
- type: DataTypes.INTEGER,
53
- allowNull: true,
54
- defaultValue: 0,
55
- comment: 'Number of funnel clicks'
56
- },
57
- page_views: {
58
- type: DataTypes.INTEGER,
59
- allowNull: true,
60
- defaultValue: 0,
61
- comment: 'Number of page views'
62
- },
63
- impressions: {
64
- type: DataTypes.INTEGER,
65
- allowNull: true,
66
- defaultValue: 0,
67
- comment: 'Number of impressions'
68
- },
69
- clicks: {
70
- type: DataTypes.INTEGER,
71
- allowNull: true,
72
- defaultValue: 0,
73
- comment: 'Number of clicks'
74
- },
75
- agrs_cid: {
76
- type: DataTypes.STRING,
77
- allowNull: true,
78
- comment: 'AGRS campaign identifier linking to campaign data'
79
- }
80
- }, {
81
- tableName: 'rsoc_keyword_performance',
82
- timestamps: true, // Adds createdAt and updatedAt columns
83
- indexes: [
84
- {
85
- fields: ['channel_id', 'ts'],
86
- name: 'idx_rsoc_keyword_channel_time'
87
- },
88
- {
89
- fields: ['style_id'],
90
- name: 'idx_rsoc_keyword_style'
91
- },
92
- {
93
- fields: ['country_code'],
94
- name: 'idx_rsoc_keyword_country'
95
- },
96
- {
97
- fields: ['agrs_cid'],
98
- name: 'idx_rsoc_keyword_agrs_cid'
99
- }
100
- ]
101
- });
102
-
103
- // Define associations if needed
104
- RsocKeywordPerformance.associate = (models) => {
105
- // Add associations here if your table needs to reference other tables
106
- // For example:
107
- // RsocKeywordPerformance.belongsTo(models.Channel, { foreignKey: 'channel_id' });
108
- };
109
-
110
- return RsocKeywordPerformance;
1
+ module.exports = (sequelize, DataTypes) => {
2
+ const RsocKeywordPerformance = sequelize.define('RsocKeywordPerformance', {
3
+ id: {
4
+ type: DataTypes.INTEGER,
5
+ primaryKey: true,
6
+ autoIncrement: true,
7
+ allowNull: false
8
+ },
9
+ ts: {
10
+ type: DataTypes.DATE,
11
+ allowNull: false,
12
+ comment: 'Timestamp of the record'
13
+ },
14
+ channel_id: {
15
+ type: DataTypes.STRING,
16
+ allowNull: false,
17
+ comment: 'Channel identifier'
18
+ },
19
+ style_id: {
20
+ type: DataTypes.STRING,
21
+ allowNull: true,
22
+ comment: 'Style identifier'
23
+ },
24
+ country_code: {
25
+ type: DataTypes.STRING(2),
26
+ allowNull: true,
27
+ comment: 'Country code (ISO 2-letter)'
28
+ },
29
+ custom_query: {
30
+ type: DataTypes.TEXT,
31
+ allowNull: true,
32
+ comment: 'Custom search query'
33
+ },
34
+ query: {
35
+ type: DataTypes.TEXT,
36
+ allowNull: true,
37
+ comment: 'Standard search query'
38
+ },
39
+ funnel_page_views: {
40
+ type: DataTypes.INTEGER,
41
+ allowNull: true,
42
+ defaultValue: 0,
43
+ comment: 'Number of funnel page views'
44
+ },
45
+ funnel_impressions: {
46
+ type: DataTypes.INTEGER,
47
+ allowNull: true,
48
+ defaultValue: 0,
49
+ comment: 'Number of funnel impressions'
50
+ },
51
+ funnel_clicks: {
52
+ type: DataTypes.INTEGER,
53
+ allowNull: true,
54
+ defaultValue: 0,
55
+ comment: 'Number of funnel clicks'
56
+ },
57
+ page_views: {
58
+ type: DataTypes.INTEGER,
59
+ allowNull: true,
60
+ defaultValue: 0,
61
+ comment: 'Number of page views'
62
+ },
63
+ impressions: {
64
+ type: DataTypes.INTEGER,
65
+ allowNull: true,
66
+ defaultValue: 0,
67
+ comment: 'Number of impressions'
68
+ },
69
+ clicks: {
70
+ type: DataTypes.INTEGER,
71
+ allowNull: true,
72
+ defaultValue: 0,
73
+ comment: 'Number of clicks'
74
+ },
75
+ agrs_cid: {
76
+ type: DataTypes.STRING,
77
+ allowNull: true,
78
+ comment: 'AGRS campaign identifier linking to campaign data'
79
+ }
80
+ }, {
81
+ tableName: 'rsoc_keyword_performance',
82
+ timestamps: true, // Adds createdAt and updatedAt columns
83
+ indexes: [
84
+ {
85
+ fields: ['channel_id', 'ts'],
86
+ name: 'idx_rsoc_keyword_channel_time'
87
+ },
88
+ {
89
+ fields: ['style_id'],
90
+ name: 'idx_rsoc_keyword_style'
91
+ },
92
+ {
93
+ fields: ['country_code'],
94
+ name: 'idx_rsoc_keyword_country'
95
+ },
96
+ {
97
+ fields: ['agrs_cid'],
98
+ name: 'idx_rsoc_keyword_agrs_cid'
99
+ }
100
+ ]
101
+ });
102
+
103
+ // Define associations if needed
104
+ RsocKeywordPerformance.associate = (models) => {
105
+ // Add associations here if your table needs to reference other tables
106
+ // For example:
107
+ // RsocKeywordPerformance.belongsTo(models.Channel, { foreignKey: 'channel_id' });
108
+ };
109
+
110
+ return RsocKeywordPerformance;
111
111
  };
@@ -1,90 +1,90 @@
1
- const { DataTypes } = require("sequelize");
2
-
3
- module.exports = (sequelize) => {
4
- const RuleAction = sequelize.define(
5
- "RuleAction",
6
- {
7
- id: {
8
- type: DataTypes.UUID,
9
- defaultValue: DataTypes.UUIDV4,
10
- primaryKey: true,
11
- },
12
- ruleId: {
13
- type: DataTypes.UUID,
14
- allowNull: false,
15
- references: {
16
- model: "AutomationRule",
17
- key: "id",
18
- },
19
- comment: "Reference to the parent rule",
20
- },
21
- actionType: {
22
- type: DataTypes.ENUM(
23
- "PAUSE",
24
- "ACTIVATE",
25
- "CHANGE_BUDGET",
26
- "CHANGE_BID",
27
- "CHANGE_BID_STRATEGY",
28
- "CUSTOM_ACTION"
29
- ),
30
- allowNull: false,
31
- comment: "Type of action to perform",
32
- },
33
- targetLevel: {
34
- type: DataTypes.ENUM("CAMPAIGN", "ADSET", "AD"),
35
- allowNull: false,
36
- comment: "Level at which the action operates",
37
- },
38
- value: {
39
- type: DataTypes.STRING(255),
40
- allowNull: true,
41
- comment: "Value for the action (budget amount, bid amount, etc.)",
42
- },
43
- valueType: {
44
- type: DataTypes.ENUM("STRING", "NUMBER", "ARRAY"),
45
- allowNull: true,
46
- defaultValue: "STRING",
47
- comment: "Type of the value field",
48
- },
49
- actionConfig: {
50
- type: DataTypes.JSONB,
51
- allowNull: true,
52
- comment:
53
- "Configuration for the action (budget amount, bid strategy, etc.)",
54
- },
55
- order: {
56
- type: DataTypes.INTEGER,
57
- allowNull: false,
58
- defaultValue: 0,
59
- comment: "Order of this action within the rule",
60
- },
61
- isActive: {
62
- type: DataTypes.BOOLEAN,
63
- defaultValue: true,
64
- allowNull: false,
65
- comment: "Whether this action is active",
66
- },
67
- delayMinutes: {
68
- type: DataTypes.INTEGER,
69
- allowNull: true,
70
- defaultValue: 0,
71
- comment: "Delay in minutes before executing this action",
72
- },
73
- },
74
- {
75
- tableName: "RuleActions",
76
- timestamps: true,
77
- // Remove indexes from model definition - they will be created by migration
78
- }
79
- );
80
-
81
- RuleAction.associate = (models) => {
82
- // An action belongs to a rule
83
- RuleAction.belongsTo(models.AutomationRule, {
84
- foreignKey: "ruleId",
85
- as: "rule",
86
- });
87
- };
88
-
89
- return RuleAction;
90
- };
1
+ const { DataTypes } = require("sequelize");
2
+
3
+ module.exports = (sequelize) => {
4
+ const RuleAction = sequelize.define(
5
+ "RuleAction",
6
+ {
7
+ id: {
8
+ type: DataTypes.UUID,
9
+ defaultValue: DataTypes.UUIDV4,
10
+ primaryKey: true,
11
+ },
12
+ ruleId: {
13
+ type: DataTypes.UUID,
14
+ allowNull: false,
15
+ references: {
16
+ model: "AutomationRule",
17
+ key: "id",
18
+ },
19
+ comment: "Reference to the parent rule",
20
+ },
21
+ actionType: {
22
+ type: DataTypes.ENUM(
23
+ "PAUSE",
24
+ "ACTIVATE",
25
+ "CHANGE_BUDGET",
26
+ "CHANGE_BID",
27
+ "CHANGE_BID_STRATEGY",
28
+ "CUSTOM_ACTION"
29
+ ),
30
+ allowNull: false,
31
+ comment: "Type of action to perform",
32
+ },
33
+ targetLevel: {
34
+ type: DataTypes.ENUM("CAMPAIGN", "ADSET", "AD"),
35
+ allowNull: false,
36
+ comment: "Level at which the action operates",
37
+ },
38
+ value: {
39
+ type: DataTypes.STRING(255),
40
+ allowNull: true,
41
+ comment: "Value for the action (budget amount, bid amount, etc.)",
42
+ },
43
+ valueType: {
44
+ type: DataTypes.ENUM("STRING", "NUMBER", "ARRAY"),
45
+ allowNull: true,
46
+ defaultValue: "STRING",
47
+ comment: "Type of the value field",
48
+ },
49
+ actionConfig: {
50
+ type: DataTypes.JSONB,
51
+ allowNull: true,
52
+ comment:
53
+ "Configuration for the action (budget amount, bid strategy, etc.)",
54
+ },
55
+ order: {
56
+ type: DataTypes.INTEGER,
57
+ allowNull: false,
58
+ defaultValue: 0,
59
+ comment: "Order of this action within the rule",
60
+ },
61
+ isActive: {
62
+ type: DataTypes.BOOLEAN,
63
+ defaultValue: true,
64
+ allowNull: false,
65
+ comment: "Whether this action is active",
66
+ },
67
+ delayMinutes: {
68
+ type: DataTypes.INTEGER,
69
+ allowNull: true,
70
+ defaultValue: 0,
71
+ comment: "Delay in minutes before executing this action",
72
+ },
73
+ },
74
+ {
75
+ tableName: "RuleActions",
76
+ timestamps: true,
77
+ // Remove indexes from model definition - they will be created by migration
78
+ }
79
+ );
80
+
81
+ RuleAction.associate = (models) => {
82
+ // An action belongs to a rule
83
+ RuleAction.belongsTo(models.AutomationRule, {
84
+ foreignKey: "ruleId",
85
+ as: "rule",
86
+ });
87
+ };
88
+
89
+ return RuleAction;
90
+ };
@@ -1,137 +1,137 @@
1
- const { DataTypes } = require("sequelize");
2
-
3
- module.exports = (sequelize) => {
4
- const RuleCondition = sequelize.define(
5
- "RuleCondition",
6
- {
7
- id: {
8
- type: DataTypes.UUID,
9
- defaultValue: DataTypes.UUIDV4,
10
- primaryKey: true,
11
- },
12
- ruleId: {
13
- type: DataTypes.UUID,
14
- allowNull: false,
15
- references: {
16
- model: "AutomationRule",
17
- key: "id",
18
- },
19
- comment: "Reference to the parent rule",
20
- },
21
- field: {
22
- type: DataTypes.STRING(100),
23
- allowNull: false,
24
- comment: "Field to evaluate (e.g., roi, ctr, campaign_name)",
25
- },
26
- type: {
27
- type: DataTypes.ENUM("DIMENSION", "METRIC"),
28
- allowNull: false,
29
- defaultValue: "DIMENSION",
30
- comment:
31
- "Type of field - DIMENSION for filtering, METRIC for calculations",
32
- },
33
- operator: {
34
- type: DataTypes.ENUM(
35
- "EQUALS",
36
- "NOT_EQUALS",
37
- "GREATER_THAN",
38
- "LESS_THAN",
39
- "GREATER_THAN_OR_EQUAL",
40
- "LESS_THAN_OR_EQUAL",
41
- "BETWEEN",
42
- "IN",
43
- "NOT_IN",
44
- "CONTAINS",
45
- "NOT_CONTAINS",
46
- "IS_NULL",
47
- "IS_NOT_NULL"
48
- ),
49
- allowNull: false,
50
- comment: "Comparison operator",
51
- },
52
- value: {
53
- type: DataTypes.JSONB,
54
- allowNull: true,
55
- comment:
56
- "Value(s) to compare against (can be array for BETWEEN, IN, etc.)",
57
- },
58
- valueType: {
59
- type: DataTypes.ENUM("STRING", "NUMBER", "ARRAY"),
60
- allowNull: true,
61
- defaultValue: "STRING",
62
- comment: "Type of the value field",
63
- },
64
- logicalOperator: {
65
- type: DataTypes.ENUM("AND", "OR"),
66
- allowNull: false,
67
- defaultValue: "AND",
68
- comment: "How this condition connects to the next one",
69
- },
70
- order: {
71
- type: DataTypes.INTEGER,
72
- allowNull: false,
73
- defaultValue: 0,
74
- comment: "Order of this condition within the rule",
75
- },
76
- isActive: {
77
- type: DataTypes.BOOLEAN,
78
- defaultValue: true,
79
- allowNull: false,
80
- comment: "Whether this condition is active",
81
- },
82
- groupId: {
83
- type: DataTypes.STRING(50),
84
- allowNull: true,
85
- comment: "ID to group conditions together (e.g., group1, group2)",
86
- },
87
- groupOperator: {
88
- type: DataTypes.ENUM("AND", "OR"),
89
- allowNull: false,
90
- defaultValue: "AND",
91
- comment: "Operator within the group (AND/OR)",
92
- },
93
- betweenGroupsOperator: {
94
- type: DataTypes.ENUM("AND", "OR"),
95
- allowNull: true,
96
- comment:
97
- "Operator between different groups (AND/OR) - only for first condition in group",
98
- },
99
- dateRangeType: {
100
- type: DataTypes.STRING(50),
101
- allowNull: true,
102
- comment:
103
- "Type of date range (last_7_days, yesterday, today, custom, etc.)",
104
- },
105
- dateRangeValue: {
106
- type: DataTypes.INTEGER,
107
- allowNull: true,
108
- comment: "Number of days for relative date ranges",
109
- },
110
- customStartDate: {
111
- type: DataTypes.DATE,
112
- allowNull: true,
113
- comment: "Custom start date if dateRangeType is custom",
114
- },
115
- customEndDate: {
116
- type: DataTypes.DATE,
117
- allowNull: true,
118
- comment: "Custom end date if dateRangeType is custom",
119
- },
120
- },
121
- {
122
- tableName: "RuleConditions",
123
- timestamps: true,
124
- // Remove indexes from model definition - they will be created by migration
125
- }
126
- );
127
-
128
- RuleCondition.associate = (models) => {
129
- // A condition belongs to a rule
130
- RuleCondition.belongsTo(models.AutomationRule, {
131
- foreignKey: "ruleId",
132
- as: "rule",
133
- });
134
- };
135
-
136
- return RuleCondition;
137
- };
1
+ const { DataTypes } = require("sequelize");
2
+
3
+ module.exports = (sequelize) => {
4
+ const RuleCondition = sequelize.define(
5
+ "RuleCondition",
6
+ {
7
+ id: {
8
+ type: DataTypes.UUID,
9
+ defaultValue: DataTypes.UUIDV4,
10
+ primaryKey: true,
11
+ },
12
+ ruleId: {
13
+ type: DataTypes.UUID,
14
+ allowNull: false,
15
+ references: {
16
+ model: "AutomationRule",
17
+ key: "id",
18
+ },
19
+ comment: "Reference to the parent rule",
20
+ },
21
+ field: {
22
+ type: DataTypes.STRING(100),
23
+ allowNull: false,
24
+ comment: "Field to evaluate (e.g., roi, ctr, campaign_name)",
25
+ },
26
+ type: {
27
+ type: DataTypes.ENUM("DIMENSION", "METRIC"),
28
+ allowNull: false,
29
+ defaultValue: "DIMENSION",
30
+ comment:
31
+ "Type of field - DIMENSION for filtering, METRIC for calculations",
32
+ },
33
+ operator: {
34
+ type: DataTypes.ENUM(
35
+ "EQUALS",
36
+ "NOT_EQUALS",
37
+ "GREATER_THAN",
38
+ "LESS_THAN",
39
+ "GREATER_THAN_OR_EQUAL",
40
+ "LESS_THAN_OR_EQUAL",
41
+ "BETWEEN",
42
+ "IN",
43
+ "NOT_IN",
44
+ "CONTAINS",
45
+ "NOT_CONTAINS",
46
+ "IS_NULL",
47
+ "IS_NOT_NULL"
48
+ ),
49
+ allowNull: false,
50
+ comment: "Comparison operator",
51
+ },
52
+ value: {
53
+ type: DataTypes.JSONB,
54
+ allowNull: true,
55
+ comment:
56
+ "Value(s) to compare against (can be array for BETWEEN, IN, etc.)",
57
+ },
58
+ valueType: {
59
+ type: DataTypes.ENUM("STRING", "NUMBER", "ARRAY"),
60
+ allowNull: true,
61
+ defaultValue: "STRING",
62
+ comment: "Type of the value field",
63
+ },
64
+ logicalOperator: {
65
+ type: DataTypes.ENUM("AND", "OR"),
66
+ allowNull: false,
67
+ defaultValue: "AND",
68
+ comment: "How this condition connects to the next one",
69
+ },
70
+ order: {
71
+ type: DataTypes.INTEGER,
72
+ allowNull: false,
73
+ defaultValue: 0,
74
+ comment: "Order of this condition within the rule",
75
+ },
76
+ isActive: {
77
+ type: DataTypes.BOOLEAN,
78
+ defaultValue: true,
79
+ allowNull: false,
80
+ comment: "Whether this condition is active",
81
+ },
82
+ groupId: {
83
+ type: DataTypes.STRING(50),
84
+ allowNull: true,
85
+ comment: "ID to group conditions together (e.g., group1, group2)",
86
+ },
87
+ groupOperator: {
88
+ type: DataTypes.ENUM("AND", "OR"),
89
+ allowNull: false,
90
+ defaultValue: "AND",
91
+ comment: "Operator within the group (AND/OR)",
92
+ },
93
+ betweenGroupsOperator: {
94
+ type: DataTypes.ENUM("AND", "OR"),
95
+ allowNull: true,
96
+ comment:
97
+ "Operator between different groups (AND/OR) - only for first condition in group",
98
+ },
99
+ dateRangeType: {
100
+ type: DataTypes.STRING(50),
101
+ allowNull: true,
102
+ comment:
103
+ "Type of date range (last_7_days, yesterday, today, custom, etc.)",
104
+ },
105
+ dateRangeValue: {
106
+ type: DataTypes.INTEGER,
107
+ allowNull: true,
108
+ comment: "Number of days for relative date ranges",
109
+ },
110
+ customStartDate: {
111
+ type: DataTypes.DATE,
112
+ allowNull: true,
113
+ comment: "Custom start date if dateRangeType is custom",
114
+ },
115
+ customEndDate: {
116
+ type: DataTypes.DATE,
117
+ allowNull: true,
118
+ comment: "Custom end date if dateRangeType is custom",
119
+ },
120
+ },
121
+ {
122
+ tableName: "RuleConditions",
123
+ timestamps: true,
124
+ // Remove indexes from model definition - they will be created by migration
125
+ }
126
+ );
127
+
128
+ RuleCondition.associate = (models) => {
129
+ // A condition belongs to a rule
130
+ RuleCondition.belongsTo(models.AutomationRule, {
131
+ foreignKey: "ruleId",
132
+ as: "rule",
133
+ });
134
+ };
135
+
136
+ return RuleCondition;
137
+ };