agrs-sequelize-sdk 1.4.52 → 1.4.53
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/2026-05-17-PIXELS-FOLLOWUP.md +85 -85
- package/migrations/2026-05-17-add-platform-to-ad.js +19 -19
- package/migrations/2026-05-17-add-platform-to-adaccount.js +19 -19
- package/migrations/2026-05-17-add-platform-to-adperformance.js +19 -19
- package/migrations/2026-05-17-add-platform-to-adset.js +19 -19
- package/migrations/2026-05-17-add-platform-to-adsetperformance.js +19 -19
- package/migrations/2026-05-17-add-platform-to-aiarticleretryqueue.js +19 -19
- package/migrations/2026-05-17-add-platform-to-aicampaignqueue.js +19 -19
- package/migrations/2026-05-17-add-platform-to-article.js +19 -19
- package/migrations/2026-05-17-add-platform-to-campaign.js +19 -19
- package/migrations/2026-05-17-add-platform-to-codefuelcampaign.js +19 -19
- package/migrations/2026-05-17-add-platform-to-dynamicfeed.js +19 -19
- package/migrations/2026-05-17-add-platform-to-facebookretryqueue.js +19 -19
- package/migrations/2026-05-17-add-platform-to-pages.js +19 -19
- package/migrations/2026-05-17-add-platform-to-presets.js +19 -19
- package/migrations/2026-05-18-add-group-id-to-ai-campaign-queue.js +18 -18
- package/migrations/2026-05-18-add-platform-code-to-creation-logs.js +65 -65
- package/migrations/2026-05-18-add-platform-code-to-pixels.js +55 -55
- package/migrations/2026-05-18-add-platform-code-to-rsoc-feed-campaigns.js +55 -55
- package/migrations/2026-05-18-add-platform-date-index-to-adperformance.js +16 -16
- package/migrations/2026-05-18-add-platform-date-index-to-adsetperformance.js +16 -16
- package/migrations/2026-05-18-add-review-status-to-ad.js +36 -36
- package/migrations/2026-05-18-create-canonical-insights.js +84 -84
- package/migrations/2026-05-18-create-snapchat-public-profiles.js +68 -68
- package/migrations/2026-05-18-create-tiktok-identities.js +71 -71
- package/migrations/2026-05-18-create-tiktok-snapchat-campaigns.js +143 -143
- package/migrations/2026-05-18-create-tt-snp-adset-ad-tables.js +309 -309
- package/migrations/RUN_ME_MANUALLY_2026-05-17.sql +99 -99
- 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 +152 -152
- 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 +104 -104
- package/models/AdSet.js +295 -295
- package/models/AdSetHistory.js +30 -30
- package/models/AdsetPerformance.js +137 -137
- package/models/AiArticleRetryQueue.js +157 -157
- package/models/AiCreationRetryQueue.js +134 -134
- package/models/ApiAuditLog.js +127 -127
- package/models/ApiToken.js +67 -67
- package/models/Article.js +222 -222
- package/models/AutomationRule.js +179 -179
- package/models/BannerTemplate.js +129 -129
- package/models/Buyers.js +25 -25
- package/models/Campaign.js +168 -163
- package/models/CampaignActionHistory.js +101 -101
- package/models/CampaignCreationLog.js +340 -340
- package/models/CampaignCreationLogV2.js +392 -392
- package/models/CampaignHistory.js +33 -33
- package/models/CampaignTag.js +46 -0
- package/models/CampaignTagAssignment.js +48 -0
- package/models/CanonicalInsights.js +68 -68
- package/models/Channel.js +55 -55
- package/models/Domain.js +44 -44
- package/models/DynamicFeed.js +218 -218
- package/models/ExplorAdsChannel.js +61 -61
- package/models/FacebookRetryQueue.js +163 -163
- 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/MineBrandBlocklist.js +40 -40
- package/models/MineChannel.js +42 -42
- package/models/MineRedirectDomain.js +36 -36
- package/models/MineWebhookEvent.js +53 -53
- package/models/Pages.js +117 -117
- package/models/PipelineExecution.js +59 -59
- package/models/PolicyDogsCreativeCache.js +50 -50
- package/models/PolicyDogsImageCache.js +30 -30
- package/models/Presets.js +40 -40
- package/models/PublicApiBatch.js +155 -155
- package/models/PublicApiBatchItem.js +166 -166
- package/models/PublicApiIdempotencyCache.js +135 -135
- package/models/RSOCFeedCampaign.js +387 -387
- 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/SingularChannel.js +31 -31
- package/models/SnapchatAd.js +69 -69
- package/models/SnapchatAdSquad.js +92 -92
- package/models/SnapchatCampaign.js +69 -69
- package/models/SnapchatChannel.js +31 -31
- package/models/SnapchatPublicProfiles.js +67 -67
- 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/TikTokAd.js +71 -71
- package/models/TikTokAdGroup.js +82 -82
- package/models/TikTokCampaign.js +71 -71
- package/models/TiktokChannel.js +31 -31
- package/models/TiktokIdentities.js +65 -65
- package/models/TokenRotationState.js +121 -121
- package/models/TonicRSOCKeywordPerformance.js +122 -122
- package/models/Users.js +190 -185
- 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
- package/tarzo-skalio-integration-docs.md +691 -691
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
module.exports = (sequelize, DataTypes) => {
|
|
2
|
-
const CampaignHistory = sequelize.define(
|
|
3
|
-
"CampaignHistory",
|
|
4
|
-
{
|
|
5
|
-
HistoryID: {
|
|
6
|
-
type: DataTypes.UUID,
|
|
7
|
-
defaultValue: DataTypes.UUIDV4,
|
|
8
|
-
primaryKey: true,
|
|
9
|
-
},
|
|
10
|
-
CampaignID: {
|
|
11
|
-
type: DataTypes.STRING,
|
|
12
|
-
allowNull: false,
|
|
13
|
-
},
|
|
14
|
-
TableName: {
|
|
15
|
-
type: DataTypes.STRING, // Useful for multi-table history tracking
|
|
16
|
-
defaultValue: "Campaign",
|
|
17
|
-
},
|
|
18
|
-
DataSnapshot: {
|
|
19
|
-
type: DataTypes.JSONB, // Store the entire row as JSON
|
|
20
|
-
allowNull: false,
|
|
21
|
-
},
|
|
22
|
-
timestamp: {
|
|
23
|
-
type: DataTypes.DATE,
|
|
24
|
-
defaultValue: DataTypes.NOW,
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
tableName: "CampaignHistory",
|
|
29
|
-
}
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
return CampaignHistory;
|
|
33
|
-
};
|
|
1
|
+
module.exports = (sequelize, DataTypes) => {
|
|
2
|
+
const CampaignHistory = sequelize.define(
|
|
3
|
+
"CampaignHistory",
|
|
4
|
+
{
|
|
5
|
+
HistoryID: {
|
|
6
|
+
type: DataTypes.UUID,
|
|
7
|
+
defaultValue: DataTypes.UUIDV4,
|
|
8
|
+
primaryKey: true,
|
|
9
|
+
},
|
|
10
|
+
CampaignID: {
|
|
11
|
+
type: DataTypes.STRING,
|
|
12
|
+
allowNull: false,
|
|
13
|
+
},
|
|
14
|
+
TableName: {
|
|
15
|
+
type: DataTypes.STRING, // Useful for multi-table history tracking
|
|
16
|
+
defaultValue: "Campaign",
|
|
17
|
+
},
|
|
18
|
+
DataSnapshot: {
|
|
19
|
+
type: DataTypes.JSONB, // Store the entire row as JSON
|
|
20
|
+
allowNull: false,
|
|
21
|
+
},
|
|
22
|
+
timestamp: {
|
|
23
|
+
type: DataTypes.DATE,
|
|
24
|
+
defaultValue: DataTypes.NOW,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
tableName: "CampaignHistory",
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
return CampaignHistory;
|
|
33
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
module.exports = (sequelize, DataTypes) => {
|
|
2
|
+
const CampaignTag = sequelize.define(
|
|
3
|
+
"CampaignTag",
|
|
4
|
+
{
|
|
5
|
+
id: {
|
|
6
|
+
type: DataTypes.UUID,
|
|
7
|
+
defaultValue: DataTypes.UUIDV4,
|
|
8
|
+
primaryKey: true,
|
|
9
|
+
},
|
|
10
|
+
name: {
|
|
11
|
+
type: DataTypes.STRING(255),
|
|
12
|
+
allowNull: false,
|
|
13
|
+
comment: "Display name; uniqueness enforced case-insensitively in DB",
|
|
14
|
+
},
|
|
15
|
+
created_by: {
|
|
16
|
+
type: DataTypes.UUID,
|
|
17
|
+
allowNull: true,
|
|
18
|
+
field: "created_by",
|
|
19
|
+
references: { model: "Users", key: "id" },
|
|
20
|
+
comment: "Users.id of creator when known",
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
tableName: "campaign_tags",
|
|
25
|
+
underscored: true,
|
|
26
|
+
indexes: [
|
|
27
|
+
// Owner migration must also add UNIQUE INDEX on lower(name)
|
|
28
|
+
{ fields: ["name"] },
|
|
29
|
+
{ fields: ["created_by"] },
|
|
30
|
+
],
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
CampaignTag.associate = (models) => {
|
|
35
|
+
CampaignTag.belongsTo(models.Users, {
|
|
36
|
+
foreignKey: "created_by",
|
|
37
|
+
as: "creator",
|
|
38
|
+
});
|
|
39
|
+
CampaignTag.hasMany(models.CampaignTagAssignment, {
|
|
40
|
+
foreignKey: "tag_id",
|
|
41
|
+
as: "assignments",
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
return CampaignTag;
|
|
46
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
module.exports = (sequelize, DataTypes) => {
|
|
2
|
+
const CampaignTagAssignment = sequelize.define(
|
|
3
|
+
"CampaignTagAssignment",
|
|
4
|
+
{
|
|
5
|
+
id: {
|
|
6
|
+
type: DataTypes.UUID,
|
|
7
|
+
defaultValue: DataTypes.UUIDV4,
|
|
8
|
+
primaryKey: true,
|
|
9
|
+
},
|
|
10
|
+
tag_id: {
|
|
11
|
+
type: DataTypes.UUID,
|
|
12
|
+
allowNull: false,
|
|
13
|
+
field: "tag_id",
|
|
14
|
+
references: { model: "CampaignTag", key: "id" },
|
|
15
|
+
},
|
|
16
|
+
campaign_id: {
|
|
17
|
+
type: DataTypes.STRING,
|
|
18
|
+
allowNull: false,
|
|
19
|
+
field: "campaign_id",
|
|
20
|
+
references: { model: "Campaign", key: "CampaignID" },
|
|
21
|
+
comment: "Campaign.CampaignID (fb/tt/snp)",
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
tableName: "campaign_tag_assignments",
|
|
26
|
+
underscored: true,
|
|
27
|
+
indexes: [
|
|
28
|
+
{ unique: true, fields: ["tag_id", "campaign_id"] },
|
|
29
|
+
{ fields: ["campaign_id"] },
|
|
30
|
+
{ fields: ["tag_id"] },
|
|
31
|
+
],
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
CampaignTagAssignment.associate = (models) => {
|
|
36
|
+
CampaignTagAssignment.belongsTo(models.CampaignTag, {
|
|
37
|
+
foreignKey: "tag_id",
|
|
38
|
+
as: "tag",
|
|
39
|
+
});
|
|
40
|
+
CampaignTagAssignment.belongsTo(models.Campaign, {
|
|
41
|
+
foreignKey: "campaign_id",
|
|
42
|
+
targetKey: "CampaignID",
|
|
43
|
+
as: "campaign",
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
return CampaignTagAssignment;
|
|
48
|
+
};
|
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
module.exports = (sequelize, DataTypes) => {
|
|
2
|
-
const CanonicalInsights = sequelize.define(
|
|
3
|
-
"CanonicalInsights",
|
|
4
|
-
{
|
|
5
|
-
id: {
|
|
6
|
-
type: DataTypes.BIGINT,
|
|
7
|
-
primaryKey: true,
|
|
8
|
-
autoIncrement: true,
|
|
9
|
-
},
|
|
10
|
-
platform: {
|
|
11
|
-
type: DataTypes.ENUM("fb", "tt", "snp"),
|
|
12
|
-
allowNull: false,
|
|
13
|
-
comment: "Ad platform identifier: fb=Facebook, tt=TikTok, snp=Snapchat",
|
|
14
|
-
},
|
|
15
|
-
entity_type: {
|
|
16
|
-
type: DataTypes.ENUM("campaign", "adset", "ad"),
|
|
17
|
-
allowNull: false,
|
|
18
|
-
},
|
|
19
|
-
entity_id: {
|
|
20
|
-
type: DataTypes.STRING(64),
|
|
21
|
-
allowNull: false,
|
|
22
|
-
},
|
|
23
|
-
date: {
|
|
24
|
-
type: DataTypes.DATEONLY,
|
|
25
|
-
allowNull: false,
|
|
26
|
-
},
|
|
27
|
-
impressions: {
|
|
28
|
-
type: DataTypes.BIGINT,
|
|
29
|
-
defaultValue: 0,
|
|
30
|
-
},
|
|
31
|
-
clicks: {
|
|
32
|
-
type: DataTypes.BIGINT,
|
|
33
|
-
defaultValue: 0,
|
|
34
|
-
},
|
|
35
|
-
spend: {
|
|
36
|
-
type: DataTypes.DECIMAL(14, 4),
|
|
37
|
-
defaultValue: 0,
|
|
38
|
-
},
|
|
39
|
-
conversions: {
|
|
40
|
-
type: DataTypes.BIGINT,
|
|
41
|
-
defaultValue: 0,
|
|
42
|
-
},
|
|
43
|
-
revenue: {
|
|
44
|
-
type: DataTypes.DECIMAL(14, 4),
|
|
45
|
-
defaultValue: 0,
|
|
46
|
-
},
|
|
47
|
-
raw_payload: {
|
|
48
|
-
type: DataTypes.JSONB,
|
|
49
|
-
allowNull: true,
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
tableName: "canonical_insights",
|
|
54
|
-
indexes: [
|
|
55
|
-
{
|
|
56
|
-
unique: true,
|
|
57
|
-
name: "canonical_insights_unique_per_entity_date",
|
|
58
|
-
fields: ["platform", "entity_type", "entity_id", "date"],
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
fields: ["platform", "date"],
|
|
62
|
-
},
|
|
63
|
-
],
|
|
64
|
-
}
|
|
65
|
-
);
|
|
66
|
-
|
|
67
|
-
return CanonicalInsights;
|
|
68
|
-
};
|
|
1
|
+
module.exports = (sequelize, DataTypes) => {
|
|
2
|
+
const CanonicalInsights = sequelize.define(
|
|
3
|
+
"CanonicalInsights",
|
|
4
|
+
{
|
|
5
|
+
id: {
|
|
6
|
+
type: DataTypes.BIGINT,
|
|
7
|
+
primaryKey: true,
|
|
8
|
+
autoIncrement: true,
|
|
9
|
+
},
|
|
10
|
+
platform: {
|
|
11
|
+
type: DataTypes.ENUM("fb", "tt", "snp"),
|
|
12
|
+
allowNull: false,
|
|
13
|
+
comment: "Ad platform identifier: fb=Facebook, tt=TikTok, snp=Snapchat",
|
|
14
|
+
},
|
|
15
|
+
entity_type: {
|
|
16
|
+
type: DataTypes.ENUM("campaign", "adset", "ad"),
|
|
17
|
+
allowNull: false,
|
|
18
|
+
},
|
|
19
|
+
entity_id: {
|
|
20
|
+
type: DataTypes.STRING(64),
|
|
21
|
+
allowNull: false,
|
|
22
|
+
},
|
|
23
|
+
date: {
|
|
24
|
+
type: DataTypes.DATEONLY,
|
|
25
|
+
allowNull: false,
|
|
26
|
+
},
|
|
27
|
+
impressions: {
|
|
28
|
+
type: DataTypes.BIGINT,
|
|
29
|
+
defaultValue: 0,
|
|
30
|
+
},
|
|
31
|
+
clicks: {
|
|
32
|
+
type: DataTypes.BIGINT,
|
|
33
|
+
defaultValue: 0,
|
|
34
|
+
},
|
|
35
|
+
spend: {
|
|
36
|
+
type: DataTypes.DECIMAL(14, 4),
|
|
37
|
+
defaultValue: 0,
|
|
38
|
+
},
|
|
39
|
+
conversions: {
|
|
40
|
+
type: DataTypes.BIGINT,
|
|
41
|
+
defaultValue: 0,
|
|
42
|
+
},
|
|
43
|
+
revenue: {
|
|
44
|
+
type: DataTypes.DECIMAL(14, 4),
|
|
45
|
+
defaultValue: 0,
|
|
46
|
+
},
|
|
47
|
+
raw_payload: {
|
|
48
|
+
type: DataTypes.JSONB,
|
|
49
|
+
allowNull: true,
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
tableName: "canonical_insights",
|
|
54
|
+
indexes: [
|
|
55
|
+
{
|
|
56
|
+
unique: true,
|
|
57
|
+
name: "canonical_insights_unique_per_entity_date",
|
|
58
|
+
fields: ["platform", "entity_type", "entity_id", "date"],
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
fields: ["platform", "date"],
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
return CanonicalInsights;
|
|
68
|
+
};
|
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,45 +1,45 @@
|
|
|
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
|
-
feedProvider: {
|
|
20
|
-
type: DataTypes.ARRAY(DataTypes.STRING),
|
|
21
|
-
allowNull: true,
|
|
22
|
-
defaultValue: [],
|
|
23
|
-
},
|
|
24
|
-
isDefault: {
|
|
25
|
-
type: DataTypes.BOOLEAN,
|
|
26
|
-
allowNull: false,
|
|
27
|
-
defaultValue: false,
|
|
28
|
-
},
|
|
29
|
-
weight: {
|
|
30
|
-
type: DataTypes.STRING,
|
|
31
|
-
allowNull: true,
|
|
32
|
-
},
|
|
33
|
-
ws_code: {
|
|
34
|
-
type: DataTypes.STRING(32),
|
|
35
|
-
allowNull: true,
|
|
36
|
-
comment: "Mine redirect ws= parameter code for this publisher domain",
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
tableName: "Domain",
|
|
41
|
-
}
|
|
42
|
-
);
|
|
43
|
-
|
|
44
|
-
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
|
+
feedProvider: {
|
|
20
|
+
type: DataTypes.ARRAY(DataTypes.STRING),
|
|
21
|
+
allowNull: true,
|
|
22
|
+
defaultValue: [],
|
|
23
|
+
},
|
|
24
|
+
isDefault: {
|
|
25
|
+
type: DataTypes.BOOLEAN,
|
|
26
|
+
allowNull: false,
|
|
27
|
+
defaultValue: false,
|
|
28
|
+
},
|
|
29
|
+
weight: {
|
|
30
|
+
type: DataTypes.STRING,
|
|
31
|
+
allowNull: true,
|
|
32
|
+
},
|
|
33
|
+
ws_code: {
|
|
34
|
+
type: DataTypes.STRING(32),
|
|
35
|
+
allowNull: true,
|
|
36
|
+
comment: "Mine redirect ws= parameter code for this publisher domain",
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
tableName: "Domain",
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
return Domain;
|
|
45
45
|
};
|