agrs-sequelize-sdk 1.2.10 → 1.2.12

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.
Files changed (53) hide show
  1. package/controllers/campaignCreationLogsController.js +264 -0
  2. package/models/CampaignCreationLogNew.js +141 -0
  3. package/models/RSOCFeedCampaign.js +1 -1
  4. package/package.json +1 -1
  5. package/routes/api.js +18 -0
  6. package/utils/loggerUtils.js +497 -0
  7. package/agrs-sequelize/LICENSE +0 -21
  8. package/agrs-sequelize/README.md +0 -179
  9. package/agrs-sequelize/index.js +0 -169
  10. package/agrs-sequelize/jq.exe +0 -0
  11. package/agrs-sequelize/models/ActivityHistory.js +0 -73
  12. package/agrs-sequelize/models/Ad.js +0 -209
  13. package/agrs-sequelize/models/AdAccount.js +0 -91
  14. package/agrs-sequelize/models/AdAccountValues.js +0 -26
  15. package/agrs-sequelize/models/AdHistory.js +0 -30
  16. package/agrs-sequelize/models/AdPerformance.js +0 -84
  17. package/agrs-sequelize/models/AdPerformanceHourly.js +0 -66
  18. package/agrs-sequelize/models/AdSet.js +0 -140
  19. package/agrs-sequelize/models/AdSetHistory.js +0 -30
  20. package/agrs-sequelize/models/AdsetPerformance.js +0 -116
  21. package/agrs-sequelize/models/Article.js +0 -156
  22. package/agrs-sequelize/models/Buyers.js +0 -26
  23. package/agrs-sequelize/models/Campaign.js +0 -136
  24. package/agrs-sequelize/models/CampaignCreationLog.js +0 -86
  25. package/agrs-sequelize/models/CampaignHistory.js +0 -33
  26. package/agrs-sequelize/models/Channel.js +0 -55
  27. package/agrs-sequelize/models/CodefuelCampaign.js +0 -159
  28. package/agrs-sequelize/models/CodefuelCampaignKWHistory.js +0 -41
  29. package/agrs-sequelize/models/CodefuelKeywords.js +0 -35
  30. package/agrs-sequelize/models/CurrencyRate.js +0 -27
  31. package/agrs-sequelize/models/Domain.js +0 -26
  32. package/agrs-sequelize/models/ExplorAdsChannel.js +0 -62
  33. package/agrs-sequelize/models/Feed.js +0 -34
  34. package/agrs-sequelize/models/Files.js +0 -73
  35. package/agrs-sequelize/models/Folders.js +0 -133
  36. package/agrs-sequelize/models/KeywordPerformance.js +0 -99
  37. package/agrs-sequelize/models/KeywordRotationState.js +0 -51
  38. package/agrs-sequelize/models/Pages.js +0 -74
  39. package/agrs-sequelize/models/PipelineExecution.js +0 -46
  40. package/agrs-sequelize/models/RSOCFeedCampaign.js +0 -307
  41. package/agrs-sequelize/models/RsocKeywordPerformance.js +0 -111
  42. package/agrs-sequelize/models/Rule.js +0 -39
  43. package/agrs-sequelize/models/RulesValues.js +0 -56
  44. package/agrs-sequelize/models/SupportedLocale.js +0 -24
  45. package/agrs-sequelize/models/TonicCampaign.js +0 -97
  46. package/agrs-sequelize/models/Users.js +0 -111
  47. package/agrs-sequelize/models/Vertical.js +0 -26
  48. package/agrs-sequelize/models/newFiles.js +0 -68
  49. package/agrs-sequelize/models/pixels.js +0 -33
  50. package/agrs-sequelize/package-lock.json +0 -405
  51. package/agrs-sequelize/package.json +0 -19
  52. package/agrs-sequelize/run.ps1 +0 -98
  53. package/agrs-sequelize/run.sh +0 -214
@@ -1,111 +0,0 @@
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
- };
@@ -1,39 +0,0 @@
1
- module.exports = (sequelize, DataTypes) => {
2
- const Rule = sequelize.define("Rule", {
3
- ruleName: {
4
- type: DataTypes.STRING,
5
- allowNull: false,
6
- },
7
- timeUnit: {
8
- type: DataTypes.ENUM("minutes", "hours", "days"),
9
- allowNull: false,
10
- },
11
- timeValue: {
12
- type: DataTypes.INTEGER,
13
- allowNull: false,
14
- },
15
- daysAndTimes: {
16
- type: DataTypes.JSONB, // Store days, time ranges, and conditions as a JSON object
17
- allowNull: true,
18
- },
19
- filters: {
20
- type: DataTypes.JSONB,
21
- allowNull: true,
22
- },
23
- triggers: {
24
- type: DataTypes.JSONB,
25
- allowNull: false,
26
- },
27
- actions: {
28
- type: DataTypes.JSONB,
29
- allowNull: false,
30
- },
31
- status: {
32
- type: DataTypes.ENUM("active", "paused"),
33
- allowNull: false,
34
- defaultValue: "active",
35
- },
36
- });
37
-
38
- return Rule;
39
- };
@@ -1,56 +0,0 @@
1
- module.exports = (sequelize, DataTypes) => {
2
- const RulesValues = sequelize.define(
3
- "RulesValues",
4
- {
5
- id: {
6
- type: DataTypes.UUID,
7
- defaultValue: DataTypes.UUIDV4,
8
- primaryKey: true,
9
- },
10
- name: {
11
- type: DataTypes.STRING,
12
- allowNull: false,
13
- },
14
- code: {
15
- type: DataTypes.STRING,
16
- allowNull: false,
17
- unique: true,
18
- },
19
- permissions: {
20
- type: DataTypes.ARRAY(DataTypes.STRING),
21
- allowNull: false,
22
- defaultValue: [],
23
- },
24
- feature: {
25
- type: DataTypes.STRING,
26
- allowNull: true,
27
- },
28
- parentId: {
29
- type: DataTypes.UUID,
30
- allowNull: true,
31
- references: {
32
- model: "RulesValues",
33
- key: "id",
34
- },
35
- onDelete: "CASCADE",
36
- },
37
- },
38
- {
39
- tableName: "RulesValues",
40
- }
41
- );
42
-
43
- // Self-referential association to define sub-rules
44
- RulesValues.hasMany(RulesValues, {
45
- as: "subRules",
46
- foreignKey: "parentId",
47
- onDelete: "CASCADE",
48
- });
49
-
50
- RulesValues.belongsTo(RulesValues, {
51
- as: "parentRule",
52
- foreignKey: "parentId",
53
- });
54
-
55
- return RulesValues;
56
- };
@@ -1,24 +0,0 @@
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
- };
@@ -1,97 +0,0 @@
1
- const { DataTypes } = require("sequelize");
2
-
3
- module.exports = (sequelize, DataTypes) => {
4
- const TonicCampaign = sequelize.define("TonicCampaign", {
5
- AGRSCID: {
6
- type: DataTypes.STRING,
7
- allowNull: false,
8
- unique: true,
9
- primaryKey: true,
10
- },
11
- CampaignName: {
12
- type: DataTypes.STRING,
13
- allowNull: false,
14
- },
15
- CampaignID: {
16
- type: DataTypes.STRING,
17
- allowNull: true,
18
- },
19
- Vertical: {
20
- type: DataTypes.STRING,
21
- allowNull: true,
22
- },
23
- Offer: {
24
- type: DataTypes.STRING,
25
- allowNull: true,
26
- },
27
- OfferID: {
28
- type: DataTypes.STRING,
29
- allowNull: true,
30
- },
31
- Country: {
32
- type: DataTypes.STRING,
33
- allowNull: false,
34
- },
35
- Domain: {
36
- type: DataTypes.STRING,
37
- allowNull: true,
38
- },
39
- Imprint: {
40
- type: DataTypes.STRING,
41
- allowNull: true,
42
- defaultValue: "no",
43
- },
44
- Status: {
45
- type: DataTypes.STRING,
46
- allowNull: false,
47
- defaultValue: "inactive",
48
- },
49
- FinalLink: {
50
- type: DataTypes.STRING(1024),
51
- allowNull: true,
52
- },
53
- Assignee: {
54
- type: DataTypes.STRING,
55
- allowNull: false,
56
- },
57
- KW: {
58
- type: DataTypes.ARRAY(DataTypes.STRING),
59
- allowNull: true,
60
- },
61
- PixelID: {
62
- type: DataTypes.STRING(1024),
63
- allowNull: true,
64
- },
65
- Token: {
66
- type: DataTypes.STRING(1024),
67
- allowNull: true,
68
- },
69
- AccountID: {
70
- type: DataTypes.STRING,
71
- allowNull: false,
72
- },
73
- FeedName: {
74
- type: DataTypes.STRING,
75
- allowNull: true,
76
- },
77
- AdTitle: {
78
- type: DataTypes.STRING,
79
- allowNull: true,
80
- },
81
- Target: {
82
- type: DataTypes.STRING,
83
- allowNull: true,
84
- },
85
- });
86
-
87
- TonicCampaign.associate = (models) => {
88
- TonicCampaign.hasMany(models.Ad, {
89
- foreignKey: "AGRS_CID",
90
- sourceKey: "AGRSCID",
91
- constraints: false, // Disable the strict foreign key constraint
92
- as: "Ads",
93
- });
94
- };
95
-
96
- return TonicCampaign;
97
- };
@@ -1,111 +0,0 @@
1
- module.exports = (sequelize, DataTypes) => {
2
- const Users = sequelize.define(
3
- "Users",
4
- {
5
- id: {
6
- type: DataTypes.UUID, // Use UUID for the primary key
7
- defaultValue: DataTypes.UUIDV4, // Automatically generate a UUID
8
- primaryKey: true, // Set as primary key
9
- },
10
- Username: {
11
- type: DataTypes.STRING,
12
- allowNull: false,
13
- unique: true,
14
- },
15
- Image: {
16
- type: DataTypes.STRING,
17
- allowNull: true,
18
- },
19
- Email: {
20
- type: DataTypes.STRING,
21
- allowNull: true,
22
- unique: true,
23
- },
24
- // add name field
25
- Name: {
26
- type: DataTypes.STRING,
27
- allowNull: false,
28
- },
29
- Password: {
30
- type: DataTypes.STRING(1024), // Store hash with max length 256
31
- allowNull: false,
32
- },
33
- Roles: {
34
- type: DataTypes.ARRAY(DataTypes.STRING), // Array of roles
35
- allowNull: true,
36
- defaultValue: [],
37
- },
38
- Features: {
39
- type: DataTypes.ARRAY(DataTypes.STRING), // Array of features
40
- allowNull: true,
41
- defaultValue: [],
42
- },
43
- Accounts: {
44
- type: DataTypes.ARRAY(DataTypes.STRING), // Array of account IDs
45
- allowNull: true,
46
- defaultValue: [],
47
- },
48
- MediaBuyers: {
49
- type: DataTypes.ARRAY(DataTypes.STRING), // Array of account IDs
50
- allowNull: true,
51
- defaultValue: [],
52
- },
53
- Pages: {
54
- type: DataTypes.ARRAY(DataTypes.STRING), // Array of account IDs
55
- allowNull: true,
56
- defaultValue: [],
57
- },
58
- FeedProvider: {
59
- type: DataTypes.ARRAY(DataTypes.STRING), // Array of account IDs
60
- allowNull: true,
61
- defaultValue: [],
62
- },
63
- Organization: {
64
- type: DataTypes.ARRAY(DataTypes.STRING), // Array of organization IDs
65
- allowNull: true,
66
- defaultValue: [],
67
- },
68
- LastEntrance: {
69
- type: DataTypes.DATE, // Array of organization IDs
70
- allowNull: true,
71
- defaultValue: [],
72
- },
73
- Status: {
74
- type: DataTypes.STRING, // Array of organization IDs
75
- allowNull: true,
76
- },
77
- access_all_files: {
78
- type: DataTypes.BOOLEAN,
79
- allowNull: true,
80
- },
81
- managed_by: {
82
- type: DataTypes.UUID, // A UUID to store the ID of the user who manages this user
83
- allowNull: true,
84
- references: {
85
- model: 'Users',
86
- key: 'id',
87
- },
88
- },
89
- },
90
- {
91
- tableName: "Users",
92
- }
93
- );
94
-
95
- // Define associations for managed_by relationship
96
- Users.associate = (models) => {
97
- // A user can manage many users
98
- Users.hasMany(models.Users, {
99
- foreignKey: 'managed_by',
100
- as: 'managedUsers',
101
- });
102
-
103
- // A user can only be managed by one user
104
- Users.belongsTo(models.Users, {
105
- foreignKey: 'managed_by',
106
- as: 'manager',
107
- });
108
- };
109
-
110
- return Users;
111
- };
@@ -1,26 +0,0 @@
1
- module.exports = (sequelize, DataTypes) => {
2
- const Vertical = sequelize.define(
3
- "Vertical",
4
- {
5
- id: {
6
- type: DataTypes.UUID,
7
- defaultValue: DataTypes.UUIDV4,
8
- primaryKey: true,
9
- },
10
- name: {
11
- type: DataTypes.STRING,
12
- allowNull: false,
13
- },
14
- code: {
15
- type: DataTypes.STRING,
16
- allowNull: false,
17
- unique: true,
18
- },
19
- },
20
- {
21
- tableName: "Vertical",
22
- }
23
- );
24
-
25
- return Vertical;
26
- };
@@ -1,68 +0,0 @@
1
- module.exports = (sequelize, DataTypes) => {
2
- const NewFiles = sequelize.define("NewFiles", {
3
- id: {
4
- type: DataTypes.STRING,
5
- primaryKey: true,
6
- },
7
- accounts: {
8
- type: DataTypes.JSONB(),
9
- allowNull: true,
10
- },
11
- name: {
12
- type: DataTypes.STRING,
13
- allowNull: false,
14
- },
15
- // need to add a field of the name in the gcp bucket
16
- gcpFileName: {
17
- type: DataTypes.STRING,
18
- allowNull: true,
19
- },
20
- type: {
21
- type: DataTypes.STRING, // Can be "image" or "video"
22
- allowNull: false,
23
- },
24
- URL: {
25
- type: DataTypes.STRING, // URL for the file
26
- allowNull: false,
27
- },
28
- FileType: {
29
- type: DataTypes.STRING,
30
- allowNull: true,
31
- defaultValue: "image",
32
- },
33
- Size: {
34
- type: DataTypes.STRING,
35
- allowNull: true,
36
- },
37
- Language: {
38
- type: DataTypes.STRING,
39
- allowNull: true,
40
- },
41
- Vertical: {
42
- type: DataTypes.STRING,
43
- allowNull: true,
44
- },
45
- // want to add length ( duration of the video) if the file is a video.
46
- // maybe call it duration
47
- Duration: {
48
- type: DataTypes.STRING,
49
- allowNull: true,
50
- },
51
- // Thumbnail URL
52
- Thumbnail: {
53
- type: DataTypes.TEXT,
54
- allowNull: true,
55
- },
56
- Thumbnai2: {
57
- type: DataTypes.TEXT,
58
- allowNull: true,
59
- },
60
- // ImageHash
61
- ImageHash: {
62
- type: DataTypes.STRING,
63
- allowNull: true,
64
- },
65
- });
66
-
67
- return NewFiles;
68
- };
@@ -1,33 +0,0 @@
1
- const { DataTypes } = require("sequelize");
2
-
3
- module.exports = (sequelize) => {
4
- const Pixel = sequelize.define("Pixel", {
5
- id: {
6
- type: DataTypes.STRING,
7
- allowNull: false,
8
- primaryKey: true,
9
- },
10
- platform: {
11
- type: DataTypes.STRING,
12
- allowNull: false,
13
- defaultValue: "facebook", // Default to Facebook, but you can adjust as needed
14
- in: ["Facebook", "Tiktok", "Taboola", "Outbrain", "Yahoo"],
15
- },
16
- access_token: {
17
- type: DataTypes.STRING,
18
- allowNull: false,
19
- },
20
- createdAt: {
21
- type: DataTypes.DATE,
22
- allowNull: false,
23
- defaultValue: DataTypes.NOW,
24
- },
25
- updatedAt: {
26
- type: DataTypes.DATE,
27
- allowNull: false,
28
- defaultValue: DataTypes.NOW,
29
- },
30
- });
31
-
32
- return Pixel;
33
- };