agrs-sequelize-sdk 1.2.13 → 1.2.15
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/AdAccountValues.js +25 -25
- package/models/AdHistory.js +30 -30
- package/models/AdPerformance.js +84 -84
- package/models/AdSetHistory.js +30 -30
- package/models/AdsetPerformance.js +116 -116
- package/models/Article.js +156 -156
- package/models/Buyers.js +25 -25
- package/models/Campaign.js +135 -135
- package/models/CampaignCreationLog.js +86 -86
- package/models/CampaignCreationLogNew.js +141 -141
- package/models/CampaignHistory.js +33 -33
- package/models/Channel.js +55 -55
- package/models/Domain.js +25 -25
- package/models/ExplorAdsChannel.js +61 -61
- package/models/Feed.js +33 -33
- package/models/Pages.js +73 -73
- package/models/PipelineExecution.js +46 -46
- package/models/RSOCFeedCampaign.js +303 -298
- package/models/RsocKeywordPerformance.js +110 -110
- package/models/RulesValues.js +56 -56
- package/models/SupportedLocale.js +23 -23
- package/models/Vertical.js +25 -25
- package/models/newFiles.js +68 -68
- package/package.json +21 -19
- package/run.sh +214 -214
- package/utils/loggerUtils.js +497 -497
|
@@ -1,86 +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
|
-
};
|
|
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
|
+
};
|
|
@@ -1,141 +1,141 @@
|
|
|
1
|
-
module.exports = (sequelize, DataTypes) => {
|
|
2
|
-
const CampaignCreationLogNew = sequelize.define(
|
|
3
|
-
"CampaignCreationLogNew",
|
|
4
|
-
{
|
|
5
|
-
id: {
|
|
6
|
-
type: DataTypes.INTEGER,
|
|
7
|
-
primaryKey: true,
|
|
8
|
-
autoIncrement: true,
|
|
9
|
-
},
|
|
10
|
-
process_id: {
|
|
11
|
-
type: DataTypes.UUID,
|
|
12
|
-
allowNull: false,
|
|
13
|
-
comment: "Unique ID for the creation batch process",
|
|
14
|
-
},
|
|
15
|
-
stage: {
|
|
16
|
-
type: DataTypes.ENUM(
|
|
17
|
-
"PROCESS_STARTED",
|
|
18
|
-
"CAMPAIGN_CREATION",
|
|
19
|
-
"ADSET_CREATION",
|
|
20
|
-
"AD_CREATION"
|
|
21
|
-
),
|
|
22
|
-
allowNull: false,
|
|
23
|
-
comment: "Current stage of the campaign creation process",
|
|
24
|
-
},
|
|
25
|
-
status: {
|
|
26
|
-
type: DataTypes.ENUM("STARTED", "IN_PROGRESS", "COMPLETED", "FAILED"),
|
|
27
|
-
allowNull: false,
|
|
28
|
-
defaultValue: "STARTED",
|
|
29
|
-
comment: "Status of the current stage",
|
|
30
|
-
},
|
|
31
|
-
country: {
|
|
32
|
-
type: DataTypes.STRING,
|
|
33
|
-
allowNull: true,
|
|
34
|
-
comment: "Country being processed",
|
|
35
|
-
},
|
|
36
|
-
feed_campaign_id: {
|
|
37
|
-
type: DataTypes.STRING,
|
|
38
|
-
allowNull: true,
|
|
39
|
-
comment: "AGRS_CID of the created feed campaign",
|
|
40
|
-
},
|
|
41
|
-
facebook_campaign_id: {
|
|
42
|
-
type: DataTypes.STRING,
|
|
43
|
-
allowNull: true,
|
|
44
|
-
comment: "Facebook campaign ID if created",
|
|
45
|
-
},
|
|
46
|
-
facebook_adset_id: {
|
|
47
|
-
type: DataTypes.STRING,
|
|
48
|
-
allowNull: true,
|
|
49
|
-
comment: "Facebook adset ID if created",
|
|
50
|
-
},
|
|
51
|
-
facebook_ad_id: {
|
|
52
|
-
type: DataTypes.STRING,
|
|
53
|
-
allowNull: true,
|
|
54
|
-
comment: "Facebook ad ID if created",
|
|
55
|
-
},
|
|
56
|
-
parent_id: {
|
|
57
|
-
type: DataTypes.STRING,
|
|
58
|
-
allowNull: true,
|
|
59
|
-
comment: "Parent entity ID (campaign ID for adsets, adset ID for ads)",
|
|
60
|
-
},
|
|
61
|
-
entity_name: {
|
|
62
|
-
type: DataTypes.STRING,
|
|
63
|
-
allowNull: true,
|
|
64
|
-
comment: "Name of the created entity (campaign, adset, or ad name)",
|
|
65
|
-
},
|
|
66
|
-
entity_index: {
|
|
67
|
-
type: DataTypes.INTEGER,
|
|
68
|
-
allowNull: true,
|
|
69
|
-
comment:
|
|
70
|
-
"Index of this entity in a collection (for multiple adsets/ads)",
|
|
71
|
-
},
|
|
72
|
-
details: {
|
|
73
|
-
type: DataTypes.JSONB,
|
|
74
|
-
allowNull: true,
|
|
75
|
-
comment:
|
|
76
|
-
"Structured details about the stage, including original request, campaign, adset, or ad data",
|
|
77
|
-
},
|
|
78
|
-
error_message: {
|
|
79
|
-
type: DataTypes.TEXT,
|
|
80
|
-
allowNull: true,
|
|
81
|
-
comment: "Error message if process failed",
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
tableName: "CampaignCreationLogsNew",
|
|
86
|
-
timestamps: true,
|
|
87
|
-
indexes: [
|
|
88
|
-
{
|
|
89
|
-
fields: ["process_id"],
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
fields: ["stage"],
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
fields: ["status"],
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
fields: ["country"],
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
fields: ["feed_campaign_id"],
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
fields: ["facebook_campaign_id"],
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
fields: ["facebook_adset_id"],
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
fields: ["facebook_ad_id"],
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
fields: ["parent_id"],
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
fields: ["entity_name"],
|
|
117
|
-
},
|
|
118
|
-
{
|
|
119
|
-
fields: ["entity_index"],
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
fields: ["createdAt"],
|
|
123
|
-
},
|
|
124
|
-
],
|
|
125
|
-
}
|
|
126
|
-
);
|
|
127
|
-
|
|
128
|
-
CampaignCreationLogNew.associate = (models) => {
|
|
129
|
-
// Add associations if needed
|
|
130
|
-
if (models.CodefuelCampaign) {
|
|
131
|
-
CampaignCreationLogNew.belongsTo(models.CodefuelCampaign, {
|
|
132
|
-
foreignKey: "feed_campaign_id",
|
|
133
|
-
targetKey: "AGRSCID",
|
|
134
|
-
as: "FeedCampaign",
|
|
135
|
-
constraints: false,
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
};
|
|
139
|
-
|
|
140
|
-
return CampaignCreationLogNew;
|
|
141
|
-
};
|
|
1
|
+
module.exports = (sequelize, DataTypes) => {
|
|
2
|
+
const CampaignCreationLogNew = sequelize.define(
|
|
3
|
+
"CampaignCreationLogNew",
|
|
4
|
+
{
|
|
5
|
+
id: {
|
|
6
|
+
type: DataTypes.INTEGER,
|
|
7
|
+
primaryKey: true,
|
|
8
|
+
autoIncrement: true,
|
|
9
|
+
},
|
|
10
|
+
process_id: {
|
|
11
|
+
type: DataTypes.UUID,
|
|
12
|
+
allowNull: false,
|
|
13
|
+
comment: "Unique ID for the creation batch process",
|
|
14
|
+
},
|
|
15
|
+
stage: {
|
|
16
|
+
type: DataTypes.ENUM(
|
|
17
|
+
"PROCESS_STARTED",
|
|
18
|
+
"CAMPAIGN_CREATION",
|
|
19
|
+
"ADSET_CREATION",
|
|
20
|
+
"AD_CREATION"
|
|
21
|
+
),
|
|
22
|
+
allowNull: false,
|
|
23
|
+
comment: "Current stage of the campaign creation process",
|
|
24
|
+
},
|
|
25
|
+
status: {
|
|
26
|
+
type: DataTypes.ENUM("STARTED", "IN_PROGRESS", "COMPLETED", "FAILED"),
|
|
27
|
+
allowNull: false,
|
|
28
|
+
defaultValue: "STARTED",
|
|
29
|
+
comment: "Status of the current stage",
|
|
30
|
+
},
|
|
31
|
+
country: {
|
|
32
|
+
type: DataTypes.STRING,
|
|
33
|
+
allowNull: true,
|
|
34
|
+
comment: "Country being processed",
|
|
35
|
+
},
|
|
36
|
+
feed_campaign_id: {
|
|
37
|
+
type: DataTypes.STRING,
|
|
38
|
+
allowNull: true,
|
|
39
|
+
comment: "AGRS_CID of the created feed campaign",
|
|
40
|
+
},
|
|
41
|
+
facebook_campaign_id: {
|
|
42
|
+
type: DataTypes.STRING,
|
|
43
|
+
allowNull: true,
|
|
44
|
+
comment: "Facebook campaign ID if created",
|
|
45
|
+
},
|
|
46
|
+
facebook_adset_id: {
|
|
47
|
+
type: DataTypes.STRING,
|
|
48
|
+
allowNull: true,
|
|
49
|
+
comment: "Facebook adset ID if created",
|
|
50
|
+
},
|
|
51
|
+
facebook_ad_id: {
|
|
52
|
+
type: DataTypes.STRING,
|
|
53
|
+
allowNull: true,
|
|
54
|
+
comment: "Facebook ad ID if created",
|
|
55
|
+
},
|
|
56
|
+
parent_id: {
|
|
57
|
+
type: DataTypes.STRING,
|
|
58
|
+
allowNull: true,
|
|
59
|
+
comment: "Parent entity ID (campaign ID for adsets, adset ID for ads)",
|
|
60
|
+
},
|
|
61
|
+
entity_name: {
|
|
62
|
+
type: DataTypes.STRING,
|
|
63
|
+
allowNull: true,
|
|
64
|
+
comment: "Name of the created entity (campaign, adset, or ad name)",
|
|
65
|
+
},
|
|
66
|
+
entity_index: {
|
|
67
|
+
type: DataTypes.INTEGER,
|
|
68
|
+
allowNull: true,
|
|
69
|
+
comment:
|
|
70
|
+
"Index of this entity in a collection (for multiple adsets/ads)",
|
|
71
|
+
},
|
|
72
|
+
details: {
|
|
73
|
+
type: DataTypes.JSONB,
|
|
74
|
+
allowNull: true,
|
|
75
|
+
comment:
|
|
76
|
+
"Structured details about the stage, including original request, campaign, adset, or ad data",
|
|
77
|
+
},
|
|
78
|
+
error_message: {
|
|
79
|
+
type: DataTypes.TEXT,
|
|
80
|
+
allowNull: true,
|
|
81
|
+
comment: "Error message if process failed",
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
tableName: "CampaignCreationLogsNew",
|
|
86
|
+
timestamps: true,
|
|
87
|
+
indexes: [
|
|
88
|
+
{
|
|
89
|
+
fields: ["process_id"],
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
fields: ["stage"],
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
fields: ["status"],
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
fields: ["country"],
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
fields: ["feed_campaign_id"],
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
fields: ["facebook_campaign_id"],
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
fields: ["facebook_adset_id"],
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
fields: ["facebook_ad_id"],
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
fields: ["parent_id"],
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
fields: ["entity_name"],
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
fields: ["entity_index"],
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
fields: ["createdAt"],
|
|
123
|
+
},
|
|
124
|
+
],
|
|
125
|
+
}
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
CampaignCreationLogNew.associate = (models) => {
|
|
129
|
+
// Add associations if needed
|
|
130
|
+
if (models.CodefuelCampaign) {
|
|
131
|
+
CampaignCreationLogNew.belongsTo(models.CodefuelCampaign, {
|
|
132
|
+
foreignKey: "feed_campaign_id",
|
|
133
|
+
targetKey: "AGRSCID",
|
|
134
|
+
as: "FeedCampaign",
|
|
135
|
+
constraints: false,
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
return CampaignCreationLogNew;
|
|
141
|
+
};
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
module.exports = (sequelize, DataTypes) => {
|
|
2
|
-
const CampaignHistory = sequelize.define(
|
|
3
|
-
"CampaignHistory",
|
|
4
|
-
{
|
|
5
|
-
HistoryID: {
|
|
6
|
-
type: DataTypes.UUID,
|
|
7
|
-
defaultValue: DataTypes.UUIDV4,
|
|
8
|
-
primaryKey: true,
|
|
9
|
-
},
|
|
10
|
-
CampaignID: {
|
|
11
|
-
type: DataTypes.STRING,
|
|
12
|
-
allowNull: false,
|
|
13
|
-
},
|
|
14
|
-
TableName: {
|
|
15
|
-
type: DataTypes.STRING, // Useful for multi-table history tracking
|
|
16
|
-
defaultValue: "Campaign",
|
|
17
|
-
},
|
|
18
|
-
DataSnapshot: {
|
|
19
|
-
type: DataTypes.JSONB, // Store the entire row as JSON
|
|
20
|
-
allowNull: false,
|
|
21
|
-
},
|
|
22
|
-
timestamp: {
|
|
23
|
-
type: DataTypes.DATE,
|
|
24
|
-
defaultValue: DataTypes.NOW,
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
tableName: "CampaignHistory",
|
|
29
|
-
}
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
return CampaignHistory;
|
|
33
|
-
};
|
|
1
|
+
module.exports = (sequelize, DataTypes) => {
|
|
2
|
+
const CampaignHistory = sequelize.define(
|
|
3
|
+
"CampaignHistory",
|
|
4
|
+
{
|
|
5
|
+
HistoryID: {
|
|
6
|
+
type: DataTypes.UUID,
|
|
7
|
+
defaultValue: DataTypes.UUIDV4,
|
|
8
|
+
primaryKey: true,
|
|
9
|
+
},
|
|
10
|
+
CampaignID: {
|
|
11
|
+
type: DataTypes.STRING,
|
|
12
|
+
allowNull: false,
|
|
13
|
+
},
|
|
14
|
+
TableName: {
|
|
15
|
+
type: DataTypes.STRING, // Useful for multi-table history tracking
|
|
16
|
+
defaultValue: "Campaign",
|
|
17
|
+
},
|
|
18
|
+
DataSnapshot: {
|
|
19
|
+
type: DataTypes.JSONB, // Store the entire row as JSON
|
|
20
|
+
allowNull: false,
|
|
21
|
+
},
|
|
22
|
+
timestamp: {
|
|
23
|
+
type: DataTypes.DATE,
|
|
24
|
+
defaultValue: DataTypes.NOW,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
tableName: "CampaignHistory",
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
return CampaignHistory;
|
|
33
|
+
};
|
package/models/Channel.js
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
module.exports = (sequelize, DataTypes) => {
|
|
2
|
-
const Channel = sequelize.define(
|
|
3
|
-
"Channel",
|
|
4
|
-
{
|
|
5
|
-
channelId: {
|
|
6
|
-
type: DataTypes.STRING,
|
|
7
|
-
allowNull: false,
|
|
8
|
-
// Not setting as primary key or unique since duplicates are allowed
|
|
9
|
-
},
|
|
10
|
-
styleId: {
|
|
11
|
-
type: DataTypes.STRING,
|
|
12
|
-
allowNull: false,
|
|
13
|
-
},
|
|
14
|
-
status: {
|
|
15
|
-
type: DataTypes.STRING,
|
|
16
|
-
allowNull: false,
|
|
17
|
-
defaultValue: "free",
|
|
18
|
-
validate: {
|
|
19
|
-
isIn: [["free", "used", "archived"]],
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
connectedCampaigns: {
|
|
23
|
-
type: DataTypes.JSONB, // Use JSONB for better querying capabilities
|
|
24
|
-
allowNull: false,
|
|
25
|
-
defaultValue: [],
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
tableName: "channels",
|
|
30
|
-
timestamps: true,
|
|
31
|
-
indexes: [
|
|
32
|
-
// Add a composite unique index on channelId and styleId if needed
|
|
33
|
-
{
|
|
34
|
-
unique: true,
|
|
35
|
-
fields: ["channelId", "styleId"],
|
|
36
|
-
name: "unique_channel_style",
|
|
37
|
-
},
|
|
38
|
-
],
|
|
39
|
-
}
|
|
40
|
-
);
|
|
41
|
-
|
|
42
|
-
// Define associations without enforcing constraints
|
|
43
|
-
Channel.associate = (models) => {
|
|
44
|
-
if (models.RSOCFeedCampaign) {
|
|
45
|
-
Channel.hasMany(models.RSOCFeedCampaign, {
|
|
46
|
-
foreignKey: "channelId",
|
|
47
|
-
sourceKey: "channelId",
|
|
48
|
-
as: "RSOCFeedCampaigns",
|
|
49
|
-
constraints: false, // Disable FK constraint
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
return Channel;
|
|
55
|
-
};
|
|
1
|
+
module.exports = (sequelize, DataTypes) => {
|
|
2
|
+
const Channel = sequelize.define(
|
|
3
|
+
"Channel",
|
|
4
|
+
{
|
|
5
|
+
channelId: {
|
|
6
|
+
type: DataTypes.STRING,
|
|
7
|
+
allowNull: false,
|
|
8
|
+
// Not setting as primary key or unique since duplicates are allowed
|
|
9
|
+
},
|
|
10
|
+
styleId: {
|
|
11
|
+
type: DataTypes.STRING,
|
|
12
|
+
allowNull: false,
|
|
13
|
+
},
|
|
14
|
+
status: {
|
|
15
|
+
type: DataTypes.STRING,
|
|
16
|
+
allowNull: false,
|
|
17
|
+
defaultValue: "free",
|
|
18
|
+
validate: {
|
|
19
|
+
isIn: [["free", "used", "archived"]],
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
connectedCampaigns: {
|
|
23
|
+
type: DataTypes.JSONB, // Use JSONB for better querying capabilities
|
|
24
|
+
allowNull: false,
|
|
25
|
+
defaultValue: [],
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
tableName: "channels",
|
|
30
|
+
timestamps: true,
|
|
31
|
+
indexes: [
|
|
32
|
+
// Add a composite unique index on channelId and styleId if needed
|
|
33
|
+
{
|
|
34
|
+
unique: true,
|
|
35
|
+
fields: ["channelId", "styleId"],
|
|
36
|
+
name: "unique_channel_style",
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
// Define associations without enforcing constraints
|
|
43
|
+
Channel.associate = (models) => {
|
|
44
|
+
if (models.RSOCFeedCampaign) {
|
|
45
|
+
Channel.hasMany(models.RSOCFeedCampaign, {
|
|
46
|
+
foreignKey: "channelId",
|
|
47
|
+
sourceKey: "channelId",
|
|
48
|
+
as: "RSOCFeedCampaigns",
|
|
49
|
+
constraints: false, // Disable FK constraint
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
return Channel;
|
|
55
|
+
};
|
package/models/Domain.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
module.exports = (sequelize, DataTypes) => {
|
|
2
|
-
const Domain = sequelize.define(
|
|
3
|
-
"Domain",
|
|
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
|
-
},
|
|
20
|
-
{
|
|
21
|
-
tableName: "Domain",
|
|
22
|
-
}
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
return Domain;
|
|
1
|
+
module.exports = (sequelize, DataTypes) => {
|
|
2
|
+
const Domain = sequelize.define(
|
|
3
|
+
"Domain",
|
|
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
|
+
},
|
|
20
|
+
{
|
|
21
|
+
tableName: "Domain",
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
return Domain;
|
|
26
26
|
};
|