agrs-sequelize-sdk 1.1.89 → 1.1.91

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.
@@ -84,6 +84,11 @@ module.exports = (sequelize, DataTypes) => {
84
84
  allowNull: true,
85
85
  // Optional identifier for the AdSet, extracted from AdSet url if available
86
86
  },
87
+ originalRevenue: {
88
+ type: DataTypes.FLOAT,
89
+ defaultValue: 0,
90
+ // Original revenue value before any modifications or calculations
91
+ }
87
92
  },
88
93
  {
89
94
  tableName: "AdSetPerformance",
@@ -0,0 +1,62 @@
1
+ module.exports = (sequelize, DataTypes) => {
2
+ const ExplorAdsChannel = sequelize.define(
3
+ "ExplorAdsChannel",
4
+ {
5
+ channelId: {
6
+ type: DataTypes.STRING,
7
+ allowNull: false,
8
+ validate: {
9
+ // Validate channel format (br_vt_ch1401 to br_vt_ch1500)
10
+ is: /^br_vt_ch(14[0-9][0-9]|1500)$/
11
+ }
12
+ },
13
+ status: {
14
+ type: DataTypes.STRING,
15
+ allowNull: false,
16
+ defaultValue: "free",
17
+ validate: {
18
+ isIn: [["free", "used", "archived"]],
19
+ },
20
+ },
21
+ domain: {
22
+ type: DataTypes.STRING,
23
+ allowNull: false,
24
+ defaultValue: "nexoreach.com"
25
+ },
26
+ connectedCampaigns: {
27
+ type: DataTypes.JSONB,
28
+ allowNull: false,
29
+ defaultValue: [],
30
+ },
31
+ lastUsed: {
32
+ type: DataTypes.DATE,
33
+ allowNull: true
34
+ }
35
+ },
36
+ {
37
+ tableName: "explorads_channels",
38
+ timestamps: true,
39
+ indexes: [
40
+ {
41
+ unique: true,
42
+ fields: ["channelId"],
43
+ name: "unique_explorads_channel"
44
+ },
45
+ ],
46
+ }
47
+ );
48
+
49
+ // Define associations
50
+ ExplorAdsChannel.associate = (models) => {
51
+ if (models.RSOCFeedCampaign) {
52
+ ExplorAdsChannel.hasMany(models.RSOCFeedCampaign, {
53
+ foreignKey: "channelId",
54
+ sourceKey: "channelId",
55
+ as: "RSOCFeedCampaigns",
56
+ constraints: false, // Disable FK constraint
57
+ });
58
+ }
59
+ };
60
+
61
+ return ExplorAdsChannel;
62
+ };
@@ -10,12 +10,12 @@ module.exports = (sequelize, DataTypes) => {
10
10
  },
11
11
  AGRSAID: {
12
12
  type: DataTypes.STRING,
13
- allowNull: false,
13
+ allowNull: true,
14
14
  comment: "ID referencing Article.AGRSAID",
15
15
  },
16
16
  articleName: {
17
17
  type: DataTypes.STRING,
18
- allowNull: false,
18
+ allowNull: true,
19
19
  comment: "Name of the associated article",
20
20
  },
21
21
  channelId: {
@@ -0,0 +1,111 @@
1
+ module.exports = (sequelize, DataTypes) => {
2
+ const RsocKeywordPerformance = sequelize.define('RsocKeywordPerformance', {
3
+ id: {
4
+ type: DataTypes.INTEGER,
5
+ primaryKey: true,
6
+ autoIncrement: true,
7
+ allowNull: false
8
+ },
9
+ ts: {
10
+ type: DataTypes.DATE,
11
+ allowNull: false,
12
+ comment: 'Timestamp of the record'
13
+ },
14
+ channel_id: {
15
+ type: DataTypes.STRING,
16
+ allowNull: false,
17
+ comment: 'Channel identifier'
18
+ },
19
+ style_id: {
20
+ type: DataTypes.STRING,
21
+ allowNull: true,
22
+ comment: 'Style identifier'
23
+ },
24
+ country_code: {
25
+ type: DataTypes.STRING(2),
26
+ allowNull: true,
27
+ comment: 'Country code (ISO 2-letter)'
28
+ },
29
+ custom_query: {
30
+ type: DataTypes.TEXT,
31
+ allowNull: true,
32
+ comment: 'Custom search query'
33
+ },
34
+ query: {
35
+ type: DataTypes.TEXT,
36
+ allowNull: true,
37
+ comment: 'Standard search query'
38
+ },
39
+ funnel_page_views: {
40
+ type: DataTypes.INTEGER,
41
+ allowNull: true,
42
+ defaultValue: 0,
43
+ comment: 'Number of funnel page views'
44
+ },
45
+ funnel_impressions: {
46
+ type: DataTypes.INTEGER,
47
+ allowNull: true,
48
+ defaultValue: 0,
49
+ comment: 'Number of funnel impressions'
50
+ },
51
+ funnel_clicks: {
52
+ type: DataTypes.INTEGER,
53
+ allowNull: true,
54
+ defaultValue: 0,
55
+ comment: 'Number of funnel clicks'
56
+ },
57
+ page_views: {
58
+ type: DataTypes.INTEGER,
59
+ allowNull: true,
60
+ defaultValue: 0,
61
+ comment: 'Number of page views'
62
+ },
63
+ impressions: {
64
+ type: DataTypes.INTEGER,
65
+ allowNull: true,
66
+ defaultValue: 0,
67
+ comment: 'Number of impressions'
68
+ },
69
+ clicks: {
70
+ type: DataTypes.INTEGER,
71
+ allowNull: true,
72
+ defaultValue: 0,
73
+ comment: 'Number of clicks'
74
+ },
75
+ agrs_cid: {
76
+ type: DataTypes.STRING,
77
+ allowNull: true,
78
+ comment: 'AGRS campaign identifier linking to campaign data'
79
+ }
80
+ }, {
81
+ tableName: 'rsoc_keyword_performance',
82
+ timestamps: true, // Adds createdAt and updatedAt columns
83
+ indexes: [
84
+ {
85
+ fields: ['channel_id', 'ts'],
86
+ name: 'idx_rsoc_keyword_channel_time'
87
+ },
88
+ {
89
+ fields: ['style_id'],
90
+ name: 'idx_rsoc_keyword_style'
91
+ },
92
+ {
93
+ fields: ['country_code'],
94
+ name: 'idx_rsoc_keyword_country'
95
+ },
96
+ {
97
+ fields: ['agrs_cid'],
98
+ name: 'idx_rsoc_keyword_agrs_cid'
99
+ }
100
+ ]
101
+ });
102
+
103
+ // Define associations if needed
104
+ RsocKeywordPerformance.associate = (models) => {
105
+ // Add associations here if your table needs to reference other tables
106
+ // For example:
107
+ // RsocKeywordPerformance.belongsTo(models.Channel, { foreignKey: 'channel_id' });
108
+ };
109
+
110
+ return RsocKeywordPerformance;
111
+ };
@@ -0,0 +1,24 @@
1
+ module.exports = (sequelize, DataTypes) => {
2
+ const SupportedLocale = sequelize.define('SupportedLocale', {
3
+ country: {
4
+ type: DataTypes.STRING,
5
+ allowNull: false,
6
+ },
7
+ locale: {
8
+ type: DataTypes.STRING,
9
+ allowNull: false,
10
+ },
11
+ language: {
12
+ type: DataTypes.STRING,
13
+ allowNull: true,
14
+ comment: 'Language code (e.g., en, es, fr)'
15
+ }
16
+ });
17
+
18
+ // Define associations if needed in the future
19
+ // SupportedLocale.associate = (models) => {
20
+ // // e.g., SupportedLocale.hasMany(models.OtherModel);
21
+ // };
22
+
23
+ return SupportedLocale;
24
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agrs-sequelize-sdk",
3
- "version": "1.1.89",
3
+ "version": "1.1.91",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "start": "node index.js",