agrs-sequelize-sdk 1.1.73 → 1.1.75
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/Article.js +5 -1
- package/models/CampaignCreationLog.js +86 -0
- package/package.json +1 -1
package/models/Article.js
CHANGED
|
@@ -41,7 +41,7 @@ module.exports = (sequelize, DataTypes) => {
|
|
|
41
41
|
type: DataTypes.STRING,
|
|
42
42
|
allowNull: true,
|
|
43
43
|
},
|
|
44
|
-
|
|
44
|
+
topics: {
|
|
45
45
|
type: DataTypes.ARRAY(DataTypes.STRING),
|
|
46
46
|
allowNull: true,
|
|
47
47
|
},
|
|
@@ -49,6 +49,10 @@ module.exports = (sequelize, DataTypes) => {
|
|
|
49
49
|
type: DataTypes.STRING,
|
|
50
50
|
allowNull: false,
|
|
51
51
|
},
|
|
52
|
+
keywords: {
|
|
53
|
+
type: DataTypes.ARRAY(DataTypes.STRING),
|
|
54
|
+
allowNull: true,
|
|
55
|
+
},
|
|
52
56
|
date: {
|
|
53
57
|
type: DataTypes.DATE,
|
|
54
58
|
allowNull: true,
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
// models/CampaignCreationLog.js
|
|
2
|
+
module.exports = (sequelize, DataTypes) => {
|
|
3
|
+
const CampaignCreationLog = sequelize.define(
|
|
4
|
+
"CampaignCreationLog",
|
|
5
|
+
{
|
|
6
|
+
id: {
|
|
7
|
+
type: DataTypes.INTEGER,
|
|
8
|
+
primaryKey: true,
|
|
9
|
+
autoIncrement: true,
|
|
10
|
+
},
|
|
11
|
+
process_id: {
|
|
12
|
+
type: DataTypes.UUID,
|
|
13
|
+
allowNull: false,
|
|
14
|
+
comment: "Unique ID for the creation batch process",
|
|
15
|
+
},
|
|
16
|
+
status: {
|
|
17
|
+
type: DataTypes.ENUM("STARTED", "IN_PROGRESS", "COMPLETED", "FAILED"),
|
|
18
|
+
allowNull: false,
|
|
19
|
+
defaultValue: "STARTED",
|
|
20
|
+
},
|
|
21
|
+
country: {
|
|
22
|
+
type: DataTypes.STRING,
|
|
23
|
+
allowNull: true,
|
|
24
|
+
comment: "Country being processed",
|
|
25
|
+
},
|
|
26
|
+
feed_campaign_id: {
|
|
27
|
+
type: DataTypes.STRING,
|
|
28
|
+
allowNull: true,
|
|
29
|
+
comment: "AGRS_CID of the created feed campaign",
|
|
30
|
+
},
|
|
31
|
+
facebook_campaign_id: {
|
|
32
|
+
type: DataTypes.STRING,
|
|
33
|
+
allowNull: true,
|
|
34
|
+
comment: "Facebook campaign ID if created",
|
|
35
|
+
},
|
|
36
|
+
details: {
|
|
37
|
+
type: DataTypes.JSONB,
|
|
38
|
+
allowNull: true,
|
|
39
|
+
comment: "Additional details about the process or results",
|
|
40
|
+
},
|
|
41
|
+
error_message: {
|
|
42
|
+
type: DataTypes.TEXT,
|
|
43
|
+
allowNull: true,
|
|
44
|
+
comment: "Error message if process failed",
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
tableName: "CampaignCreationLogs",
|
|
49
|
+
timestamps: true,
|
|
50
|
+
indexes: [
|
|
51
|
+
{
|
|
52
|
+
fields: ["process_id"],
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
fields: ["status"],
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
fields: ["country"],
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
fields: ["feed_campaign_id"],
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
fields: ["facebook_campaign_id"],
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
fields: ["createdAt"],
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
CampaignCreationLog.associate = (models) => {
|
|
74
|
+
// Add associations if needed
|
|
75
|
+
if (models.CodefuelCampaign) {
|
|
76
|
+
CampaignCreationLog.belongsTo(models.CodefuelCampaign, {
|
|
77
|
+
foreignKey: "feed_campaign_id",
|
|
78
|
+
targetKey: "AGRSCID",
|
|
79
|
+
as: "FeedCampaign",
|
|
80
|
+
constraints: false,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
return CampaignCreationLog;
|
|
86
|
+
};
|