agrs-sequelize-sdk 1.2.78 → 1.2.80

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.
package/models/Channel.js CHANGED
@@ -1,55 +1,55 @@
1
- module.exports = (sequelize, DataTypes) => {
2
- const Channel = sequelize.define(
3
- "Channel",
4
- {
5
- channelId: {
6
- type: DataTypes.STRING,
7
- allowNull: false,
8
- // Not setting as primary key or unique since duplicates are allowed
9
- },
10
- styleId: {
11
- type: DataTypes.STRING,
12
- allowNull: false,
13
- },
14
- status: {
15
- type: DataTypes.STRING,
16
- allowNull: false,
17
- defaultValue: "free",
18
- validate: {
19
- isIn: [["free", "used", "archived"]],
20
- },
21
- },
22
- connectedCampaigns: {
23
- type: DataTypes.JSONB, // Use JSONB for better querying capabilities
24
- allowNull: false,
25
- defaultValue: [],
26
- },
27
- },
28
- {
29
- tableName: "channels",
30
- timestamps: true,
31
- indexes: [
32
- // Add a composite unique index on channelId and styleId if needed
33
- {
34
- unique: true,
35
- fields: ["channelId", "styleId"],
36
- name: "unique_channel_style",
37
- },
38
- ],
39
- }
40
- );
41
-
42
- // Define associations without enforcing constraints
43
- Channel.associate = (models) => {
44
- if (models.RSOCFeedCampaign) {
45
- Channel.hasMany(models.RSOCFeedCampaign, {
46
- foreignKey: "channelId",
47
- sourceKey: "channelId",
48
- as: "RSOCFeedCampaigns",
49
- constraints: false, // Disable FK constraint
50
- });
51
- }
52
- };
53
-
54
- return Channel;
55
- };
1
+ module.exports = (sequelize, DataTypes) => {
2
+ const Channel = sequelize.define(
3
+ "Channel",
4
+ {
5
+ channelId: {
6
+ type: DataTypes.STRING,
7
+ allowNull: false,
8
+ // Not setting as primary key or unique since duplicates are allowed
9
+ },
10
+ styleId: {
11
+ type: DataTypes.STRING,
12
+ allowNull: false,
13
+ },
14
+ status: {
15
+ type: DataTypes.STRING,
16
+ allowNull: false,
17
+ defaultValue: "free",
18
+ validate: {
19
+ isIn: [["free", "used", "archived"]],
20
+ },
21
+ },
22
+ connectedCampaigns: {
23
+ type: DataTypes.JSONB, // Use JSONB for better querying capabilities
24
+ allowNull: false,
25
+ defaultValue: [],
26
+ },
27
+ },
28
+ {
29
+ tableName: "channels",
30
+ timestamps: true,
31
+ indexes: [
32
+ // Add a composite unique index on channelId and styleId if needed
33
+ {
34
+ unique: true,
35
+ fields: ["channelId", "styleId"],
36
+ name: "unique_channel_style",
37
+ },
38
+ ],
39
+ }
40
+ );
41
+
42
+ // Define associations without enforcing constraints
43
+ Channel.associate = (models) => {
44
+ if (models.RSOCFeedCampaign) {
45
+ Channel.hasMany(models.RSOCFeedCampaign, {
46
+ foreignKey: "channelId",
47
+ sourceKey: "channelId",
48
+ as: "RSOCFeedCampaigns",
49
+ constraints: false, // Disable FK constraint
50
+ });
51
+ }
52
+ };
53
+
54
+ return Channel;
55
+ };
package/models/Domain.js CHANGED
@@ -1,26 +1,26 @@
1
- module.exports = (sequelize, DataTypes) => {
2
- const Domain = sequelize.define(
3
- "Domain",
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: "Domain",
22
- }
23
- );
24
-
25
- return Domain;
1
+ module.exports = (sequelize, DataTypes) => {
2
+ const Domain = sequelize.define(
3
+ "Domain",
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: "Domain",
22
+ }
23
+ );
24
+
25
+ return Domain;
26
26
  };
@@ -1,90 +1,90 @@
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,
30
- },
31
- // Targeting Rules
32
- accepted_devices: {
33
- type: DataTypes.JSON,
34
- allowNull: true,
35
- },
36
- search_engine: {
37
- type: DataTypes.JSON,
38
- allowNull: true,
39
- },
40
- country: {
41
- type: DataTypes.STRING,
42
- allowNull: true,
43
- },
44
- generated_url: {
45
- type: DataTypes.STRING,
46
- allowNull: false,
47
- },
48
- token: {
49
- type: DataTypes.STRING,
50
- allowNull: true,
51
- },
52
- is_active: {
53
- type: DataTypes.BOOLEAN,
54
- defaultValue: true,
55
- allowNull: true,
56
- },
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;
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,
30
+ },
31
+ // Targeting Rules
32
+ accepted_devices: {
33
+ type: DataTypes.JSON,
34
+ allowNull: true,
35
+ },
36
+ search_engine: {
37
+ type: DataTypes.JSON,
38
+ allowNull: true,
39
+ },
40
+ country: {
41
+ type: DataTypes.STRING,
42
+ allowNull: true,
43
+ },
44
+ generated_url: {
45
+ type: DataTypes.STRING,
46
+ allowNull: false,
47
+ },
48
+ token: {
49
+ type: DataTypes.STRING,
50
+ allowNull: true,
51
+ },
52
+ is_active: {
53
+ type: DataTypes.BOOLEAN,
54
+ defaultValue: true,
55
+ allowNull: true,
56
+ },
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
90
  };
@@ -1,62 +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;
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
62
  };
package/models/Feed.js CHANGED
@@ -1,34 +1,34 @@
1
- module.exports = (sequelize, DataTypes) => {
2
- const Feed = sequelize.define(
3
- "Feed",
4
- {
5
- id: {
6
- type: DataTypes.UUID,
7
- defaultValue: DataTypes.UUIDV4,
8
- primaryKey: true,
9
- },
10
- label: {
11
- type: DataTypes.STRING,
12
- allowNull: false,
13
- },
14
- code: {
15
- type: DataTypes.STRING,
16
- allowNull: false,
17
- unique: true,
18
- },
19
- sheet: {
20
- type: DataTypes.STRING,
21
- allowNull: false,
22
- },
23
- feedProvider: {
24
- type: DataTypes.STRING,
25
- allowNull: false,
26
- },
27
- },
28
- {
29
- tableName: "Feed",
30
- }
31
- );
32
-
33
- return Feed;
1
+ module.exports = (sequelize, DataTypes) => {
2
+ const Feed = sequelize.define(
3
+ "Feed",
4
+ {
5
+ id: {
6
+ type: DataTypes.UUID,
7
+ defaultValue: DataTypes.UUIDV4,
8
+ primaryKey: true,
9
+ },
10
+ label: {
11
+ type: DataTypes.STRING,
12
+ allowNull: false,
13
+ },
14
+ code: {
15
+ type: DataTypes.STRING,
16
+ allowNull: false,
17
+ unique: true,
18
+ },
19
+ sheet: {
20
+ type: DataTypes.STRING,
21
+ allowNull: false,
22
+ },
23
+ feedProvider: {
24
+ type: DataTypes.STRING,
25
+ allowNull: false,
26
+ },
27
+ },
28
+ {
29
+ tableName: "Feed",
30
+ }
31
+ );
32
+
33
+ return Feed;
34
34
  };
@@ -1,60 +1,60 @@
1
- module.exports = (sequelize, DataTypes) => {
2
- const FrontStoryChannel = sequelize.define(
3
- "FrontStoryChannel",
4
- {
5
- channelId: {
6
- type: DataTypes.STRING,
7
- allowNull: false,
8
- // Not setting as primary key or unique since duplicates are allowed
9
- },
10
- channelName: {
11
- type: DataTypes.STRING,
12
- allowNull: true,
13
- comment: 'Human-readable name for the channel'
14
- },
15
- styleId: {
16
- type: DataTypes.STRING,
17
- allowNull: false,
18
- },
19
- status: {
20
- type: DataTypes.STRING,
21
- allowNull: false,
22
- defaultValue: "free",
23
- validate: {
24
- isIn: [["free", "used", "archived"]],
25
- },
26
- },
27
- connectedCampaigns: {
28
- type: DataTypes.JSONB, // Use JSONB for better querying capabilities
29
- allowNull: false,
30
- defaultValue: [],
31
- },
32
- },
33
- {
34
- tableName: "front_story_channels",
35
- timestamps: true,
36
- // indexes: [
37
- // // Add a composite unique index on channelId and styleId if needed
38
- // {
39
- // unique: true,
40
- // fields: ["channelId", "styleId"],
41
- // name: "unique_front_story_channel_style",
42
- // },
43
- // ],
44
- }
45
- );
46
-
47
- // Define associations without enforcing constraints
48
- FrontStoryChannel.associate = (models) => {
49
- if (models.RSOCFeedCampaign) {
50
- FrontStoryChannel.hasMany(models.RSOCFeedCampaign, {
51
- foreignKey: "channelId",
52
- sourceKey: "channelId",
53
- as: "RSOCFeedCampaigns",
54
- constraints: false, // Disable FK constraint
55
- });
56
- }
57
- };
58
-
59
- return FrontStoryChannel;
1
+ module.exports = (sequelize, DataTypes) => {
2
+ const FrontStoryChannel = sequelize.define(
3
+ "FrontStoryChannel",
4
+ {
5
+ channelId: {
6
+ type: DataTypes.STRING,
7
+ allowNull: false,
8
+ // Not setting as primary key or unique since duplicates are allowed
9
+ },
10
+ channelName: {
11
+ type: DataTypes.STRING,
12
+ allowNull: true,
13
+ comment: 'Human-readable name for the channel'
14
+ },
15
+ styleId: {
16
+ type: DataTypes.STRING,
17
+ allowNull: false,
18
+ },
19
+ status: {
20
+ type: DataTypes.STRING,
21
+ allowNull: false,
22
+ defaultValue: "free",
23
+ validate: {
24
+ isIn: [["free", "used", "archived"]],
25
+ },
26
+ },
27
+ connectedCampaigns: {
28
+ type: DataTypes.JSONB, // Use JSONB for better querying capabilities
29
+ allowNull: false,
30
+ defaultValue: [],
31
+ },
32
+ },
33
+ {
34
+ tableName: "front_story_channels",
35
+ timestamps: true,
36
+ // indexes: [
37
+ // // Add a composite unique index on channelId and styleId if needed
38
+ // {
39
+ // unique: true,
40
+ // fields: ["channelId", "styleId"],
41
+ // name: "unique_front_story_channel_style",
42
+ // },
43
+ // ],
44
+ }
45
+ );
46
+
47
+ // Define associations without enforcing constraints
48
+ FrontStoryChannel.associate = (models) => {
49
+ if (models.RSOCFeedCampaign) {
50
+ FrontStoryChannel.hasMany(models.RSOCFeedCampaign, {
51
+ foreignKey: "channelId",
52
+ sourceKey: "channelId",
53
+ as: "RSOCFeedCampaigns",
54
+ constraints: false, // Disable FK constraint
55
+ });
56
+ }
57
+ };
58
+
59
+ return FrontStoryChannel;
60
60
  };