agrs-sequelize-sdk 1.2.9 → 1.2.11
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/package.json +1 -1
- package/agrs-sequelize/LICENSE +0 -21
- package/agrs-sequelize/README.md +0 -179
- package/agrs-sequelize/index.js +0 -169
- package/agrs-sequelize/jq.exe +0 -0
- package/agrs-sequelize/models/ActivityHistory.js +0 -73
- package/agrs-sequelize/models/Ad.js +0 -209
- package/agrs-sequelize/models/AdAccount.js +0 -91
- package/agrs-sequelize/models/AdAccountValues.js +0 -26
- package/agrs-sequelize/models/AdHistory.js +0 -30
- package/agrs-sequelize/models/AdPerformance.js +0 -84
- package/agrs-sequelize/models/AdPerformanceHourly.js +0 -66
- package/agrs-sequelize/models/AdSet.js +0 -140
- package/agrs-sequelize/models/AdSetHistory.js +0 -30
- package/agrs-sequelize/models/AdsetPerformance.js +0 -116
- package/agrs-sequelize/models/Article.js +0 -156
- package/agrs-sequelize/models/Buyers.js +0 -26
- package/agrs-sequelize/models/Campaign.js +0 -136
- package/agrs-sequelize/models/CampaignCreationLog.js +0 -86
- package/agrs-sequelize/models/CampaignHistory.js +0 -33
- package/agrs-sequelize/models/Channel.js +0 -55
- package/agrs-sequelize/models/CodefuelCampaign.js +0 -159
- package/agrs-sequelize/models/CodefuelCampaignKWHistory.js +0 -41
- package/agrs-sequelize/models/CodefuelKeywords.js +0 -35
- package/agrs-sequelize/models/CurrencyRate.js +0 -27
- package/agrs-sequelize/models/Domain.js +0 -26
- package/agrs-sequelize/models/ExplorAdsChannel.js +0 -62
- package/agrs-sequelize/models/Feed.js +0 -34
- package/agrs-sequelize/models/Files.js +0 -73
- package/agrs-sequelize/models/Folders.js +0 -133
- package/agrs-sequelize/models/KeywordPerformance.js +0 -99
- package/agrs-sequelize/models/KeywordRotationState.js +0 -51
- package/agrs-sequelize/models/Pages.js +0 -74
- package/agrs-sequelize/models/PipelineExecution.js +0 -46
- package/agrs-sequelize/models/RSOCFeedCampaign.js +0 -307
- package/agrs-sequelize/models/RsocKeywordPerformance.js +0 -111
- package/agrs-sequelize/models/Rule.js +0 -39
- package/agrs-sequelize/models/RulesValues.js +0 -56
- package/agrs-sequelize/models/SupportedLocale.js +0 -24
- package/agrs-sequelize/models/TonicCampaign.js +0 -97
- package/agrs-sequelize/models/Users.js +0 -111
- package/agrs-sequelize/models/Vertical.js +0 -26
- package/agrs-sequelize/models/newFiles.js +0 -68
- package/agrs-sequelize/models/pixels.js +0 -33
- package/agrs-sequelize/package-lock.json +0 -405
- package/agrs-sequelize/package.json +0 -19
- package/agrs-sequelize/run.ps1 +0 -98
- package/agrs-sequelize/run.sh +0 -214
|
@@ -1,307 +0,0 @@
|
|
|
1
|
-
module.exports = (sequelize, DataTypes) => {
|
|
2
|
-
const RSOCFeedCampaign = sequelize.define(
|
|
3
|
-
"RSOCFeedCampaign",
|
|
4
|
-
{
|
|
5
|
-
AGRS_CID: {
|
|
6
|
-
type: DataTypes.STRING,
|
|
7
|
-
allowNull: false,
|
|
8
|
-
unique: true,
|
|
9
|
-
primaryKey: true,
|
|
10
|
-
},
|
|
11
|
-
AGRSAID: {
|
|
12
|
-
type: DataTypes.STRING,
|
|
13
|
-
allowNull: true,
|
|
14
|
-
comment: "ID referencing Article.AGRSAID",
|
|
15
|
-
},
|
|
16
|
-
articleName: {
|
|
17
|
-
type: DataTypes.STRING,
|
|
18
|
-
allowNull: true,
|
|
19
|
-
comment: "Name of the associated article",
|
|
20
|
-
},
|
|
21
|
-
channelId: {
|
|
22
|
-
type: DataTypes.STRING,
|
|
23
|
-
allowNull: false,
|
|
24
|
-
comment: "ID referencing Channel.channelId",
|
|
25
|
-
},
|
|
26
|
-
styleId: {
|
|
27
|
-
type: DataTypes.STRING,
|
|
28
|
-
allowNull: true,
|
|
29
|
-
comment: "Style ID (stid) inherited from Channel",
|
|
30
|
-
},
|
|
31
|
-
assignee: {
|
|
32
|
-
type: DataTypes.STRING,
|
|
33
|
-
allowNull: false,
|
|
34
|
-
},
|
|
35
|
-
status: {
|
|
36
|
-
type: DataTypes.STRING,
|
|
37
|
-
allowNull: false,
|
|
38
|
-
defaultValue: "active",
|
|
39
|
-
validate: {
|
|
40
|
-
isIn: [["active", "inactive", "archived"]],
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
country: {
|
|
44
|
-
type: DataTypes.STRING,
|
|
45
|
-
allowNull: false,
|
|
46
|
-
},
|
|
47
|
-
language: {
|
|
48
|
-
type: DataTypes.STRING,
|
|
49
|
-
allowNull: true,
|
|
50
|
-
comment: "Language code for the campaign",
|
|
51
|
-
},
|
|
52
|
-
vertical: {
|
|
53
|
-
type: DataTypes.STRING,
|
|
54
|
-
allowNull: false,
|
|
55
|
-
comment: "Maps to Article.category for dynamic selection",
|
|
56
|
-
},
|
|
57
|
-
freeText: {
|
|
58
|
-
type: DataTypes.TEXT,
|
|
59
|
-
allowNull: true,
|
|
60
|
-
},
|
|
61
|
-
campaignName: {
|
|
62
|
-
type: DataTypes.STRING,
|
|
63
|
-
allowNull: false,
|
|
64
|
-
},
|
|
65
|
-
campaignId: {
|
|
66
|
-
type: DataTypes.STRING,
|
|
67
|
-
allowNull: true,
|
|
68
|
-
},
|
|
69
|
-
keywords: {
|
|
70
|
-
type: DataTypes.ARRAY(DataTypes.STRING),
|
|
71
|
-
allowNull: true,
|
|
72
|
-
},
|
|
73
|
-
link: {
|
|
74
|
-
type: DataTypes.STRING(1024),
|
|
75
|
-
allowNull: true,
|
|
76
|
-
comment: "Campaign-specific URL based on article URL with parameters",
|
|
77
|
-
},
|
|
78
|
-
redirectLink: {
|
|
79
|
-
type: DataTypes.STRING(1024),
|
|
80
|
-
allowNull: true,
|
|
81
|
-
},
|
|
82
|
-
pixelId: {
|
|
83
|
-
type: DataTypes.STRING(1024),
|
|
84
|
-
allowNull: true,
|
|
85
|
-
},
|
|
86
|
-
token: {
|
|
87
|
-
type: DataTypes.STRING(1024),
|
|
88
|
-
allowNull: true,
|
|
89
|
-
},
|
|
90
|
-
accountId: {
|
|
91
|
-
type: DataTypes.STRING,
|
|
92
|
-
allowNull: false,
|
|
93
|
-
},
|
|
94
|
-
feedName: {
|
|
95
|
-
type: DataTypes.STRING,
|
|
96
|
-
allowNull: true,
|
|
97
|
-
defaultValue: "RSOC",
|
|
98
|
-
},
|
|
99
|
-
adTitle: {
|
|
100
|
-
type: DataTypes.STRING,
|
|
101
|
-
allowNull: true,
|
|
102
|
-
},
|
|
103
|
-
domain: {
|
|
104
|
-
type: DataTypes.STRING,
|
|
105
|
-
allowNull: true,
|
|
106
|
-
},
|
|
107
|
-
feedProvider: {
|
|
108
|
-
type: DataTypes.STRING,
|
|
109
|
-
allowNull: false,
|
|
110
|
-
defaultValue: "RSOC",
|
|
111
|
-
},
|
|
112
|
-
createdCampaignAt: {
|
|
113
|
-
type: DataTypes.DATE,
|
|
114
|
-
allowNull: true,
|
|
115
|
-
defaultValue: DataTypes.NOW,
|
|
116
|
-
},
|
|
117
|
-
draft: {
|
|
118
|
-
type: DataTypes.BOOLEAN,
|
|
119
|
-
allowNull: true,
|
|
120
|
-
defaultValue: false,
|
|
121
|
-
},
|
|
122
|
-
createdAt: {
|
|
123
|
-
type: DataTypes.DATE,
|
|
124
|
-
allowNull: false,
|
|
125
|
-
defaultValue: DataTypes.NOW,
|
|
126
|
-
},
|
|
127
|
-
updatedAt: {
|
|
128
|
-
type: DataTypes.DATE,
|
|
129
|
-
allowNull: false,
|
|
130
|
-
defaultValue: DataTypes.NOW,
|
|
131
|
-
},
|
|
132
|
-
platform: {
|
|
133
|
-
type: DataTypes.STRING,
|
|
134
|
-
allowNull: false,
|
|
135
|
-
},
|
|
136
|
-
mediaBuyer: {
|
|
137
|
-
type: DataTypes.STRING,
|
|
138
|
-
allowNull: true,
|
|
139
|
-
},
|
|
140
|
-
},
|
|
141
|
-
{
|
|
142
|
-
tableName: "rsoc_feed_campaigns",
|
|
143
|
-
timestamps: true,
|
|
144
|
-
}
|
|
145
|
-
);
|
|
146
|
-
|
|
147
|
-
// Define associations without enforcing foreign key constraints
|
|
148
|
-
RSOCFeedCampaign.associate = (models) => {
|
|
149
|
-
if (models.Article) {
|
|
150
|
-
RSOCFeedCampaign.belongsTo(models.Article, {
|
|
151
|
-
foreignKey: "AGRSAID",
|
|
152
|
-
targetKey: "AGRSAID",
|
|
153
|
-
as: "Article",
|
|
154
|
-
constraints: false,
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
if (models.Channel) {
|
|
159
|
-
RSOCFeedCampaign.belongsTo(models.Channel, {
|
|
160
|
-
foreignKey: "channelId",
|
|
161
|
-
targetKey: "channelId",
|
|
162
|
-
as: "Channel",
|
|
163
|
-
constraints: false,
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
if (models.Ad) {
|
|
168
|
-
RSOCFeedCampaign.hasMany(models.Ad, {
|
|
169
|
-
foreignKey: "AGRS_CID",
|
|
170
|
-
sourceKey: "AGRS_CID",
|
|
171
|
-
as: "Ads",
|
|
172
|
-
constraints: false,
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
};
|
|
176
|
-
|
|
177
|
-
// BeforeCreate hook: Update Channel status and connectedCampaigns
|
|
178
|
-
RSOCFeedCampaign.beforeCreate(async (campaign, options) => {
|
|
179
|
-
campaign.setDataValue("redirectLink", null);
|
|
180
|
-
|
|
181
|
-
// Skip channel update if in a silent operation (e.g., during sync)
|
|
182
|
-
if (options.silent) return;
|
|
183
|
-
|
|
184
|
-
try {
|
|
185
|
-
const channel = await sequelize.models.Channel.findOne({
|
|
186
|
-
where: {
|
|
187
|
-
channelId: campaign.channelId,
|
|
188
|
-
styleId: campaign.styleId || null,
|
|
189
|
-
},
|
|
190
|
-
});
|
|
191
|
-
|
|
192
|
-
if (channel) {
|
|
193
|
-
const connectedCampaigns = channel.connectedCampaigns || [];
|
|
194
|
-
if (
|
|
195
|
-
!connectedCampaigns.some((c) => c.campaignId === campaign.AGRS_CID)
|
|
196
|
-
) {
|
|
197
|
-
connectedCampaigns.push({
|
|
198
|
-
campaignId: campaign.AGRS_CID,
|
|
199
|
-
assignedAt: new Date(),
|
|
200
|
-
releasedAt: null,
|
|
201
|
-
});
|
|
202
|
-
await channel.update(
|
|
203
|
-
{
|
|
204
|
-
status: "used",
|
|
205
|
-
connectedCampaigns,
|
|
206
|
-
},
|
|
207
|
-
{ silent: true }
|
|
208
|
-
);
|
|
209
|
-
}
|
|
210
|
-
} else {
|
|
211
|
-
console.warn(
|
|
212
|
-
`Channel not found for channelId: ${campaign.channelId}, styleId: ${campaign.styleId}`
|
|
213
|
-
);
|
|
214
|
-
}
|
|
215
|
-
} catch (error) {
|
|
216
|
-
console.error("Error in beforeCreate hook:", error.message);
|
|
217
|
-
}
|
|
218
|
-
});
|
|
219
|
-
|
|
220
|
-
// BeforeUpdate hook: Handle channel reassignment
|
|
221
|
-
RSOCFeedCampaign.beforeUpdate(async (campaign, options) => {
|
|
222
|
-
campaign.setDataValue("redirectLink", null);
|
|
223
|
-
|
|
224
|
-
// Skip channel update if in a silent operation or no relevant changes
|
|
225
|
-
if (
|
|
226
|
-
options.silent ||
|
|
227
|
-
(!campaign.changed("channelId") && !campaign.changed("styleId"))
|
|
228
|
-
) {
|
|
229
|
-
return;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
try {
|
|
233
|
-
const oldChannelId = campaign.previous("channelId");
|
|
234
|
-
const oldStyleId = campaign.previous("styleId") || null;
|
|
235
|
-
const newChannelId = campaign.channelId;
|
|
236
|
-
const newStyleId = campaign.styleId || null;
|
|
237
|
-
|
|
238
|
-
// Release old channel
|
|
239
|
-
if (
|
|
240
|
-
oldChannelId &&
|
|
241
|
-
(oldChannelId !== newChannelId || oldStyleId !== newStyleId)
|
|
242
|
-
) {
|
|
243
|
-
const oldChannel = await sequelize.models.Channel.findOne({
|
|
244
|
-
where: {
|
|
245
|
-
channelId: oldChannelId,
|
|
246
|
-
styleId: oldStyleId,
|
|
247
|
-
},
|
|
248
|
-
});
|
|
249
|
-
|
|
250
|
-
if (oldChannel) {
|
|
251
|
-
const connectedCampaigns = oldChannel.connectedCampaigns || [];
|
|
252
|
-
const updatedCampaigns = connectedCampaigns
|
|
253
|
-
.map((c) =>
|
|
254
|
-
c.campaignId === campaign.AGRS_CID
|
|
255
|
-
? { ...c, releasedAt: new Date() }
|
|
256
|
-
: c
|
|
257
|
-
)
|
|
258
|
-
.filter((c) => !c.releasedAt);
|
|
259
|
-
|
|
260
|
-
await oldChannel.update(
|
|
261
|
-
{
|
|
262
|
-
connectedCampaigns: updatedCampaigns,
|
|
263
|
-
status: updatedCampaigns.length > 0 ? "used" : "free",
|
|
264
|
-
},
|
|
265
|
-
{ silent: true }
|
|
266
|
-
);
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
// Assign new channel
|
|
271
|
-
const newChannel = await sequelize.models.Channel.findOne({
|
|
272
|
-
where: {
|
|
273
|
-
channelId: newChannelId,
|
|
274
|
-
styleId: newStyleId,
|
|
275
|
-
},
|
|
276
|
-
});
|
|
277
|
-
|
|
278
|
-
if (newChannel) {
|
|
279
|
-
const connectedCampaigns = newChannel.connectedCampaigns || [];
|
|
280
|
-
if (
|
|
281
|
-
!connectedCampaigns.some((c) => c.campaignId === campaign.AGRS_CID)
|
|
282
|
-
) {
|
|
283
|
-
connectedCampaigns.push({
|
|
284
|
-
campaignId: campaign.AGRS_CID,
|
|
285
|
-
assignedAt: new Date(),
|
|
286
|
-
releasedAt: null,
|
|
287
|
-
});
|
|
288
|
-
await newChannel.update(
|
|
289
|
-
{
|
|
290
|
-
status: "used",
|
|
291
|
-
connectedCampaigns,
|
|
292
|
-
},
|
|
293
|
-
{ silent: true }
|
|
294
|
-
);
|
|
295
|
-
}
|
|
296
|
-
} else {
|
|
297
|
-
console.warn(
|
|
298
|
-
`Channel not found for channelId: ${newChannelId}, styleId: ${newStyleId}`
|
|
299
|
-
);
|
|
300
|
-
}
|
|
301
|
-
} catch (error) {
|
|
302
|
-
console.error("Error in beforeUpdate hook:", error.message);
|
|
303
|
-
}
|
|
304
|
-
});
|
|
305
|
-
|
|
306
|
-
return RSOCFeedCampaign;
|
|
307
|
-
};
|
|
@@ -1,111 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
module.exports = (sequelize, DataTypes) => {
|
|
2
|
-
const Rule = sequelize.define("Rule", {
|
|
3
|
-
ruleName: {
|
|
4
|
-
type: DataTypes.STRING,
|
|
5
|
-
allowNull: false,
|
|
6
|
-
},
|
|
7
|
-
timeUnit: {
|
|
8
|
-
type: DataTypes.ENUM("minutes", "hours", "days"),
|
|
9
|
-
allowNull: false,
|
|
10
|
-
},
|
|
11
|
-
timeValue: {
|
|
12
|
-
type: DataTypes.INTEGER,
|
|
13
|
-
allowNull: false,
|
|
14
|
-
},
|
|
15
|
-
daysAndTimes: {
|
|
16
|
-
type: DataTypes.JSONB, // Store days, time ranges, and conditions as a JSON object
|
|
17
|
-
allowNull: true,
|
|
18
|
-
},
|
|
19
|
-
filters: {
|
|
20
|
-
type: DataTypes.JSONB,
|
|
21
|
-
allowNull: true,
|
|
22
|
-
},
|
|
23
|
-
triggers: {
|
|
24
|
-
type: DataTypes.JSONB,
|
|
25
|
-
allowNull: false,
|
|
26
|
-
},
|
|
27
|
-
actions: {
|
|
28
|
-
type: DataTypes.JSONB,
|
|
29
|
-
allowNull: false,
|
|
30
|
-
},
|
|
31
|
-
status: {
|
|
32
|
-
type: DataTypes.ENUM("active", "paused"),
|
|
33
|
-
allowNull: false,
|
|
34
|
-
defaultValue: "active",
|
|
35
|
-
},
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
return Rule;
|
|
39
|
-
};
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
module.exports = (sequelize, DataTypes) => {
|
|
2
|
-
const RulesValues = sequelize.define(
|
|
3
|
-
"RulesValues",
|
|
4
|
-
{
|
|
5
|
-
id: {
|
|
6
|
-
type: DataTypes.UUID,
|
|
7
|
-
defaultValue: DataTypes.UUIDV4,
|
|
8
|
-
primaryKey: true,
|
|
9
|
-
},
|
|
10
|
-
name: {
|
|
11
|
-
type: DataTypes.STRING,
|
|
12
|
-
allowNull: false,
|
|
13
|
-
},
|
|
14
|
-
code: {
|
|
15
|
-
type: DataTypes.STRING,
|
|
16
|
-
allowNull: false,
|
|
17
|
-
unique: true,
|
|
18
|
-
},
|
|
19
|
-
permissions: {
|
|
20
|
-
type: DataTypes.ARRAY(DataTypes.STRING),
|
|
21
|
-
allowNull: false,
|
|
22
|
-
defaultValue: [],
|
|
23
|
-
},
|
|
24
|
-
feature: {
|
|
25
|
-
type: DataTypes.STRING,
|
|
26
|
-
allowNull: true,
|
|
27
|
-
},
|
|
28
|
-
parentId: {
|
|
29
|
-
type: DataTypes.UUID,
|
|
30
|
-
allowNull: true,
|
|
31
|
-
references: {
|
|
32
|
-
model: "RulesValues",
|
|
33
|
-
key: "id",
|
|
34
|
-
},
|
|
35
|
-
onDelete: "CASCADE",
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
tableName: "RulesValues",
|
|
40
|
-
}
|
|
41
|
-
);
|
|
42
|
-
|
|
43
|
-
// Self-referential association to define sub-rules
|
|
44
|
-
RulesValues.hasMany(RulesValues, {
|
|
45
|
-
as: "subRules",
|
|
46
|
-
foreignKey: "parentId",
|
|
47
|
-
onDelete: "CASCADE",
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
RulesValues.belongsTo(RulesValues, {
|
|
51
|
-
as: "parentRule",
|
|
52
|
-
foreignKey: "parentId",
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
return RulesValues;
|
|
56
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
module.exports = (sequelize, DataTypes) => {
|
|
2
|
-
const SupportedLocale = sequelize.define('SupportedLocale', {
|
|
3
|
-
country: {
|
|
4
|
-
type: DataTypes.STRING,
|
|
5
|
-
allowNull: false,
|
|
6
|
-
},
|
|
7
|
-
locale: {
|
|
8
|
-
type: DataTypes.STRING,
|
|
9
|
-
allowNull: false,
|
|
10
|
-
},
|
|
11
|
-
language: {
|
|
12
|
-
type: DataTypes.STRING,
|
|
13
|
-
allowNull: true,
|
|
14
|
-
comment: 'Language code (e.g., en, es, fr)'
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
// Define associations if needed in the future
|
|
19
|
-
// SupportedLocale.associate = (models) => {
|
|
20
|
-
// // e.g., SupportedLocale.hasMany(models.OtherModel);
|
|
21
|
-
// };
|
|
22
|
-
|
|
23
|
-
return SupportedLocale;
|
|
24
|
-
};
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
const { DataTypes } = require("sequelize");
|
|
2
|
-
|
|
3
|
-
module.exports = (sequelize, DataTypes) => {
|
|
4
|
-
const TonicCampaign = sequelize.define("TonicCampaign", {
|
|
5
|
-
AGRSCID: {
|
|
6
|
-
type: DataTypes.STRING,
|
|
7
|
-
allowNull: false,
|
|
8
|
-
unique: true,
|
|
9
|
-
primaryKey: true,
|
|
10
|
-
},
|
|
11
|
-
CampaignName: {
|
|
12
|
-
type: DataTypes.STRING,
|
|
13
|
-
allowNull: false,
|
|
14
|
-
},
|
|
15
|
-
CampaignID: {
|
|
16
|
-
type: DataTypes.STRING,
|
|
17
|
-
allowNull: true,
|
|
18
|
-
},
|
|
19
|
-
Vertical: {
|
|
20
|
-
type: DataTypes.STRING,
|
|
21
|
-
allowNull: true,
|
|
22
|
-
},
|
|
23
|
-
Offer: {
|
|
24
|
-
type: DataTypes.STRING,
|
|
25
|
-
allowNull: true,
|
|
26
|
-
},
|
|
27
|
-
OfferID: {
|
|
28
|
-
type: DataTypes.STRING,
|
|
29
|
-
allowNull: true,
|
|
30
|
-
},
|
|
31
|
-
Country: {
|
|
32
|
-
type: DataTypes.STRING,
|
|
33
|
-
allowNull: false,
|
|
34
|
-
},
|
|
35
|
-
Domain: {
|
|
36
|
-
type: DataTypes.STRING,
|
|
37
|
-
allowNull: true,
|
|
38
|
-
},
|
|
39
|
-
Imprint: {
|
|
40
|
-
type: DataTypes.STRING,
|
|
41
|
-
allowNull: true,
|
|
42
|
-
defaultValue: "no",
|
|
43
|
-
},
|
|
44
|
-
Status: {
|
|
45
|
-
type: DataTypes.STRING,
|
|
46
|
-
allowNull: false,
|
|
47
|
-
defaultValue: "inactive",
|
|
48
|
-
},
|
|
49
|
-
FinalLink: {
|
|
50
|
-
type: DataTypes.STRING(1024),
|
|
51
|
-
allowNull: true,
|
|
52
|
-
},
|
|
53
|
-
Assignee: {
|
|
54
|
-
type: DataTypes.STRING,
|
|
55
|
-
allowNull: false,
|
|
56
|
-
},
|
|
57
|
-
KW: {
|
|
58
|
-
type: DataTypes.ARRAY(DataTypes.STRING),
|
|
59
|
-
allowNull: true,
|
|
60
|
-
},
|
|
61
|
-
PixelID: {
|
|
62
|
-
type: DataTypes.STRING(1024),
|
|
63
|
-
allowNull: true,
|
|
64
|
-
},
|
|
65
|
-
Token: {
|
|
66
|
-
type: DataTypes.STRING(1024),
|
|
67
|
-
allowNull: true,
|
|
68
|
-
},
|
|
69
|
-
AccountID: {
|
|
70
|
-
type: DataTypes.STRING,
|
|
71
|
-
allowNull: false,
|
|
72
|
-
},
|
|
73
|
-
FeedName: {
|
|
74
|
-
type: DataTypes.STRING,
|
|
75
|
-
allowNull: true,
|
|
76
|
-
},
|
|
77
|
-
AdTitle: {
|
|
78
|
-
type: DataTypes.STRING,
|
|
79
|
-
allowNull: true,
|
|
80
|
-
},
|
|
81
|
-
Target: {
|
|
82
|
-
type: DataTypes.STRING,
|
|
83
|
-
allowNull: true,
|
|
84
|
-
},
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
TonicCampaign.associate = (models) => {
|
|
88
|
-
TonicCampaign.hasMany(models.Ad, {
|
|
89
|
-
foreignKey: "AGRS_CID",
|
|
90
|
-
sourceKey: "AGRSCID",
|
|
91
|
-
constraints: false, // Disable the strict foreign key constraint
|
|
92
|
-
as: "Ads",
|
|
93
|
-
});
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
return TonicCampaign;
|
|
97
|
-
};
|