agrs-sequelize-sdk 1.4.59 → 1.4.61
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 +151 -151
- 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 -168
- 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 -46
- package/models/CampaignTagAssignment.js +48 -48
- package/models/CanonicalInsights.js +68 -68
- package/models/Channel.js +55 -55
- package/models/Domain.js +49 -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 +56 -56
- package/models/MineBrandConfig.js +26 -26
- package/models/MineChannel.js +47 -47
- package/models/MineRedirectDomain.js +42 -42
- 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/RSOCFeedConfig.js +46 -46
- package/models/RSOCRedirectWsCode.js +22 -22
- 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/Team.js +33 -43
- 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 +204 -204
- 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,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
|
+
};
|
|
@@ -1,115 +1,115 @@
|
|
|
1
|
-
// models/GenericFlowRequest.js
|
|
2
|
-
module.exports = (sequelize, DataTypes) => {
|
|
3
|
-
const GenericFlowRequest = sequelize.define(
|
|
4
|
-
"GenericFlowRequest",
|
|
5
|
-
{
|
|
6
|
-
id: {
|
|
7
|
-
type: DataTypes.BIGINT,
|
|
8
|
-
autoIncrement: true,
|
|
9
|
-
primaryKey: true,
|
|
10
|
-
},
|
|
11
|
-
request_id: {
|
|
12
|
-
type: DataTypes.STRING,
|
|
13
|
-
allowNull: false,
|
|
14
|
-
unique: true,
|
|
15
|
-
field: "request_id",
|
|
16
|
-
},
|
|
17
|
-
flow_type: {
|
|
18
|
-
type: DataTypes.ENUM("article", "texts", "keywords", "creative"),
|
|
19
|
-
allowNull: false,
|
|
20
|
-
field: "flow_type",
|
|
21
|
-
},
|
|
22
|
-
status: {
|
|
23
|
-
type: DataTypes.ENUM("pending", "processing", "completed", "failed", "retrying"),
|
|
24
|
-
defaultValue: "pending",
|
|
25
|
-
allowNull: false,
|
|
26
|
-
},
|
|
27
|
-
retry_count: {
|
|
28
|
-
type: DataTypes.INTEGER,
|
|
29
|
-
defaultValue: 0,
|
|
30
|
-
field: "retry_count",
|
|
31
|
-
},
|
|
32
|
-
max_retries: {
|
|
33
|
-
type: DataTypes.INTEGER,
|
|
34
|
-
defaultValue: 3,
|
|
35
|
-
field: "max_retries",
|
|
36
|
-
},
|
|
37
|
-
input_params: {
|
|
38
|
-
type: DataTypes.JSONB,
|
|
39
|
-
allowNull: true,
|
|
40
|
-
field: "input_params",
|
|
41
|
-
},
|
|
42
|
-
output_result: {
|
|
43
|
-
type: DataTypes.JSONB,
|
|
44
|
-
allowNull: true,
|
|
45
|
-
field: "output_result",
|
|
46
|
-
},
|
|
47
|
-
error_message: {
|
|
48
|
-
type: DataTypes.TEXT,
|
|
49
|
-
allowNull: true,
|
|
50
|
-
field: "error_message",
|
|
51
|
-
},
|
|
52
|
-
error_stack: {
|
|
53
|
-
type: DataTypes.TEXT,
|
|
54
|
-
allowNull: true,
|
|
55
|
-
field: "error_stack",
|
|
56
|
-
},
|
|
57
|
-
AGRS_CID: {
|
|
58
|
-
type: DataTypes.STRING,
|
|
59
|
-
allowNull: true,
|
|
60
|
-
field: "AGRS_CID",
|
|
61
|
-
},
|
|
62
|
-
process_id: {
|
|
63
|
-
type: DataTypes.STRING,
|
|
64
|
-
allowNull: true,
|
|
65
|
-
field: "process_id",
|
|
66
|
-
},
|
|
67
|
-
parent_request_id: {
|
|
68
|
-
type: DataTypes.STRING,
|
|
69
|
-
allowNull: true,
|
|
70
|
-
field: "parent_request_id",
|
|
71
|
-
},
|
|
72
|
-
related_request_ids: {
|
|
73
|
-
type: DataTypes.JSONB,
|
|
74
|
-
allowNull: true,
|
|
75
|
-
field: "related_request_ids",
|
|
76
|
-
},
|
|
77
|
-
metadata: {
|
|
78
|
-
type: DataTypes.JSONB,
|
|
79
|
-
allowNull: true,
|
|
80
|
-
},
|
|
81
|
-
processing_time_ms: {
|
|
82
|
-
type: DataTypes.INTEGER,
|
|
83
|
-
allowNull: true,
|
|
84
|
-
field: "processing_time_ms",
|
|
85
|
-
},
|
|
86
|
-
started_at: {
|
|
87
|
-
type: DataTypes.DATE,
|
|
88
|
-
allowNull: true,
|
|
89
|
-
field: "started_at",
|
|
90
|
-
},
|
|
91
|
-
completed_at: {
|
|
92
|
-
type: DataTypes.DATE,
|
|
93
|
-
allowNull: true,
|
|
94
|
-
field: "completed_at",
|
|
95
|
-
},
|
|
96
|
-
failed_at: {
|
|
97
|
-
type: DataTypes.DATE,
|
|
98
|
-
allowNull: true,
|
|
99
|
-
field: "failed_at",
|
|
100
|
-
},
|
|
101
|
-
last_retry_at: {
|
|
102
|
-
type: DataTypes.DATE,
|
|
103
|
-
allowNull: true,
|
|
104
|
-
field: "last_retry_at",
|
|
105
|
-
},
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
tableName: "generic_flow_requests",
|
|
109
|
-
timestamps: true, // Adds createdAt and updatedAt
|
|
110
|
-
underscored: false, // We're using explicit field mappings
|
|
111
|
-
}
|
|
112
|
-
);
|
|
113
|
-
|
|
114
|
-
return GenericFlowRequest;
|
|
1
|
+
// models/GenericFlowRequest.js
|
|
2
|
+
module.exports = (sequelize, DataTypes) => {
|
|
3
|
+
const GenericFlowRequest = sequelize.define(
|
|
4
|
+
"GenericFlowRequest",
|
|
5
|
+
{
|
|
6
|
+
id: {
|
|
7
|
+
type: DataTypes.BIGINT,
|
|
8
|
+
autoIncrement: true,
|
|
9
|
+
primaryKey: true,
|
|
10
|
+
},
|
|
11
|
+
request_id: {
|
|
12
|
+
type: DataTypes.STRING,
|
|
13
|
+
allowNull: false,
|
|
14
|
+
unique: true,
|
|
15
|
+
field: "request_id",
|
|
16
|
+
},
|
|
17
|
+
flow_type: {
|
|
18
|
+
type: DataTypes.ENUM("article", "texts", "keywords", "creative"),
|
|
19
|
+
allowNull: false,
|
|
20
|
+
field: "flow_type",
|
|
21
|
+
},
|
|
22
|
+
status: {
|
|
23
|
+
type: DataTypes.ENUM("pending", "processing", "completed", "failed", "retrying"),
|
|
24
|
+
defaultValue: "pending",
|
|
25
|
+
allowNull: false,
|
|
26
|
+
},
|
|
27
|
+
retry_count: {
|
|
28
|
+
type: DataTypes.INTEGER,
|
|
29
|
+
defaultValue: 0,
|
|
30
|
+
field: "retry_count",
|
|
31
|
+
},
|
|
32
|
+
max_retries: {
|
|
33
|
+
type: DataTypes.INTEGER,
|
|
34
|
+
defaultValue: 3,
|
|
35
|
+
field: "max_retries",
|
|
36
|
+
},
|
|
37
|
+
input_params: {
|
|
38
|
+
type: DataTypes.JSONB,
|
|
39
|
+
allowNull: true,
|
|
40
|
+
field: "input_params",
|
|
41
|
+
},
|
|
42
|
+
output_result: {
|
|
43
|
+
type: DataTypes.JSONB,
|
|
44
|
+
allowNull: true,
|
|
45
|
+
field: "output_result",
|
|
46
|
+
},
|
|
47
|
+
error_message: {
|
|
48
|
+
type: DataTypes.TEXT,
|
|
49
|
+
allowNull: true,
|
|
50
|
+
field: "error_message",
|
|
51
|
+
},
|
|
52
|
+
error_stack: {
|
|
53
|
+
type: DataTypes.TEXT,
|
|
54
|
+
allowNull: true,
|
|
55
|
+
field: "error_stack",
|
|
56
|
+
},
|
|
57
|
+
AGRS_CID: {
|
|
58
|
+
type: DataTypes.STRING,
|
|
59
|
+
allowNull: true,
|
|
60
|
+
field: "AGRS_CID",
|
|
61
|
+
},
|
|
62
|
+
process_id: {
|
|
63
|
+
type: DataTypes.STRING,
|
|
64
|
+
allowNull: true,
|
|
65
|
+
field: "process_id",
|
|
66
|
+
},
|
|
67
|
+
parent_request_id: {
|
|
68
|
+
type: DataTypes.STRING,
|
|
69
|
+
allowNull: true,
|
|
70
|
+
field: "parent_request_id",
|
|
71
|
+
},
|
|
72
|
+
related_request_ids: {
|
|
73
|
+
type: DataTypes.JSONB,
|
|
74
|
+
allowNull: true,
|
|
75
|
+
field: "related_request_ids",
|
|
76
|
+
},
|
|
77
|
+
metadata: {
|
|
78
|
+
type: DataTypes.JSONB,
|
|
79
|
+
allowNull: true,
|
|
80
|
+
},
|
|
81
|
+
processing_time_ms: {
|
|
82
|
+
type: DataTypes.INTEGER,
|
|
83
|
+
allowNull: true,
|
|
84
|
+
field: "processing_time_ms",
|
|
85
|
+
},
|
|
86
|
+
started_at: {
|
|
87
|
+
type: DataTypes.DATE,
|
|
88
|
+
allowNull: true,
|
|
89
|
+
field: "started_at",
|
|
90
|
+
},
|
|
91
|
+
completed_at: {
|
|
92
|
+
type: DataTypes.DATE,
|
|
93
|
+
allowNull: true,
|
|
94
|
+
field: "completed_at",
|
|
95
|
+
},
|
|
96
|
+
failed_at: {
|
|
97
|
+
type: DataTypes.DATE,
|
|
98
|
+
allowNull: true,
|
|
99
|
+
field: "failed_at",
|
|
100
|
+
},
|
|
101
|
+
last_retry_at: {
|
|
102
|
+
type: DataTypes.DATE,
|
|
103
|
+
allowNull: true,
|
|
104
|
+
field: "last_retry_at",
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
tableName: "generic_flow_requests",
|
|
109
|
+
timestamps: true, // Adds createdAt and updatedAt
|
|
110
|
+
underscored: false, // We're using explicit field mappings
|
|
111
|
+
}
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
return GenericFlowRequest;
|
|
115
115
|
};
|
package/models/MidoWebChannel.js
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
module.exports = (sequelize, DataTypes) => {
|
|
2
|
-
const MidoWebChannel = sequelize.define(
|
|
3
|
-
"MidoWebChannel",
|
|
4
|
-
{
|
|
5
|
-
channelId: {
|
|
6
|
-
type: DataTypes.STRING,
|
|
7
|
-
allowNull: false,
|
|
8
|
-
unique: true,
|
|
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: "mido_web_channels",
|
|
30
|
-
timestamps: true,
|
|
31
|
-
}
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
// Define associations without enforcing constraints
|
|
35
|
-
MidoWebChannel.associate = (models) => {
|
|
36
|
-
if (models.RSOCFeedCampaign) {
|
|
37
|
-
MidoWebChannel.hasMany(models.RSOCFeedCampaign, {
|
|
38
|
-
foreignKey: "channelId",
|
|
39
|
-
sourceKey: "channelId",
|
|
40
|
-
as: "RSOCFeedCampaigns",
|
|
41
|
-
constraints: false, // Disable FK constraint
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
return MidoWebChannel;
|
|
47
|
-
};
|
|
1
|
+
module.exports = (sequelize, DataTypes) => {
|
|
2
|
+
const MidoWebChannel = sequelize.define(
|
|
3
|
+
"MidoWebChannel",
|
|
4
|
+
{
|
|
5
|
+
channelId: {
|
|
6
|
+
type: DataTypes.STRING,
|
|
7
|
+
allowNull: false,
|
|
8
|
+
unique: true,
|
|
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: "mido_web_channels",
|
|
30
|
+
timestamps: true,
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
// Define associations without enforcing constraints
|
|
35
|
+
MidoWebChannel.associate = (models) => {
|
|
36
|
+
if (models.RSOCFeedCampaign) {
|
|
37
|
+
MidoWebChannel.hasMany(models.RSOCFeedCampaign, {
|
|
38
|
+
foreignKey: "channelId",
|
|
39
|
+
sourceKey: "channelId",
|
|
40
|
+
as: "RSOCFeedCampaigns",
|
|
41
|
+
constraints: false, // Disable FK constraint
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
return MidoWebChannel;
|
|
47
|
+
};
|
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
module.exports = (sequelize, DataTypes) => {
|
|
2
|
-
const MineBrandBlocklist = sequelize.define(
|
|
3
|
-
"MineBrandBlocklist",
|
|
4
|
-
{
|
|
5
|
-
id: {
|
|
6
|
-
type: DataTypes.INTEGER,
|
|
7
|
-
primaryKey: true,
|
|
8
|
-
autoIncrement: true,
|
|
9
|
-
},
|
|
10
|
-
keyword: {
|
|
11
|
-
type: DataTypes.STRING(255),
|
|
12
|
-
allowNull: false,
|
|
13
|
-
// R7.1: attribute-level `unique` removed — Task 2 drops the single-column
|
|
14
|
-
// UNIQUE(keyword) and replaces it with composite UNIQUE(feed_id, keyword).
|
|
15
|
-
comment: "Lowercase normalized keyword",
|
|
16
|
-
},
|
|
17
|
-
feed_id: {
|
|
18
|
-
type: DataTypes.TEXT,
|
|
19
|
-
allowNull: false,
|
|
20
|
-
defaultValue: "mine-rsoc",
|
|
21
|
-
},
|
|
22
|
-
match_type: {
|
|
23
|
-
type: DataTypes.TEXT,
|
|
24
|
-
allowNull: false,
|
|
25
|
-
defaultValue: "contains", // R5: prod default
|
|
26
|
-
},
|
|
27
|
-
category: {
|
|
28
|
-
type: DataTypes.TEXT,
|
|
29
|
-
allowNull: false,
|
|
30
|
-
defaultValue: "Other", // R5: prod NOT NULL DEFAULT 'Other'
|
|
31
|
-
},
|
|
32
|
-
is_blocked: {
|
|
33
|
-
type: DataTypes.BOOLEAN,
|
|
34
|
-
allowNull: false,
|
|
35
|
-
defaultValue: true,
|
|
36
|
-
comment: "true = use redirect URL; false = cached non-brand result",
|
|
37
|
-
},
|
|
38
|
-
ai_checked: {
|
|
39
|
-
type: DataTypes.BOOLEAN,
|
|
40
|
-
allowNull: false,
|
|
41
|
-
defaultValue: false,
|
|
42
|
-
},
|
|
43
|
-
notes: {
|
|
44
|
-
type: DataTypes.TEXT,
|
|
45
|
-
allowNull: true,
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
tableName: "mine_brand_blocklist",
|
|
50
|
-
timestamps: true,
|
|
51
|
-
createdAt: "added_at",
|
|
52
|
-
updatedAt: false,
|
|
53
|
-
}
|
|
54
|
-
);
|
|
55
|
-
return MineBrandBlocklist;
|
|
56
|
-
};
|
|
1
|
+
module.exports = (sequelize, DataTypes) => {
|
|
2
|
+
const MineBrandBlocklist = sequelize.define(
|
|
3
|
+
"MineBrandBlocklist",
|
|
4
|
+
{
|
|
5
|
+
id: {
|
|
6
|
+
type: DataTypes.INTEGER,
|
|
7
|
+
primaryKey: true,
|
|
8
|
+
autoIncrement: true,
|
|
9
|
+
},
|
|
10
|
+
keyword: {
|
|
11
|
+
type: DataTypes.STRING(255),
|
|
12
|
+
allowNull: false,
|
|
13
|
+
// R7.1: attribute-level `unique` removed — Task 2 drops the single-column
|
|
14
|
+
// UNIQUE(keyword) and replaces it with composite UNIQUE(feed_id, keyword).
|
|
15
|
+
comment: "Lowercase normalized keyword",
|
|
16
|
+
},
|
|
17
|
+
feed_id: {
|
|
18
|
+
type: DataTypes.TEXT,
|
|
19
|
+
allowNull: false,
|
|
20
|
+
defaultValue: "mine-rsoc",
|
|
21
|
+
},
|
|
22
|
+
match_type: {
|
|
23
|
+
type: DataTypes.TEXT,
|
|
24
|
+
allowNull: false,
|
|
25
|
+
defaultValue: "contains", // R5: prod default
|
|
26
|
+
},
|
|
27
|
+
category: {
|
|
28
|
+
type: DataTypes.TEXT,
|
|
29
|
+
allowNull: false,
|
|
30
|
+
defaultValue: "Other", // R5: prod NOT NULL DEFAULT 'Other'
|
|
31
|
+
},
|
|
32
|
+
is_blocked: {
|
|
33
|
+
type: DataTypes.BOOLEAN,
|
|
34
|
+
allowNull: false,
|
|
35
|
+
defaultValue: true,
|
|
36
|
+
comment: "true = use redirect URL; false = cached non-brand result",
|
|
37
|
+
},
|
|
38
|
+
ai_checked: {
|
|
39
|
+
type: DataTypes.BOOLEAN,
|
|
40
|
+
allowNull: false,
|
|
41
|
+
defaultValue: false,
|
|
42
|
+
},
|
|
43
|
+
notes: {
|
|
44
|
+
type: DataTypes.TEXT,
|
|
45
|
+
allowNull: true,
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
tableName: "mine_brand_blocklist",
|
|
50
|
+
timestamps: true,
|
|
51
|
+
createdAt: "added_at",
|
|
52
|
+
updatedAt: false,
|
|
53
|
+
}
|
|
54
|
+
);
|
|
55
|
+
return MineBrandBlocklist;
|
|
56
|
+
};
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
// agrs-sequelize/models/MineBrandConfig.js
|
|
2
|
-
const { DataTypes } = require('sequelize');
|
|
3
|
-
|
|
4
|
-
module.exports = (sequelize) => {
|
|
5
|
-
return sequelize.define('MineBrandConfig', {
|
|
6
|
-
// R5: verified prod columns are EXACTLY: key (PK), value (NOT NULL),
|
|
7
|
-
// updated_at (DEFAULT now()) — there is NO id column. Declaring an
|
|
8
|
-
// autoIncrement id makes every SELECT emit "id" → column does not exist.
|
|
9
|
-
feed_id: { type: DataTypes.TEXT, allowNull: false, primaryKey: true },
|
|
10
|
-
key: { type: DataTypes.TEXT, allowNull: false, primaryKey: true },
|
|
11
|
-
value: { type: DataTypes.TEXT, allowNull: false },
|
|
12
|
-
updated_at: { type: DataTypes.DATE },
|
|
13
|
-
}, {
|
|
14
|
-
tableName: 'mine_brand_config',
|
|
15
|
-
underscored: true,
|
|
16
|
-
// R4-K: the real table has updated_at but NO created_at (raw SQL manages
|
|
17
|
-
// updated_at manually). Sequelize defaults to timestamps:true which would
|
|
18
|
-
// add created_at to every SELECT → "column created_at does not exist".
|
|
19
|
-
timestamps: false,
|
|
20
|
-
// R5: NO `indexes` declaration — sync() would create a duplicate of the
|
|
21
|
-
// migration-managed uq_mine_brand_config_feed_key. Composite PK above is
|
|
22
|
-
// the end-state (after Task 2 Visit 2); during the interim window the DB PK
|
|
23
|
-
// is still (key) — model-based reads (findOne/findAll with where) are
|
|
24
|
-
// unaffected; mine_brand_config writes stay raw SQL throughout this plan.
|
|
25
|
-
});
|
|
26
|
-
};
|
|
1
|
+
// agrs-sequelize/models/MineBrandConfig.js
|
|
2
|
+
const { DataTypes } = require('sequelize');
|
|
3
|
+
|
|
4
|
+
module.exports = (sequelize) => {
|
|
5
|
+
return sequelize.define('MineBrandConfig', {
|
|
6
|
+
// R5: verified prod columns are EXACTLY: key (PK), value (NOT NULL),
|
|
7
|
+
// updated_at (DEFAULT now()) — there is NO id column. Declaring an
|
|
8
|
+
// autoIncrement id makes every SELECT emit "id" → column does not exist.
|
|
9
|
+
feed_id: { type: DataTypes.TEXT, allowNull: false, primaryKey: true },
|
|
10
|
+
key: { type: DataTypes.TEXT, allowNull: false, primaryKey: true },
|
|
11
|
+
value: { type: DataTypes.TEXT, allowNull: false },
|
|
12
|
+
updated_at: { type: DataTypes.DATE },
|
|
13
|
+
}, {
|
|
14
|
+
tableName: 'mine_brand_config',
|
|
15
|
+
underscored: true,
|
|
16
|
+
// R4-K: the real table has updated_at but NO created_at (raw SQL manages
|
|
17
|
+
// updated_at manually). Sequelize defaults to timestamps:true which would
|
|
18
|
+
// add created_at to every SELECT → "column created_at does not exist".
|
|
19
|
+
timestamps: false,
|
|
20
|
+
// R5: NO `indexes` declaration — sync() would create a duplicate of the
|
|
21
|
+
// migration-managed uq_mine_brand_config_feed_key. Composite PK above is
|
|
22
|
+
// the end-state (after Task 2 Visit 2); during the interim window the DB PK
|
|
23
|
+
// is still (key) — model-based reads (findOne/findAll with where) are
|
|
24
|
+
// unaffected; mine_brand_config writes stay raw SQL throughout this plan.
|
|
25
|
+
});
|
|
26
|
+
};
|