agrs-sequelize-sdk 1.2.94 → 1.2.96
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.
|
@@ -0,0 +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
|
+
};
|