agrs-sequelize-sdk 1.4.12 → 1.4.13
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/migrations/add-requested-from-dashboard-to-articles.js +17 -17
- package/migrations/change-adset-name-to-text.js +79 -79
- package/models/AICampaignQueue.js +136 -136
- package/models/AIGenerationLog.js +85 -85
- package/models/AIGenerationRequest.js +212 -212
- package/models/AdAccountValues.js +25 -25
- package/models/AdHistory.js +30 -30
- package/models/AdPerformance.js +94 -94
- package/models/AdSet.js +289 -289
- package/models/AdSetHistory.js +30 -30
- package/models/AdsetPerformance.js +126 -126
- package/models/AiArticleRetryQueue.js +150 -150
- package/models/AiCreationRetryQueue.js +127 -127
- package/models/Article.js +206 -206
- package/models/AutomationRule.js +173 -173
- package/models/BannerTemplate.js +129 -129
- package/models/Buyers.js +25 -25
- package/models/Campaign.js +157 -157
- package/models/CampaignActionHistory.js +86 -86
- package/models/CampaignCreationLog.js +309 -309
- package/models/CampaignCreationLogV2.js +314 -314
- package/models/CampaignHistory.js +33 -33
- package/models/Channel.js +55 -55
- package/models/Domain.js +43 -43
- package/models/DynamicFeed.js +212 -212
- package/models/ExplorAdsChannel.js +61 -61
- package/models/FacebookRetryQueue.js +156 -156
- package/models/Feed.js +33 -33
- package/models/FeedArticleConfiguration.js +80 -80
- package/models/FrontStoryChannel.js +59 -59
- package/models/FrontStoryChannelV2.js +60 -60
- package/models/GenericFlowRequest.js +114 -114
- package/models/MidoWebChannel.js +47 -47
- package/models/MineChannel.js +42 -42
- package/models/Pages.js +99 -99
- package/models/PipelineExecution.js +59 -59
- package/models/PolicyDogsCreativeCache.js +50 -50
- package/models/PolicyDogsImageCache.js +30 -30
- package/models/Presets.js +34 -34
- package/models/RSOCFeedCampaign.js +375 -375
- package/models/RsocKeywordPerformance.js +110 -110
- package/models/RuleAction.js +90 -90
- package/models/RuleCondition.js +137 -137
- package/models/RuleExecution.js +107 -107
- package/models/RulesValues.js +56 -56
- package/models/SupportedLocale.js +23 -23
- package/models/SyncHistory.js +249 -249
- package/models/TTQChannel.js +42 -42
- package/models/TemplateMetadata.js +260 -260
- package/models/Tier2_AdAccounts.js +110 -110
- package/models/Tier2_Assets.js +70 -70
- package/models/Tier2_BusinessManagers.js +105 -105
- package/models/Tier2_CreditLines.js +99 -99
- package/models/Tier2_Pages.js +91 -91
- package/models/Tier2_Pixels.js +82 -82
- package/models/Tier2_Tokens.js +64 -64
- package/models/Tier2_UserAdAccounts.js +83 -83
- package/models/TokenRotationState.js +121 -121
- package/models/TonicRSOCKeywordPerformance.js +122 -122
- package/models/Users.js +148 -148
- package/models/Vertical.js +25 -25
- package/models/newFiles.js +137 -137
- package/package.json +19 -21
- package/run.sh +214 -214
- package/services/sequelizeService.js +110 -110
package/models/Campaign.js
CHANGED
|
@@ -1,157 +1,157 @@
|
|
|
1
|
-
module.exports = (sequelize, DataTypes) => {
|
|
2
|
-
const Campaign = sequelize.define(
|
|
3
|
-
"Campaign",
|
|
4
|
-
{
|
|
5
|
-
CampaignID: {
|
|
6
|
-
type: DataTypes.STRING,
|
|
7
|
-
primaryKey: true,
|
|
8
|
-
},
|
|
9
|
-
CampaignName: {
|
|
10
|
-
type: DataTypes.TEXT,
|
|
11
|
-
allowNull: true,
|
|
12
|
-
},
|
|
13
|
-
pixelId: {
|
|
14
|
-
type: DataTypes.STRING,
|
|
15
|
-
allowNull: true,
|
|
16
|
-
},
|
|
17
|
-
customEventType: {
|
|
18
|
-
type: DataTypes.STRING,
|
|
19
|
-
allowNull: false,
|
|
20
|
-
defaultValue: "PURCHASE",
|
|
21
|
-
},
|
|
22
|
-
objective: {
|
|
23
|
-
type: DataTypes.STRING,
|
|
24
|
-
allowNull: false,
|
|
25
|
-
defaultValue: "OUTCOME_SALES",
|
|
26
|
-
},
|
|
27
|
-
status: {
|
|
28
|
-
type: DataTypes.STRING,
|
|
29
|
-
allowNull: true,
|
|
30
|
-
},
|
|
31
|
-
AdAccountID: {
|
|
32
|
-
type: DataTypes.STRING,
|
|
33
|
-
allowNull: false,
|
|
34
|
-
references: {
|
|
35
|
-
model: "AdAccount",
|
|
36
|
-
key: "AdAccountID",
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
CreatedTime: {
|
|
40
|
-
type: DataTypes.DATE,
|
|
41
|
-
allowNull: false,
|
|
42
|
-
},
|
|
43
|
-
CampaignDelivery: {
|
|
44
|
-
type: DataTypes.STRING,
|
|
45
|
-
allowNull: true,
|
|
46
|
-
},
|
|
47
|
-
DailyBudget: {
|
|
48
|
-
type: DataTypes.INTEGER,
|
|
49
|
-
allowNull: true,
|
|
50
|
-
},
|
|
51
|
-
Draft: {
|
|
52
|
-
type: DataTypes.BOOLEAN,
|
|
53
|
-
allowNull: true,
|
|
54
|
-
defaultValue: false,
|
|
55
|
-
},
|
|
56
|
-
publish: {
|
|
57
|
-
type: DataTypes.BOOLEAN,
|
|
58
|
-
allowNull: true,
|
|
59
|
-
defaultValue: true,
|
|
60
|
-
},
|
|
61
|
-
UserCreated: {
|
|
62
|
-
type: DataTypes.STRING,
|
|
63
|
-
allowNull: true,
|
|
64
|
-
},
|
|
65
|
-
special_ad_categories: {
|
|
66
|
-
type: DataTypes.ARRAY(DataTypes.STRING),
|
|
67
|
-
allowNull: true,
|
|
68
|
-
},
|
|
69
|
-
effectiveStatus: {
|
|
70
|
-
type: DataTypes.STRING,
|
|
71
|
-
allowNull: true,
|
|
72
|
-
},
|
|
73
|
-
issuesInfo: {
|
|
74
|
-
type: DataTypes.JSONB,
|
|
75
|
-
allowNull: true,
|
|
76
|
-
},
|
|
77
|
-
waiting: {
|
|
78
|
-
type: DataTypes.BOOLEAN,
|
|
79
|
-
defaultValue: false,
|
|
80
|
-
},
|
|
81
|
-
policy_status: {
|
|
82
|
-
type: DataTypes.STRING,
|
|
83
|
-
allowNull: true,
|
|
84
|
-
comment: "Facebook policy status: APPROVED, DENIED, PENDING, etc.",
|
|
85
|
-
},
|
|
86
|
-
policy_rejection_reason: {
|
|
87
|
-
type: DataTypes.TEXT,
|
|
88
|
-
allowNull: true,
|
|
89
|
-
comment: "Detailed reason for policy rejection",
|
|
90
|
-
},
|
|
91
|
-
first_spend_date: {
|
|
92
|
-
type: DataTypes.DATEONLY,
|
|
93
|
-
allowNull: true,
|
|
94
|
-
comment:
|
|
95
|
-
"First date when campaign had spend > 0 (for accurate days_running calculation)",
|
|
96
|
-
},
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
tableName: "Campaign",
|
|
100
|
-
indexes: [
|
|
101
|
-
{
|
|
102
|
-
fields: ["AdAccountID"], // Index on AdAccountID for faster joins
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
fields: ["first_spend_date"], // Index for days_running calculations
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
fields: ["CampaignID", "first_spend_date"], // Composite index for performance queries
|
|
109
|
-
},
|
|
110
|
-
],
|
|
111
|
-
}
|
|
112
|
-
);
|
|
113
|
-
|
|
114
|
-
// Define associations
|
|
115
|
-
Campaign.associate = (models) => {
|
|
116
|
-
Campaign.belongsTo(models.AdAccount, { foreignKey: "AdAccountID" });
|
|
117
|
-
Campaign.hasMany(models.AdSet, { foreignKey: "CampaignID" });
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
// Combined beforeUpdate hook
|
|
121
|
-
Campaign.addHook("beforeUpdate", async (campaign, options) => {
|
|
122
|
-
if (campaign.changed("publish")) {
|
|
123
|
-
if (campaign.previous("publish") === true && campaign.publish === false) {
|
|
124
|
-
// Save current state to CampaignHistory
|
|
125
|
-
await sequelize.models.CampaignHistory.create({
|
|
126
|
-
CampaignID: campaign.CampaignID,
|
|
127
|
-
DataSnapshot: campaign._previousDataValues, // Store current state as JSON
|
|
128
|
-
});
|
|
129
|
-
} else if (
|
|
130
|
-
campaign.previous("publish") === false &&
|
|
131
|
-
campaign.publish === true
|
|
132
|
-
) {
|
|
133
|
-
// Delete the latest history entry
|
|
134
|
-
const latestHistory = await sequelize.models.CampaignHistory.findOne({
|
|
135
|
-
where: { CampaignID: campaign.CampaignID },
|
|
136
|
-
order: [["timestamp", "DESC"]], // Get the latest history entry
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
if (latestHistory) {
|
|
140
|
-
await latestHistory.destroy(); // Delete the latest history entry
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
Campaign.addHook("afterCreate", async (campaign, options) => {
|
|
147
|
-
if (campaign.publish === false) {
|
|
148
|
-
// If publish is false on creation, save a snapshot to CampaignHistory
|
|
149
|
-
await sequelize.models.CampaignHistory.create({
|
|
150
|
-
CampaignID: campaign.CampaignID,
|
|
151
|
-
DataSnapshot: campaign.toJSON(), // Save current state
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
return Campaign;
|
|
157
|
-
};
|
|
1
|
+
module.exports = (sequelize, DataTypes) => {
|
|
2
|
+
const Campaign = sequelize.define(
|
|
3
|
+
"Campaign",
|
|
4
|
+
{
|
|
5
|
+
CampaignID: {
|
|
6
|
+
type: DataTypes.STRING,
|
|
7
|
+
primaryKey: true,
|
|
8
|
+
},
|
|
9
|
+
CampaignName: {
|
|
10
|
+
type: DataTypes.TEXT,
|
|
11
|
+
allowNull: true,
|
|
12
|
+
},
|
|
13
|
+
pixelId: {
|
|
14
|
+
type: DataTypes.STRING,
|
|
15
|
+
allowNull: true,
|
|
16
|
+
},
|
|
17
|
+
customEventType: {
|
|
18
|
+
type: DataTypes.STRING,
|
|
19
|
+
allowNull: false,
|
|
20
|
+
defaultValue: "PURCHASE",
|
|
21
|
+
},
|
|
22
|
+
objective: {
|
|
23
|
+
type: DataTypes.STRING,
|
|
24
|
+
allowNull: false,
|
|
25
|
+
defaultValue: "OUTCOME_SALES",
|
|
26
|
+
},
|
|
27
|
+
status: {
|
|
28
|
+
type: DataTypes.STRING,
|
|
29
|
+
allowNull: true,
|
|
30
|
+
},
|
|
31
|
+
AdAccountID: {
|
|
32
|
+
type: DataTypes.STRING,
|
|
33
|
+
allowNull: false,
|
|
34
|
+
references: {
|
|
35
|
+
model: "AdAccount",
|
|
36
|
+
key: "AdAccountID",
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
CreatedTime: {
|
|
40
|
+
type: DataTypes.DATE,
|
|
41
|
+
allowNull: false,
|
|
42
|
+
},
|
|
43
|
+
CampaignDelivery: {
|
|
44
|
+
type: DataTypes.STRING,
|
|
45
|
+
allowNull: true,
|
|
46
|
+
},
|
|
47
|
+
DailyBudget: {
|
|
48
|
+
type: DataTypes.INTEGER,
|
|
49
|
+
allowNull: true,
|
|
50
|
+
},
|
|
51
|
+
Draft: {
|
|
52
|
+
type: DataTypes.BOOLEAN,
|
|
53
|
+
allowNull: true,
|
|
54
|
+
defaultValue: false,
|
|
55
|
+
},
|
|
56
|
+
publish: {
|
|
57
|
+
type: DataTypes.BOOLEAN,
|
|
58
|
+
allowNull: true,
|
|
59
|
+
defaultValue: true,
|
|
60
|
+
},
|
|
61
|
+
UserCreated: {
|
|
62
|
+
type: DataTypes.STRING,
|
|
63
|
+
allowNull: true,
|
|
64
|
+
},
|
|
65
|
+
special_ad_categories: {
|
|
66
|
+
type: DataTypes.ARRAY(DataTypes.STRING),
|
|
67
|
+
allowNull: true,
|
|
68
|
+
},
|
|
69
|
+
effectiveStatus: {
|
|
70
|
+
type: DataTypes.STRING,
|
|
71
|
+
allowNull: true,
|
|
72
|
+
},
|
|
73
|
+
issuesInfo: {
|
|
74
|
+
type: DataTypes.JSONB,
|
|
75
|
+
allowNull: true,
|
|
76
|
+
},
|
|
77
|
+
waiting: {
|
|
78
|
+
type: DataTypes.BOOLEAN,
|
|
79
|
+
defaultValue: false,
|
|
80
|
+
},
|
|
81
|
+
policy_status: {
|
|
82
|
+
type: DataTypes.STRING,
|
|
83
|
+
allowNull: true,
|
|
84
|
+
comment: "Facebook policy status: APPROVED, DENIED, PENDING, etc.",
|
|
85
|
+
},
|
|
86
|
+
policy_rejection_reason: {
|
|
87
|
+
type: DataTypes.TEXT,
|
|
88
|
+
allowNull: true,
|
|
89
|
+
comment: "Detailed reason for policy rejection",
|
|
90
|
+
},
|
|
91
|
+
first_spend_date: {
|
|
92
|
+
type: DataTypes.DATEONLY,
|
|
93
|
+
allowNull: true,
|
|
94
|
+
comment:
|
|
95
|
+
"First date when campaign had spend > 0 (for accurate days_running calculation)",
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
tableName: "Campaign",
|
|
100
|
+
indexes: [
|
|
101
|
+
{
|
|
102
|
+
fields: ["AdAccountID"], // Index on AdAccountID for faster joins
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
fields: ["first_spend_date"], // Index for days_running calculations
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
fields: ["CampaignID", "first_spend_date"], // Composite index for performance queries
|
|
109
|
+
},
|
|
110
|
+
],
|
|
111
|
+
}
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
// Define associations
|
|
115
|
+
Campaign.associate = (models) => {
|
|
116
|
+
Campaign.belongsTo(models.AdAccount, { foreignKey: "AdAccountID" });
|
|
117
|
+
Campaign.hasMany(models.AdSet, { foreignKey: "CampaignID" });
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
// Combined beforeUpdate hook
|
|
121
|
+
Campaign.addHook("beforeUpdate", async (campaign, options) => {
|
|
122
|
+
if (campaign.changed("publish")) {
|
|
123
|
+
if (campaign.previous("publish") === true && campaign.publish === false) {
|
|
124
|
+
// Save current state to CampaignHistory
|
|
125
|
+
await sequelize.models.CampaignHistory.create({
|
|
126
|
+
CampaignID: campaign.CampaignID,
|
|
127
|
+
DataSnapshot: campaign._previousDataValues, // Store current state as JSON
|
|
128
|
+
});
|
|
129
|
+
} else if (
|
|
130
|
+
campaign.previous("publish") === false &&
|
|
131
|
+
campaign.publish === true
|
|
132
|
+
) {
|
|
133
|
+
// Delete the latest history entry
|
|
134
|
+
const latestHistory = await sequelize.models.CampaignHistory.findOne({
|
|
135
|
+
where: { CampaignID: campaign.CampaignID },
|
|
136
|
+
order: [["timestamp", "DESC"]], // Get the latest history entry
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
if (latestHistory) {
|
|
140
|
+
await latestHistory.destroy(); // Delete the latest history entry
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
Campaign.addHook("afterCreate", async (campaign, options) => {
|
|
147
|
+
if (campaign.publish === false) {
|
|
148
|
+
// If publish is false on creation, save a snapshot to CampaignHistory
|
|
149
|
+
await sequelize.models.CampaignHistory.create({
|
|
150
|
+
CampaignID: campaign.CampaignID,
|
|
151
|
+
DataSnapshot: campaign.toJSON(), // Save current state
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
return Campaign;
|
|
157
|
+
};
|
|
@@ -1,86 +1,86 @@
|
|
|
1
|
-
module.exports = (sequelize, DataTypes) => {
|
|
2
|
-
const CampaignActionHistory = sequelize.define(
|
|
3
|
-
"CampaignActionHistory",
|
|
4
|
-
{
|
|
5
|
-
id: {
|
|
6
|
-
type: DataTypes.UUID,
|
|
7
|
-
defaultValue: DataTypes.UUIDV4,
|
|
8
|
-
primaryKey: true,
|
|
9
|
-
},
|
|
10
|
-
objectId: {
|
|
11
|
-
type: DataTypes.STRING,
|
|
12
|
-
allowNull: false,
|
|
13
|
-
comment:
|
|
14
|
-
"ID of the object being tracked (campaignId, AGRSCID, adsetId, etc.)",
|
|
15
|
-
index: true,
|
|
16
|
-
},
|
|
17
|
-
objectType: {
|
|
18
|
-
type: DataTypes.ENUM("campaign", "agrscid", "adset", "ad"),
|
|
19
|
-
allowNull: false,
|
|
20
|
-
comment: "Type of object to know what objectId represents",
|
|
21
|
-
index: true,
|
|
22
|
-
},
|
|
23
|
-
actionType: {
|
|
24
|
-
type: DataTypes.STRING,
|
|
25
|
-
allowNull: false,
|
|
26
|
-
comment:
|
|
27
|
-
"Type of action: budget_update, bid_update, keyword_update, duplicated, etc.",
|
|
28
|
-
index: true,
|
|
29
|
-
},
|
|
30
|
-
previousValue: {
|
|
31
|
-
type: DataTypes.JSON,
|
|
32
|
-
allowNull: true,
|
|
33
|
-
comment: "Previous value before the action",
|
|
34
|
-
},
|
|
35
|
-
newValue: {
|
|
36
|
-
type: DataTypes.JSON,
|
|
37
|
-
allowNull: true,
|
|
38
|
-
comment: "New value after the action",
|
|
39
|
-
},
|
|
40
|
-
details: {
|
|
41
|
-
type: DataTypes.JSON,
|
|
42
|
-
allowNull: true,
|
|
43
|
-
comment: "Additional context and metadata about the action",
|
|
44
|
-
},
|
|
45
|
-
userId: {
|
|
46
|
-
type: DataTypes.STRING,
|
|
47
|
-
allowNull: true,
|
|
48
|
-
comment: "ID of the user who performed the action",
|
|
49
|
-
},
|
|
50
|
-
createdAt: {
|
|
51
|
-
type: DataTypes.DATE,
|
|
52
|
-
defaultValue: DataTypes.NOW,
|
|
53
|
-
allowNull: false,
|
|
54
|
-
index: true,
|
|
55
|
-
},
|
|
56
|
-
updatedAt: {
|
|
57
|
-
type: DataTypes.DATE,
|
|
58
|
-
defaultValue: DataTypes.NOW,
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
tableName: "CampaignActionHistories",
|
|
63
|
-
timestamps: true,
|
|
64
|
-
indexes: [
|
|
65
|
-
{
|
|
66
|
-
fields: ["objectId", "objectType"],
|
|
67
|
-
name: "idx_object_id_type",
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
fields: ["actionType"],
|
|
71
|
-
name: "idx_action_type",
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
fields: ["createdAt"],
|
|
75
|
-
name: "idx_created_at",
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
fields: ["objectId", "actionType"],
|
|
79
|
-
name: "idx_object_action",
|
|
80
|
-
},
|
|
81
|
-
],
|
|
82
|
-
}
|
|
83
|
-
);
|
|
84
|
-
|
|
85
|
-
return CampaignActionHistory;
|
|
86
|
-
};
|
|
1
|
+
module.exports = (sequelize, DataTypes) => {
|
|
2
|
+
const CampaignActionHistory = sequelize.define(
|
|
3
|
+
"CampaignActionHistory",
|
|
4
|
+
{
|
|
5
|
+
id: {
|
|
6
|
+
type: DataTypes.UUID,
|
|
7
|
+
defaultValue: DataTypes.UUIDV4,
|
|
8
|
+
primaryKey: true,
|
|
9
|
+
},
|
|
10
|
+
objectId: {
|
|
11
|
+
type: DataTypes.STRING,
|
|
12
|
+
allowNull: false,
|
|
13
|
+
comment:
|
|
14
|
+
"ID of the object being tracked (campaignId, AGRSCID, adsetId, etc.)",
|
|
15
|
+
index: true,
|
|
16
|
+
},
|
|
17
|
+
objectType: {
|
|
18
|
+
type: DataTypes.ENUM("campaign", "agrscid", "adset", "ad"),
|
|
19
|
+
allowNull: false,
|
|
20
|
+
comment: "Type of object to know what objectId represents",
|
|
21
|
+
index: true,
|
|
22
|
+
},
|
|
23
|
+
actionType: {
|
|
24
|
+
type: DataTypes.STRING,
|
|
25
|
+
allowNull: false,
|
|
26
|
+
comment:
|
|
27
|
+
"Type of action: budget_update, bid_update, keyword_update, duplicated, etc.",
|
|
28
|
+
index: true,
|
|
29
|
+
},
|
|
30
|
+
previousValue: {
|
|
31
|
+
type: DataTypes.JSON,
|
|
32
|
+
allowNull: true,
|
|
33
|
+
comment: "Previous value before the action",
|
|
34
|
+
},
|
|
35
|
+
newValue: {
|
|
36
|
+
type: DataTypes.JSON,
|
|
37
|
+
allowNull: true,
|
|
38
|
+
comment: "New value after the action",
|
|
39
|
+
},
|
|
40
|
+
details: {
|
|
41
|
+
type: DataTypes.JSON,
|
|
42
|
+
allowNull: true,
|
|
43
|
+
comment: "Additional context and metadata about the action",
|
|
44
|
+
},
|
|
45
|
+
userId: {
|
|
46
|
+
type: DataTypes.STRING,
|
|
47
|
+
allowNull: true,
|
|
48
|
+
comment: "ID of the user who performed the action",
|
|
49
|
+
},
|
|
50
|
+
createdAt: {
|
|
51
|
+
type: DataTypes.DATE,
|
|
52
|
+
defaultValue: DataTypes.NOW,
|
|
53
|
+
allowNull: false,
|
|
54
|
+
index: true,
|
|
55
|
+
},
|
|
56
|
+
updatedAt: {
|
|
57
|
+
type: DataTypes.DATE,
|
|
58
|
+
defaultValue: DataTypes.NOW,
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
tableName: "CampaignActionHistories",
|
|
63
|
+
timestamps: true,
|
|
64
|
+
indexes: [
|
|
65
|
+
{
|
|
66
|
+
fields: ["objectId", "objectType"],
|
|
67
|
+
name: "idx_object_id_type",
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
fields: ["actionType"],
|
|
71
|
+
name: "idx_action_type",
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
fields: ["createdAt"],
|
|
75
|
+
name: "idx_created_at",
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
fields: ["objectId", "actionType"],
|
|
79
|
+
name: "idx_object_action",
|
|
80
|
+
},
|
|
81
|
+
],
|
|
82
|
+
}
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
return CampaignActionHistory;
|
|
86
|
+
};
|