agrs-sequelize-sdk 1.3.78 → 1.3.79
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/migrations/add-requested-from-dashboard-to-articles.js +17 -17
- package/migrations/change-adset-name-to-text.js +79 -79
- package/models/AICampaignQueue.js +136 -136
- package/models/AIGenerationLog.js +85 -85
- package/models/AIGenerationRequest.js +212 -212
- package/models/AdAccountValues.js +25 -25
- package/models/AdHistory.js +30 -30
- package/models/AdPerformance.js +94 -94
- package/models/AdSet.js +289 -289
- package/models/AdSetHistory.js +30 -30
- package/models/AdsetPerformance.js +126 -126
- package/models/AiArticleRetryQueue.js +150 -150
- package/models/Article.js +196 -196
- package/models/AutomationRule.js +173 -173
- package/models/BannerTemplate.js +129 -129
- package/models/Buyers.js +25 -25
- package/models/Campaign.js +157 -157
- package/models/CampaignActionHistory.js +86 -86
- package/models/CampaignCreationLog.js +309 -309
- package/models/CampaignCreationLogV2.js +314 -314
- package/models/CampaignHistory.js +33 -33
- package/models/Channel.js +55 -55
- package/models/Domain.js +40 -35
- package/models/DynamicFeed.js +212 -212
- package/models/ExplorAdsChannel.js +61 -61
- package/models/Feed.js +33 -33
- package/models/FeedArticleConfiguration.js +80 -80
- package/models/FrontStoryChannel.js +59 -59
- package/models/FrontStoryChannelV2.js +60 -60
- package/models/GenericFlowRequest.js +114 -114
- package/models/MidoWebChannel.js +47 -47
- package/models/MineChannel.js +42 -42
- package/models/Pages.js +92 -92
- package/models/PipelineExecution.js +59 -59
- package/models/PolicyDogsCreativeCache.js +50 -50
- package/models/PolicyDogsImageCache.js +30 -30
- package/models/Presets.js +34 -34
- package/models/RSOCFeedCampaign.js +375 -375
- package/models/RsocKeywordPerformance.js +110 -110
- package/models/RuleAction.js +90 -90
- package/models/RuleCondition.js +137 -137
- package/models/RuleExecution.js +107 -107
- package/models/RulesValues.js +56 -56
- package/models/SupportedLocale.js +23 -23
- package/models/SyncHistory.js +249 -249
- package/models/TTQChannel.js +42 -42
- package/models/TemplateMetadata.js +260 -260
- package/models/Tier2_AdAccounts.js +110 -110
- package/models/Tier2_Assets.js +70 -70
- package/models/Tier2_BusinessManagers.js +105 -105
- package/models/Tier2_CreditLines.js +99 -99
- package/models/Tier2_Pages.js +91 -91
- package/models/Tier2_Pixels.js +82 -82
- package/models/Tier2_Tokens.js +64 -64
- package/models/Tier2_UserAdAccounts.js +83 -83
- package/models/TokenRotationState.js +121 -121
- package/models/TonicRSOCKeywordPerformance.js +122 -122
- package/models/Users.js +138 -138
- package/models/Vertical.js +25 -25
- package/models/newFiles.js +137 -137
- package/package.json +21 -19
- package/run.sh +214 -214
- package/services/sequelizeService.js +110 -110
|
@@ -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,81 +1,81 @@
|
|
|
1
|
-
module.exports = (sequelize, DataTypes) => {
|
|
2
|
-
const FeedArticleConfiguration = sequelize.define(
|
|
3
|
-
"FeedArticleConfiguration",
|
|
4
|
-
{
|
|
5
|
-
id: {
|
|
6
|
-
type: DataTypes.INTEGER,
|
|
7
|
-
primaryKey: true,
|
|
8
|
-
autoIncrement: true,
|
|
9
|
-
},
|
|
10
|
-
feedProvider: {
|
|
11
|
-
type: DataTypes.STRING(100),
|
|
12
|
-
allowNull: false,
|
|
13
|
-
unique: true,
|
|
14
|
-
field: "feed_provider",
|
|
15
|
-
},
|
|
16
|
-
requiredFields: {
|
|
17
|
-
type: DataTypes.JSONB,
|
|
18
|
-
allowNull: false,
|
|
19
|
-
defaultValue: [],
|
|
20
|
-
field: "required_fields",
|
|
21
|
-
comment: "Array of field configs: [{ name, description, allowedValues }]"
|
|
22
|
-
},
|
|
23
|
-
model: {
|
|
24
|
-
type: DataTypes.STRING(50),
|
|
25
|
-
allowNull: false,
|
|
26
|
-
defaultValue: "gpt-4o-mini",
|
|
27
|
-
comment: "OpenAI model to use for this feed"
|
|
28
|
-
},
|
|
29
|
-
temperature: {
|
|
30
|
-
type: DataTypes.FLOAT,
|
|
31
|
-
allowNull: false,
|
|
32
|
-
defaultValue: 0.7,
|
|
33
|
-
comment: "Temperature for AI generation (0.0-1.0)"
|
|
34
|
-
},
|
|
35
|
-
baseUrl: {
|
|
36
|
-
type: DataTypes.STRING(500),
|
|
37
|
-
allowNull: true,
|
|
38
|
-
field: "base_url",
|
|
39
|
-
},
|
|
40
|
-
isActive: {
|
|
41
|
-
type: DataTypes.BOOLEAN,
|
|
42
|
-
allowNull: false,
|
|
43
|
-
defaultValue: true,
|
|
44
|
-
field: "is_active",
|
|
45
|
-
},
|
|
46
|
-
createdAt: {
|
|
47
|
-
type: DataTypes.DATE,
|
|
48
|
-
allowNull: false,
|
|
49
|
-
defaultValue: DataTypes.NOW,
|
|
50
|
-
field: "created_at",
|
|
51
|
-
},
|
|
52
|
-
updatedAt: {
|
|
53
|
-
type: DataTypes.DATE,
|
|
54
|
-
allowNull: false,
|
|
55
|
-
defaultValue: DataTypes.NOW,
|
|
56
|
-
field: "updated_at",
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
tableName: "feed_article_configurations",
|
|
61
|
-
timestamps: true,
|
|
62
|
-
createdAt: "created_at",
|
|
63
|
-
updatedAt: "updated_at",
|
|
64
|
-
indexes: [
|
|
65
|
-
{
|
|
66
|
-
unique: true,
|
|
67
|
-
fields: ["feed_provider"],
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
fields: ["is_active"],
|
|
71
|
-
},
|
|
72
|
-
],
|
|
73
|
-
}
|
|
74
|
-
);
|
|
75
|
-
|
|
76
|
-
FeedArticleConfiguration.associate = (models) => {
|
|
77
|
-
// Future: Add associations if needed
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
return FeedArticleConfiguration;
|
|
1
|
+
module.exports = (sequelize, DataTypes) => {
|
|
2
|
+
const FeedArticleConfiguration = sequelize.define(
|
|
3
|
+
"FeedArticleConfiguration",
|
|
4
|
+
{
|
|
5
|
+
id: {
|
|
6
|
+
type: DataTypes.INTEGER,
|
|
7
|
+
primaryKey: true,
|
|
8
|
+
autoIncrement: true,
|
|
9
|
+
},
|
|
10
|
+
feedProvider: {
|
|
11
|
+
type: DataTypes.STRING(100),
|
|
12
|
+
allowNull: false,
|
|
13
|
+
unique: true,
|
|
14
|
+
field: "feed_provider",
|
|
15
|
+
},
|
|
16
|
+
requiredFields: {
|
|
17
|
+
type: DataTypes.JSONB,
|
|
18
|
+
allowNull: false,
|
|
19
|
+
defaultValue: [],
|
|
20
|
+
field: "required_fields",
|
|
21
|
+
comment: "Array of field configs: [{ name, description, allowedValues }]"
|
|
22
|
+
},
|
|
23
|
+
model: {
|
|
24
|
+
type: DataTypes.STRING(50),
|
|
25
|
+
allowNull: false,
|
|
26
|
+
defaultValue: "gpt-4o-mini",
|
|
27
|
+
comment: "OpenAI model to use for this feed"
|
|
28
|
+
},
|
|
29
|
+
temperature: {
|
|
30
|
+
type: DataTypes.FLOAT,
|
|
31
|
+
allowNull: false,
|
|
32
|
+
defaultValue: 0.7,
|
|
33
|
+
comment: "Temperature for AI generation (0.0-1.0)"
|
|
34
|
+
},
|
|
35
|
+
baseUrl: {
|
|
36
|
+
type: DataTypes.STRING(500),
|
|
37
|
+
allowNull: true,
|
|
38
|
+
field: "base_url",
|
|
39
|
+
},
|
|
40
|
+
isActive: {
|
|
41
|
+
type: DataTypes.BOOLEAN,
|
|
42
|
+
allowNull: false,
|
|
43
|
+
defaultValue: true,
|
|
44
|
+
field: "is_active",
|
|
45
|
+
},
|
|
46
|
+
createdAt: {
|
|
47
|
+
type: DataTypes.DATE,
|
|
48
|
+
allowNull: false,
|
|
49
|
+
defaultValue: DataTypes.NOW,
|
|
50
|
+
field: "created_at",
|
|
51
|
+
},
|
|
52
|
+
updatedAt: {
|
|
53
|
+
type: DataTypes.DATE,
|
|
54
|
+
allowNull: false,
|
|
55
|
+
defaultValue: DataTypes.NOW,
|
|
56
|
+
field: "updated_at",
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
tableName: "feed_article_configurations",
|
|
61
|
+
timestamps: true,
|
|
62
|
+
createdAt: "created_at",
|
|
63
|
+
updatedAt: "updated_at",
|
|
64
|
+
indexes: [
|
|
65
|
+
{
|
|
66
|
+
unique: true,
|
|
67
|
+
fields: ["feed_provider"],
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
fields: ["is_active"],
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
}
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
FeedArticleConfiguration.associate = (models) => {
|
|
77
|
+
// Future: Add associations if needed
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
return FeedArticleConfiguration;
|
|
81
81
|
};
|
|
@@ -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
|
};
|
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
module.exports = (sequelize, DataTypes) => {
|
|
2
|
-
const FrontStoryChannelV2 = sequelize.define(
|
|
3
|
-
"FrontStoryChannelV2",
|
|
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_v2",
|
|
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_v2_style",
|
|
42
|
-
// },
|
|
43
|
-
// ],
|
|
44
|
-
}
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
// Define associations without enforcing constraints
|
|
48
|
-
FrontStoryChannelV2.associate = (models) => {
|
|
49
|
-
if (models.RSOCFeedCampaign) {
|
|
50
|
-
FrontStoryChannelV2.hasMany(models.RSOCFeedCampaign, {
|
|
51
|
-
foreignKey: "channelId",
|
|
52
|
-
sourceKey: "channelId",
|
|
53
|
-
as: "RSOCFeedCampaigns",
|
|
54
|
-
constraints: false, // Disable FK constraint
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
return FrontStoryChannelV2;
|
|
60
|
-
};
|
|
1
|
+
module.exports = (sequelize, DataTypes) => {
|
|
2
|
+
const FrontStoryChannelV2 = sequelize.define(
|
|
3
|
+
"FrontStoryChannelV2",
|
|
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_v2",
|
|
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_v2_style",
|
|
42
|
+
// },
|
|
43
|
+
// ],
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
// Define associations without enforcing constraints
|
|
48
|
+
FrontStoryChannelV2.associate = (models) => {
|
|
49
|
+
if (models.RSOCFeedCampaign) {
|
|
50
|
+
FrontStoryChannelV2.hasMany(models.RSOCFeedCampaign, {
|
|
51
|
+
foreignKey: "channelId",
|
|
52
|
+
sourceKey: "channelId",
|
|
53
|
+
as: "RSOCFeedCampaigns",
|
|
54
|
+
constraints: false, // Disable FK constraint
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
return FrontStoryChannelV2;
|
|
60
|
+
};
|