agrs-sequelize-sdk 1.2.97 → 1.2.99

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.
@@ -81,12 +81,18 @@ module.exports = (sequelize, DataTypes) => {
81
81
  policy_status: {
82
82
  type: DataTypes.STRING,
83
83
  allowNull: true,
84
- comment: "Facebook policy status: APPROVED, DENIED, PENDING, etc."
84
+ comment: "Facebook policy status: APPROVED, DENIED, PENDING, etc.",
85
85
  },
86
86
  policy_rejection_reason: {
87
87
  type: DataTypes.TEXT,
88
88
  allowNull: true,
89
- comment: "Detailed reason for policy rejection"
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)",
90
96
  },
91
97
  },
92
98
  {
@@ -95,6 +101,12 @@ module.exports = (sequelize, DataTypes) => {
95
101
  {
96
102
  fields: ["AdAccountID"], // Index on AdAccountID for faster joins
97
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
+ },
98
110
  ],
99
111
  }
100
112
  );
@@ -1,90 +1,213 @@
1
1
  module.exports = (sequelize, DataTypes) => {
2
- const DynamicFeed = sequelize.define(
3
- "DynamicFeed",
4
- {
5
- id: {
6
- type: DataTypes.INTEGER,
7
- primaryKey: true,
8
- autoIncrement: true,
9
- },
10
- // Feed Details
11
- feed_type: {
12
- type: DataTypes.ENUM('N2S', 'Type-In', 'AFD', 'RSOC'),
13
- allowNull: true,
14
- },
15
- feed: {
16
- type: DataTypes.ENUM('Direct', 'Partner', '3rd Party'),
17
- allowNull: true,
18
- },
19
- feed_name: {
20
- type: DataTypes.STRING,
21
- allowNull: false,
22
- },
23
- feed_short_name: {
24
- type: DataTypes.STRING,
25
- allowNull: true,
26
- },
27
- feed_logo: {
28
- type: DataTypes.TEXT,
29
- allowNull: true,
2
+ const DynamicFeed = sequelize.define(
3
+ "DynamicFeed",
4
+ {
5
+ id: {
6
+ type: DataTypes.UUID,
7
+ primaryKey: true,
8
+ defaultValue: DataTypes.UUIDV4,
9
+ },
10
+ // Feed Details
11
+ feed_type: {
12
+ type: DataTypes.ENUM('N2S', 'Type-In', 'AFD', 'RSOC'),
13
+ allowNull: true,
14
+ },
15
+ feed: {
16
+ type: DataTypes.ENUM('Direct', 'Partner', '3rd Party'),
17
+ allowNull: true,
18
+ },
19
+ feed_name: {
20
+ type: DataTypes.STRING,
21
+ allowNull: false,
22
+ },
23
+ feed_short_name: {
24
+ type: DataTypes.STRING,
25
+ allowNull: true,
26
+ },
27
+ feed_logo: {
28
+ type: DataTypes.TEXT,
29
+ allowNull: true,
30
+ },
31
+ organization: {
32
+ type: DataTypes.STRING,
33
+ allowNull: true,
34
+ },
35
+ traffic_source: {
36
+ type: DataTypes.STRING,
37
+ allowNull: true,
38
+ },
39
+
40
+ // Targeting Rules
41
+ accepted_devices: {
42
+ type: DataTypes.JSONB,
43
+ allowNull: true,
44
+ },
45
+ search_engine: {
46
+ type: DataTypes.JSONB,
47
+ allowNull: true,
48
+ },
49
+ country: {
50
+ type: DataTypes.STRING,
51
+ allowNull: true,
52
+ },
53
+ country_groups: {
54
+ type: DataTypes.JSONB,
55
+ allowNull: true,
56
+ },
57
+
58
+ // Tracking & URL Parameters
59
+ default_pixel: {
60
+ type: DataTypes.ARRAY(DataTypes.STRING),
61
+ allowNull: true,
62
+ defaultValue: [],
63
+ },
64
+ default_pixel_event: {
65
+ type: DataTypes.ARRAY(DataTypes.STRING),
66
+ allowNull: true,
67
+ defaultValue: [],
68
+ },
69
+ base_url: {
70
+ type: DataTypes.STRING(500),
71
+ allowNull: true,
72
+ },
73
+ display_url: {
74
+ type: DataTypes.STRING(500),
75
+ allowNull: true,
76
+ },
77
+ path_url_structure: {
78
+ type: DataTypes.STRING(500),
79
+ allowNull: true,
80
+ },
81
+ reporting_parameter: {
82
+ type: DataTypes.STRING(100),
83
+ allowNull: true,
84
+ },
85
+ keyword_parameter: {
86
+ type: DataTypes.STRING(100),
87
+ allowNull: true,
88
+ },
89
+ special_static_params: {
90
+ type: DataTypes.TEXT,
91
+ allowNull: true,
92
+ },
93
+
94
+ // Facebook Settings
95
+ optimization_goal: {
96
+ type: DataTypes.STRING,
97
+ allowNull: true,
98
+ },
99
+ bid_strategy: {
100
+ type: DataTypes.STRING,
101
+ allowNull: true,
102
+ },
103
+
104
+ // Feed Provider Settings
105
+ feed_provider: {
106
+ type: DataTypes.STRING,
107
+ allowNull: true,
108
+ },
109
+ reporting_frequency: {
110
+ type: DataTypes.STRING,
111
+ allowNull: true,
112
+ },
113
+ feed_username: {
114
+ type: DataTypes.STRING,
115
+ allowNull: true,
116
+ },
117
+ feed_password: {
118
+ type: DataTypes.STRING,
119
+ allowNull: true,
120
+ },
121
+ access_token: {
122
+ type: DataTypes.TEXT,
123
+ allowNull: true,
124
+ },
125
+ api_base_url: {
126
+ type: DataTypes.STRING,
127
+ allowNull: true,
128
+ },
129
+ token_expires_at: {
130
+ type: DataTypes.DATE,
131
+ allowNull: true,
132
+ },
133
+
134
+ // Reporting Configuration
135
+ revenue_source: {
136
+ type: DataTypes.STRING,
137
+ allowNull: true,
138
+ },
139
+ reporting_granularity: {
140
+ type: DataTypes.STRING,
141
+ allowNull: true,
142
+ },
143
+ reporting_group_by: {
144
+ type: DataTypes.STRING,
145
+ allowNull: true,
146
+ },
147
+ reporting_metrics_map: {
148
+ type: DataTypes.JSONB,
149
+ allowNull: true,
150
+ },
151
+ reporting_channel_field: {
152
+ type: DataTypes.STRING,
153
+ allowNull: true,
154
+ },
155
+
156
+ // Generated URLs
157
+ generated_url: {
158
+ type: DataTypes.STRING,
159
+ allowNull: true,
160
+ },
161
+ token: {
162
+ type: DataTypes.STRING,
163
+ allowNull: true,
164
+ unique: true,
165
+ },
166
+
167
+ // Status
168
+ is_active: {
169
+ type: DataTypes.BOOLEAN,
170
+ defaultValue: true,
171
+ allowNull: true,
172
+ },
173
+ is_dynamic_feed: {
174
+ type: DataTypes.BOOLEAN,
175
+ defaultValue: true,
176
+ allowNull: true,
177
+ },
178
+ },
179
+ {
180
+ tableName: "dynamic_feeds",
181
+ timestamps: true,
182
+ indexes: [
183
+ {
184
+ fields: ["token"],
30
185
  },
31
- // Targeting Rules
32
- accepted_devices: {
33
- type: DataTypes.JSON,
34
- allowNull: true,
186
+ {
187
+ fields: ["generated_url"],
35
188
  },
36
- search_engine: {
37
- type: DataTypes.JSON,
38
- allowNull: true,
189
+ {
190
+ fields: ["is_active"],
39
191
  },
40
- country: {
41
- type: DataTypes.STRING,
42
- allowNull: true,
192
+ {
193
+ fields: ["feed_type"],
43
194
  },
44
- generated_url: {
45
- type: DataTypes.STRING,
46
- allowNull: false,
195
+ {
196
+ fields: ["country"],
47
197
  },
48
- token: {
49
- type: DataTypes.STRING,
50
- allowNull: true,
198
+ {
199
+ fields: ["feed_provider"],
51
200
  },
52
- is_active: {
53
- type: DataTypes.BOOLEAN,
54
- defaultValue: true,
55
- allowNull: true,
201
+ {
202
+ fields: ["is_dynamic_feed"],
56
203
  },
57
- },
58
- {
59
- tableName: "dynamic_feeds",
60
- indexes: [
61
- {
62
- fields: ["token"],
63
- },
64
- {
65
- fields: ["generated_url"],
66
- },
67
- {
68
- fields: ["is_active"],
69
- },
70
- {
71
- fields: ["feed_type"],
72
- },
73
- {
74
- fields: ["country"],
75
- },
76
- ],
77
- }
78
- );
79
-
80
- DynamicFeed.associate = (models) => {
81
- // Add associations here when needed
82
- // Example:
83
- // DynamicFeed.hasMany(models.FeedLogs, {
84
- // foreignKey: "feed_id",
85
- // as: "Logs",
86
- // });
87
- };
88
-
89
- return DynamicFeed;
90
- };
204
+ ],
205
+ }
206
+ );
207
+
208
+ DynamicFeed.associate = (models) => {
209
+ // Add associations here when needed
210
+ };
211
+
212
+ return DynamicFeed;
213
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agrs-sequelize-sdk",
3
- "version": "1.2.97",
3
+ "version": "1.2.99",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "start": "node index.js",