agrs-sequelize-sdk 1.1.59 → 1.1.60

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,106 @@
1
+ module.exports = (sequelize, DataTypes) => {
2
+ const AdSetPerformance = sequelize.define(
3
+ "AdSetPerformance",
4
+ {
5
+ AdSetID: {
6
+ type: DataTypes.STRING,
7
+ allowNull: false,
8
+ primaryKey: true,
9
+ // Part of the composite primary key identifying the AdSet
10
+ },
11
+ Date: {
12
+ type: DataTypes.DATEONLY,
13
+ allowNull: false,
14
+ primaryKey: true,
15
+ // Part of the composite primary key representing the performance date
16
+ },
17
+ ChannelID: {
18
+ type: DataTypes.STRING,
19
+ allowNull: true,
20
+ // Optional identifier for the channel, extracted from AdSet name if available
21
+ },
22
+ StyleID: {
23
+ type: DataTypes.STRING,
24
+ allowNull: true,
25
+ // Optional identifier for the style, extracted from AdSet name if available
26
+ },
27
+ Spend: {
28
+ type: DataTypes.FLOAT,
29
+ defaultValue: 0,
30
+ // Total spend on the AdSet from the source platform (e.g., Facebook)
31
+ },
32
+ Impressions: {
33
+ type: DataTypes.INTEGER,
34
+ defaultValue: 0,
35
+ // Number of impressions recorded by the source platform
36
+ },
37
+ LinkClicks: {
38
+ type: DataTypes.INTEGER,
39
+ defaultValue: 0,
40
+ // Number of link clicks recorded by the source platform
41
+ },
42
+ ViewContent: {
43
+ type: DataTypes.INTEGER,
44
+ defaultValue: 0,
45
+ // Number of view content events recorded by the source platform
46
+ },
47
+ Search: {
48
+ type: DataTypes.INTEGER,
49
+ defaultValue: 0,
50
+ // Number of search events recorded by the source platform
51
+ },
52
+ Purchase: {
53
+ type: DataTypes.INTEGER,
54
+ defaultValue: 0,
55
+ // Number of purchase events recorded by the source platform
56
+ },
57
+ ExternalRevenue: {
58
+ type: DataTypes.FLOAT,
59
+ defaultValue: 0,
60
+ // Revenue data from an external source (e.g., analytics or monetization platforms)
61
+ },
62
+ ExternalImpressions: {
63
+ type: DataTypes.INTEGER,
64
+ defaultValue: 0,
65
+ // Number of impressions recorded by an external source
66
+ },
67
+ ExternalClicks: {
68
+ type: DataTypes.INTEGER,
69
+ defaultValue: 0,
70
+ // Number of clicks recorded by an external source
71
+ },
72
+ ExternalRequests: {
73
+ type: DataTypes.INTEGER,
74
+ defaultValue: 0,
75
+ // Number of requests recorded by an external source
76
+ },
77
+ ROI: {
78
+ type: DataTypes.FLOAT,
79
+ defaultValue: 0,
80
+ // Calculated Return on Investment (ExternalRevenue / Spend)
81
+ },
82
+ },
83
+ {
84
+ tableName: "AdSetPerformance",
85
+ timestamps: false, // No need for createdAt/updatedAt timestamps
86
+ indexes: [
87
+ {
88
+ unique: true,
89
+ fields: ["AdSetID", "Date"],
90
+ // Composite unique index to ensure one record per AdSet per date
91
+ },
92
+ ],
93
+ }
94
+ );
95
+
96
+ // Define associations with other models
97
+ AdSetPerformance.associate = (models) => {
98
+ AdSetPerformance.belongsTo(models.AdSet, {
99
+ foreignKey: "AdSetID",
100
+ targetKey: "AdSetID",
101
+ // Links to the AdSet model for additional AdSet details
102
+ });
103
+ };
104
+
105
+ return AdSetPerformance;
106
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agrs-sequelize-sdk",
3
- "version": "1.1.59",
3
+ "version": "1.1.60",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "start": "node index.js",