agrs-sequelize-sdk 1.3.81 → 1.3.83

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 (64) 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 +35 -35
  24. package/models/DynamicFeed.js +212 -212
  25. package/models/ExplorAdsChannel.js +61 -61
  26. package/models/FacebookRetryQueue.js +156 -0
  27. package/models/Feed.js +33 -33
  28. package/models/FeedArticleConfiguration.js +80 -80
  29. package/models/FrontStoryChannel.js +59 -59
  30. package/models/FrontStoryChannelV2.js +60 -60
  31. package/models/GenericFlowRequest.js +114 -114
  32. package/models/MidoWebChannel.js +47 -47
  33. package/models/MineChannel.js +42 -42
  34. package/models/Pages.js +92 -92
  35. package/models/PipelineExecution.js +59 -59
  36. package/models/PolicyDogsCreativeCache.js +50 -50
  37. package/models/PolicyDogsImageCache.js +30 -30
  38. package/models/Presets.js +34 -34
  39. package/models/RSOCFeedCampaign.js +375 -375
  40. package/models/RsocKeywordPerformance.js +110 -110
  41. package/models/RuleAction.js +90 -90
  42. package/models/RuleCondition.js +137 -137
  43. package/models/RuleExecution.js +107 -107
  44. package/models/RulesValues.js +56 -56
  45. package/models/SupportedLocale.js +23 -23
  46. package/models/SyncHistory.js +249 -249
  47. package/models/TTQChannel.js +42 -42
  48. package/models/TemplateMetadata.js +260 -260
  49. package/models/Tier2_AdAccounts.js +110 -110
  50. package/models/Tier2_Assets.js +70 -70
  51. package/models/Tier2_BusinessManagers.js +105 -105
  52. package/models/Tier2_CreditLines.js +99 -99
  53. package/models/Tier2_Pages.js +91 -91
  54. package/models/Tier2_Pixels.js +82 -82
  55. package/models/Tier2_Tokens.js +64 -64
  56. package/models/Tier2_UserAdAccounts.js +83 -83
  57. package/models/TokenRotationState.js +121 -121
  58. package/models/TonicRSOCKeywordPerformance.js +122 -122
  59. package/models/Users.js +143 -138
  60. package/models/Vertical.js +25 -25
  61. package/models/newFiles.js +137 -137
  62. package/package.json +19 -21
  63. package/run.sh +214 -214
  64. package/services/sequelizeService.js +110 -110
package/models/Article.js CHANGED
@@ -1,196 +1,196 @@
1
- module.exports = (sequelize, DataTypes) => {
2
- const Article = sequelize.define(
3
- "Article",
4
- {
5
- providerId: {
6
- type: DataTypes.STRING,
7
- allowNull: true,
8
- },
9
- keywordId: {
10
- type: DataTypes.STRING,
11
- allowNull: true,
12
- comment: "ID of the keyword from Predicto keywords API",
13
- },
14
- requestedFromDashboard: {
15
- type: DataTypes.BOOLEAN,
16
- allowNull: false,
17
- defaultValue: false,
18
- comment:
19
- "Indicates if the article was created through our dashboard (true) or imported from external sources (false)",
20
- },
21
- category: {
22
- type: DataTypes.STRING,
23
- allowNull: true,
24
- },
25
- AGRSAID: {
26
- type: DataTypes.STRING,
27
- allowNull: false,
28
- unique: true,
29
- },
30
- articleUrl: {
31
- type: DataTypes.STRING(1024),
32
- allowNull: true,
33
- },
34
- feed: {
35
- type: DataTypes.STRING,
36
- allowNull: false,
37
- },
38
- feedName: {
39
- type: DataTypes.STRING,
40
- allowNull: false,
41
- },
42
- vertical: {
43
- type: DataTypes.STRING,
44
- allowNull: false,
45
- },
46
- language: {
47
- type: DataTypes.STRING,
48
- allowNull: false,
49
- defaultValue: "en",
50
- },
51
- headline: {
52
- type: DataTypes.STRING(1000),
53
- allowNull: true,
54
- },
55
- topics: {
56
- type: DataTypes.ARRAY(DataTypes.STRING(1000)),
57
- allowNull: true,
58
- },
59
- translatedTopics: {
60
- type: DataTypes.ARRAY(DataTypes.STRING(1000)),
61
- allowNull: true,
62
- comment: "Topics translated to English for display purposes",
63
- },
64
- mainKeyword: {
65
- type: DataTypes.STRING,
66
- allowNull: true,
67
- },
68
- keywords: {
69
- type: DataTypes.ARRAY(DataTypes.STRING),
70
- allowNull: true,
71
- },
72
- date: {
73
- type: DataTypes.DATE,
74
- allowNull: true,
75
- defaultValue: DataTypes.NOW,
76
- },
77
- nativeKeyword: {
78
- type: DataTypes.STRING,
79
- allowNull: false,
80
- },
81
- suggestedKeywords: {
82
- type: DataTypes.STRING,
83
- allowNull: true,
84
- },
85
- articleExcerpt: {
86
- type: DataTypes.TEXT,
87
- allowNull: true,
88
- },
89
- articleContent: {
90
- type: DataTypes.TEXT,
91
- allowNull: true,
92
- },
93
- fbPixelId: {
94
- type: DataTypes.STRING,
95
- allowNull: true,
96
- },
97
- status: {
98
- type: DataTypes.STRING,
99
- allowNull: false,
100
- defaultValue: "pending",
101
- },
102
- originalStatus: {
103
- type: DataTypes.STRING,
104
- allowNull: true,
105
- comment: "Original status from Predicto before any mapping",
106
- },
107
- creationType: {
108
- type: DataTypes.STRING,
109
- allowNull: false,
110
- defaultValue: "slug",
111
- validate: {
112
- isIn: [["search", "slug", "manual-tonic"]],
113
- },
114
- },
115
- createdAt: {
116
- type: DataTypes.DATE,
117
- defaultValue: DataTypes.NOW,
118
- },
119
- updatedAt: {
120
- type: DataTypes.DATE,
121
- defaultValue: DataTypes.NOW,
122
- },
123
- buyer: {
124
- type: DataTypes.STRING,
125
- allowNull: true,
126
- },
127
- country: {
128
- type: DataTypes.STRING,
129
- allowNull: true,
130
- },
131
- name: {
132
- type: DataTypes.STRING,
133
- allowNull: true,
134
- },
135
- submittedToMine: {
136
- type: DataTypes.BOOLEAN,
137
- allowNull: true,
138
- defaultValue: false,
139
- comment: "Tracks if article has been submitted to Mine Marketing API in bulk migration"
140
- },
141
- submittedToMineAt: {
142
- type: DataTypes.DATE,
143
- allowNull: true,
144
- comment: "Timestamp when article was submitted to Mine Marketing"
145
- },
146
- contentType: {
147
- type: DataTypes.STRING,
148
- allowNull: true,
149
- defaultValue: 'generate',
150
- validate: {
151
- isIn: [['generate', 'import']]
152
- },
153
- comment: "Type of content: 'generate' for AI-generated or 'import' from URL"
154
- }
155
- },
156
- {
157
- tableName: "articles",
158
- timestamps: true,
159
- indexes: [
160
- {
161
- unique: true,
162
- fields: ['providerId', 'feed'],
163
- name: 'unique_provider_per_feed'
164
- }
165
- ]
166
- }
167
- );
168
-
169
- Article.associate = (models) => {
170
- Article.hasMany(models.RSOCFeedCampaign, {
171
- foreignKey: "AGRSAID",
172
- sourceKey: "AGRSAID",
173
- as: "RSOCFeedCampaigns",
174
- constraints: false,
175
- });
176
- };
177
-
178
- Article.prototype.isAvailableForCampaign = function () {
179
- return ["approved", "keyword_already_exists"].includes(this.status);
180
- };
181
-
182
- // NEW METHODS FOR URL STRUCTURE HANDLING
183
- Article.prototype.isUnifiedStructure = function () {
184
- return this.url_structure === "unified";
185
- };
186
-
187
- Article.prototype.getTargetDomain = function () {
188
- return this.target_domain || "sportfoy.com";
189
- };
190
-
191
- Article.prototype.isLegacyStructure = function () {
192
- return this.url_structure === "legacy";
193
- };
194
-
195
- return Article;
196
- };
1
+ module.exports = (sequelize, DataTypes) => {
2
+ const Article = sequelize.define(
3
+ "Article",
4
+ {
5
+ providerId: {
6
+ type: DataTypes.STRING,
7
+ allowNull: true,
8
+ },
9
+ keywordId: {
10
+ type: DataTypes.STRING,
11
+ allowNull: true,
12
+ comment: "ID of the keyword from Predicto keywords API",
13
+ },
14
+ requestedFromDashboard: {
15
+ type: DataTypes.BOOLEAN,
16
+ allowNull: false,
17
+ defaultValue: false,
18
+ comment:
19
+ "Indicates if the article was created through our dashboard (true) or imported from external sources (false)",
20
+ },
21
+ category: {
22
+ type: DataTypes.STRING,
23
+ allowNull: true,
24
+ },
25
+ AGRSAID: {
26
+ type: DataTypes.STRING,
27
+ allowNull: false,
28
+ unique: true,
29
+ },
30
+ articleUrl: {
31
+ type: DataTypes.STRING(1024),
32
+ allowNull: true,
33
+ },
34
+ feed: {
35
+ type: DataTypes.STRING,
36
+ allowNull: false,
37
+ },
38
+ feedName: {
39
+ type: DataTypes.STRING,
40
+ allowNull: false,
41
+ },
42
+ vertical: {
43
+ type: DataTypes.STRING,
44
+ allowNull: false,
45
+ },
46
+ language: {
47
+ type: DataTypes.STRING,
48
+ allowNull: false,
49
+ defaultValue: "en",
50
+ },
51
+ headline: {
52
+ type: DataTypes.STRING(1000),
53
+ allowNull: true,
54
+ },
55
+ topics: {
56
+ type: DataTypes.ARRAY(DataTypes.STRING(1000)),
57
+ allowNull: true,
58
+ },
59
+ translatedTopics: {
60
+ type: DataTypes.ARRAY(DataTypes.STRING(1000)),
61
+ allowNull: true,
62
+ comment: "Topics translated to English for display purposes",
63
+ },
64
+ mainKeyword: {
65
+ type: DataTypes.STRING,
66
+ allowNull: true,
67
+ },
68
+ keywords: {
69
+ type: DataTypes.ARRAY(DataTypes.STRING),
70
+ allowNull: true,
71
+ },
72
+ date: {
73
+ type: DataTypes.DATE,
74
+ allowNull: true,
75
+ defaultValue: DataTypes.NOW,
76
+ },
77
+ nativeKeyword: {
78
+ type: DataTypes.STRING,
79
+ allowNull: false,
80
+ },
81
+ suggestedKeywords: {
82
+ type: DataTypes.STRING,
83
+ allowNull: true,
84
+ },
85
+ articleExcerpt: {
86
+ type: DataTypes.TEXT,
87
+ allowNull: true,
88
+ },
89
+ articleContent: {
90
+ type: DataTypes.TEXT,
91
+ allowNull: true,
92
+ },
93
+ fbPixelId: {
94
+ type: DataTypes.STRING,
95
+ allowNull: true,
96
+ },
97
+ status: {
98
+ type: DataTypes.STRING,
99
+ allowNull: false,
100
+ defaultValue: "pending",
101
+ },
102
+ originalStatus: {
103
+ type: DataTypes.STRING,
104
+ allowNull: true,
105
+ comment: "Original status from Predicto before any mapping",
106
+ },
107
+ creationType: {
108
+ type: DataTypes.STRING,
109
+ allowNull: false,
110
+ defaultValue: "slug",
111
+ validate: {
112
+ isIn: [["search", "slug", "manual-tonic"]],
113
+ },
114
+ },
115
+ createdAt: {
116
+ type: DataTypes.DATE,
117
+ defaultValue: DataTypes.NOW,
118
+ },
119
+ updatedAt: {
120
+ type: DataTypes.DATE,
121
+ defaultValue: DataTypes.NOW,
122
+ },
123
+ buyer: {
124
+ type: DataTypes.STRING,
125
+ allowNull: true,
126
+ },
127
+ country: {
128
+ type: DataTypes.STRING,
129
+ allowNull: true,
130
+ },
131
+ name: {
132
+ type: DataTypes.STRING,
133
+ allowNull: true,
134
+ },
135
+ submittedToMine: {
136
+ type: DataTypes.BOOLEAN,
137
+ allowNull: true,
138
+ defaultValue: false,
139
+ comment: "Tracks if article has been submitted to Mine Marketing API in bulk migration"
140
+ },
141
+ submittedToMineAt: {
142
+ type: DataTypes.DATE,
143
+ allowNull: true,
144
+ comment: "Timestamp when article was submitted to Mine Marketing"
145
+ },
146
+ contentType: {
147
+ type: DataTypes.STRING,
148
+ allowNull: true,
149
+ defaultValue: 'generate',
150
+ validate: {
151
+ isIn: [['generate', 'import']]
152
+ },
153
+ comment: "Type of content: 'generate' for AI-generated or 'import' from URL"
154
+ }
155
+ },
156
+ {
157
+ tableName: "articles",
158
+ timestamps: true,
159
+ indexes: [
160
+ {
161
+ unique: true,
162
+ fields: ['providerId', 'feed'],
163
+ name: 'unique_provider_per_feed'
164
+ }
165
+ ]
166
+ }
167
+ );
168
+
169
+ Article.associate = (models) => {
170
+ Article.hasMany(models.RSOCFeedCampaign, {
171
+ foreignKey: "AGRSAID",
172
+ sourceKey: "AGRSAID",
173
+ as: "RSOCFeedCampaigns",
174
+ constraints: false,
175
+ });
176
+ };
177
+
178
+ Article.prototype.isAvailableForCampaign = function () {
179
+ return ["approved", "keyword_already_exists"].includes(this.status);
180
+ };
181
+
182
+ // NEW METHODS FOR URL STRUCTURE HANDLING
183
+ Article.prototype.isUnifiedStructure = function () {
184
+ return this.url_structure === "unified";
185
+ };
186
+
187
+ Article.prototype.getTargetDomain = function () {
188
+ return this.target_domain || "sportfoy.com";
189
+ };
190
+
191
+ Article.prototype.isLegacyStructure = function () {
192
+ return this.url_structure === "legacy";
193
+ };
194
+
195
+ return Article;
196
+ };