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,92 +1,92 @@
|
|
|
1
|
-
module.exports = (sequelize, DataTypes) =>
|
|
2
|
-
sequelize.define(
|
|
3
|
-
"SnapchatAdSquad",
|
|
4
|
-
{
|
|
5
|
-
id: {
|
|
6
|
-
type: DataTypes.STRING(36),
|
|
7
|
-
primaryKey: true,
|
|
8
|
-
comment: "Snapchat ad squad UUID",
|
|
9
|
-
},
|
|
10
|
-
name: {
|
|
11
|
-
type: DataTypes.STRING(255),
|
|
12
|
-
allowNull: false,
|
|
13
|
-
},
|
|
14
|
-
campaign_id: {
|
|
15
|
-
type: DataTypes.STRING(36),
|
|
16
|
-
allowNull: false,
|
|
17
|
-
comment: "Snapchat campaign UUID; loose FK to snapchat_campaigns",
|
|
18
|
-
},
|
|
19
|
-
ad_account_id: {
|
|
20
|
-
type: DataTypes.STRING(36),
|
|
21
|
-
allowNull: false,
|
|
22
|
-
},
|
|
23
|
-
status: {
|
|
24
|
-
type: DataTypes.STRING(50),
|
|
25
|
-
allowNull: true,
|
|
26
|
-
comment: "ACTIVE or PAUSED (Snap native)",
|
|
27
|
-
},
|
|
28
|
-
type: {
|
|
29
|
-
type: DataTypes.STRING(50),
|
|
30
|
-
allowNull: true,
|
|
31
|
-
comment: "SNAP_ADS",
|
|
32
|
-
},
|
|
33
|
-
bid_strategy: {
|
|
34
|
-
type: DataTypes.STRING(50),
|
|
35
|
-
allowNull: true,
|
|
36
|
-
},
|
|
37
|
-
optimization_goal: {
|
|
38
|
-
type: DataTypes.STRING(50),
|
|
39
|
-
allowNull: true,
|
|
40
|
-
},
|
|
41
|
-
billing_event: {
|
|
42
|
-
type: DataTypes.STRING(50),
|
|
43
|
-
allowNull: true,
|
|
44
|
-
},
|
|
45
|
-
placement_v2: {
|
|
46
|
-
type: DataTypes.JSONB,
|
|
47
|
-
allowNull: true,
|
|
48
|
-
comment: "Snap placement_v2 config (e.g. {config:'AUTOMATIC', ...})",
|
|
49
|
-
},
|
|
50
|
-
daily_budget_micro: {
|
|
51
|
-
type: DataTypes.BIGINT,
|
|
52
|
-
allowNull: true,
|
|
53
|
-
},
|
|
54
|
-
bid_micro: {
|
|
55
|
-
type: DataTypes.BIGINT,
|
|
56
|
-
allowNull: true,
|
|
57
|
-
},
|
|
58
|
-
targeting: {
|
|
59
|
-
type: DataTypes.JSONB,
|
|
60
|
-
allowNull: true,
|
|
61
|
-
},
|
|
62
|
-
start_time: {
|
|
63
|
-
type: DataTypes.DATE,
|
|
64
|
-
allowNull: true,
|
|
65
|
-
},
|
|
66
|
-
end_time: {
|
|
67
|
-
type: DataTypes.DATE,
|
|
68
|
-
allowNull: true,
|
|
69
|
-
},
|
|
70
|
-
created_at: {
|
|
71
|
-
type: DataTypes.DATE,
|
|
72
|
-
allowNull: false,
|
|
73
|
-
},
|
|
74
|
-
updated_at: {
|
|
75
|
-
type: DataTypes.DATE,
|
|
76
|
-
allowNull: true,
|
|
77
|
-
},
|
|
78
|
-
synced_at: {
|
|
79
|
-
type: DataTypes.DATE,
|
|
80
|
-
allowNull: false,
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
tableName: "snapchat_ad_squads",
|
|
85
|
-
timestamps: false,
|
|
86
|
-
indexes: [
|
|
87
|
-
{ fields: ["campaign_id"] },
|
|
88
|
-
{ fields: ["ad_account_id"] },
|
|
89
|
-
{ fields: ["status"] },
|
|
90
|
-
],
|
|
91
|
-
},
|
|
92
|
-
);
|
|
1
|
+
module.exports = (sequelize, DataTypes) =>
|
|
2
|
+
sequelize.define(
|
|
3
|
+
"SnapchatAdSquad",
|
|
4
|
+
{
|
|
5
|
+
id: {
|
|
6
|
+
type: DataTypes.STRING(36),
|
|
7
|
+
primaryKey: true,
|
|
8
|
+
comment: "Snapchat ad squad UUID",
|
|
9
|
+
},
|
|
10
|
+
name: {
|
|
11
|
+
type: DataTypes.STRING(255),
|
|
12
|
+
allowNull: false,
|
|
13
|
+
},
|
|
14
|
+
campaign_id: {
|
|
15
|
+
type: DataTypes.STRING(36),
|
|
16
|
+
allowNull: false,
|
|
17
|
+
comment: "Snapchat campaign UUID; loose FK to snapchat_campaigns",
|
|
18
|
+
},
|
|
19
|
+
ad_account_id: {
|
|
20
|
+
type: DataTypes.STRING(36),
|
|
21
|
+
allowNull: false,
|
|
22
|
+
},
|
|
23
|
+
status: {
|
|
24
|
+
type: DataTypes.STRING(50),
|
|
25
|
+
allowNull: true,
|
|
26
|
+
comment: "ACTIVE or PAUSED (Snap native)",
|
|
27
|
+
},
|
|
28
|
+
type: {
|
|
29
|
+
type: DataTypes.STRING(50),
|
|
30
|
+
allowNull: true,
|
|
31
|
+
comment: "SNAP_ADS",
|
|
32
|
+
},
|
|
33
|
+
bid_strategy: {
|
|
34
|
+
type: DataTypes.STRING(50),
|
|
35
|
+
allowNull: true,
|
|
36
|
+
},
|
|
37
|
+
optimization_goal: {
|
|
38
|
+
type: DataTypes.STRING(50),
|
|
39
|
+
allowNull: true,
|
|
40
|
+
},
|
|
41
|
+
billing_event: {
|
|
42
|
+
type: DataTypes.STRING(50),
|
|
43
|
+
allowNull: true,
|
|
44
|
+
},
|
|
45
|
+
placement_v2: {
|
|
46
|
+
type: DataTypes.JSONB,
|
|
47
|
+
allowNull: true,
|
|
48
|
+
comment: "Snap placement_v2 config (e.g. {config:'AUTOMATIC', ...})",
|
|
49
|
+
},
|
|
50
|
+
daily_budget_micro: {
|
|
51
|
+
type: DataTypes.BIGINT,
|
|
52
|
+
allowNull: true,
|
|
53
|
+
},
|
|
54
|
+
bid_micro: {
|
|
55
|
+
type: DataTypes.BIGINT,
|
|
56
|
+
allowNull: true,
|
|
57
|
+
},
|
|
58
|
+
targeting: {
|
|
59
|
+
type: DataTypes.JSONB,
|
|
60
|
+
allowNull: true,
|
|
61
|
+
},
|
|
62
|
+
start_time: {
|
|
63
|
+
type: DataTypes.DATE,
|
|
64
|
+
allowNull: true,
|
|
65
|
+
},
|
|
66
|
+
end_time: {
|
|
67
|
+
type: DataTypes.DATE,
|
|
68
|
+
allowNull: true,
|
|
69
|
+
},
|
|
70
|
+
created_at: {
|
|
71
|
+
type: DataTypes.DATE,
|
|
72
|
+
allowNull: false,
|
|
73
|
+
},
|
|
74
|
+
updated_at: {
|
|
75
|
+
type: DataTypes.DATE,
|
|
76
|
+
allowNull: true,
|
|
77
|
+
},
|
|
78
|
+
synced_at: {
|
|
79
|
+
type: DataTypes.DATE,
|
|
80
|
+
allowNull: false,
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
tableName: "snapchat_ad_squads",
|
|
85
|
+
timestamps: false,
|
|
86
|
+
indexes: [
|
|
87
|
+
{ fields: ["campaign_id"] },
|
|
88
|
+
{ fields: ["ad_account_id"] },
|
|
89
|
+
{ fields: ["status"] },
|
|
90
|
+
],
|
|
91
|
+
},
|
|
92
|
+
);
|
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
module.exports = (sequelize, DataTypes) =>
|
|
2
|
-
sequelize.define(
|
|
3
|
-
"SnapchatCampaign",
|
|
4
|
-
{
|
|
5
|
-
id: {
|
|
6
|
-
type: DataTypes.STRING(36),
|
|
7
|
-
primaryKey: true,
|
|
8
|
-
comment: "Snapchat UUID",
|
|
9
|
-
},
|
|
10
|
-
name: {
|
|
11
|
-
type: DataTypes.STRING(255),
|
|
12
|
-
allowNull: false,
|
|
13
|
-
},
|
|
14
|
-
ad_account_id: {
|
|
15
|
-
type: DataTypes.STRING(36),
|
|
16
|
-
allowNull: false,
|
|
17
|
-
},
|
|
18
|
-
status: {
|
|
19
|
-
type: DataTypes.STRING(50),
|
|
20
|
-
allowNull: false,
|
|
21
|
-
comment: "ACTIVE or PAUSED (Snap native)",
|
|
22
|
-
},
|
|
23
|
-
objective: {
|
|
24
|
-
type: DataTypes.STRING(255),
|
|
25
|
-
allowNull: true,
|
|
26
|
-
},
|
|
27
|
-
daily_budget_micro: {
|
|
28
|
-
type: DataTypes.BIGINT,
|
|
29
|
-
allowNull: true,
|
|
30
|
-
},
|
|
31
|
-
lifetime_spend_cap_micro: {
|
|
32
|
-
type: DataTypes.BIGINT,
|
|
33
|
-
allowNull: true,
|
|
34
|
-
},
|
|
35
|
-
timezone: {
|
|
36
|
-
type: DataTypes.STRING(50),
|
|
37
|
-
allowNull: true,
|
|
38
|
-
},
|
|
39
|
-
start_time: {
|
|
40
|
-
type: DataTypes.DATE,
|
|
41
|
-
allowNull: true,
|
|
42
|
-
},
|
|
43
|
-
end_time: {
|
|
44
|
-
type: DataTypes.DATE,
|
|
45
|
-
allowNull: true,
|
|
46
|
-
},
|
|
47
|
-
created_at: {
|
|
48
|
-
type: DataTypes.DATE,
|
|
49
|
-
allowNull: false,
|
|
50
|
-
},
|
|
51
|
-
updated_at: {
|
|
52
|
-
type: DataTypes.DATE,
|
|
53
|
-
allowNull: true,
|
|
54
|
-
},
|
|
55
|
-
synced_at: {
|
|
56
|
-
type: DataTypes.DATE,
|
|
57
|
-
allowNull: false,
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
tableName: "snapchat_campaigns",
|
|
62
|
-
timestamps: false,
|
|
63
|
-
indexes: [
|
|
64
|
-
{ fields: ["ad_account_id"] },
|
|
65
|
-
{ fields: ["created_at"] },
|
|
66
|
-
{ fields: ["status"] },
|
|
67
|
-
],
|
|
68
|
-
},
|
|
69
|
-
);
|
|
1
|
+
module.exports = (sequelize, DataTypes) =>
|
|
2
|
+
sequelize.define(
|
|
3
|
+
"SnapchatCampaign",
|
|
4
|
+
{
|
|
5
|
+
id: {
|
|
6
|
+
type: DataTypes.STRING(36),
|
|
7
|
+
primaryKey: true,
|
|
8
|
+
comment: "Snapchat UUID",
|
|
9
|
+
},
|
|
10
|
+
name: {
|
|
11
|
+
type: DataTypes.STRING(255),
|
|
12
|
+
allowNull: false,
|
|
13
|
+
},
|
|
14
|
+
ad_account_id: {
|
|
15
|
+
type: DataTypes.STRING(36),
|
|
16
|
+
allowNull: false,
|
|
17
|
+
},
|
|
18
|
+
status: {
|
|
19
|
+
type: DataTypes.STRING(50),
|
|
20
|
+
allowNull: false,
|
|
21
|
+
comment: "ACTIVE or PAUSED (Snap native)",
|
|
22
|
+
},
|
|
23
|
+
objective: {
|
|
24
|
+
type: DataTypes.STRING(255),
|
|
25
|
+
allowNull: true,
|
|
26
|
+
},
|
|
27
|
+
daily_budget_micro: {
|
|
28
|
+
type: DataTypes.BIGINT,
|
|
29
|
+
allowNull: true,
|
|
30
|
+
},
|
|
31
|
+
lifetime_spend_cap_micro: {
|
|
32
|
+
type: DataTypes.BIGINT,
|
|
33
|
+
allowNull: true,
|
|
34
|
+
},
|
|
35
|
+
timezone: {
|
|
36
|
+
type: DataTypes.STRING(50),
|
|
37
|
+
allowNull: true,
|
|
38
|
+
},
|
|
39
|
+
start_time: {
|
|
40
|
+
type: DataTypes.DATE,
|
|
41
|
+
allowNull: true,
|
|
42
|
+
},
|
|
43
|
+
end_time: {
|
|
44
|
+
type: DataTypes.DATE,
|
|
45
|
+
allowNull: true,
|
|
46
|
+
},
|
|
47
|
+
created_at: {
|
|
48
|
+
type: DataTypes.DATE,
|
|
49
|
+
allowNull: false,
|
|
50
|
+
},
|
|
51
|
+
updated_at: {
|
|
52
|
+
type: DataTypes.DATE,
|
|
53
|
+
allowNull: true,
|
|
54
|
+
},
|
|
55
|
+
synced_at: {
|
|
56
|
+
type: DataTypes.DATE,
|
|
57
|
+
allowNull: false,
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
tableName: "snapchat_campaigns",
|
|
62
|
+
timestamps: false,
|
|
63
|
+
indexes: [
|
|
64
|
+
{ fields: ["ad_account_id"] },
|
|
65
|
+
{ fields: ["created_at"] },
|
|
66
|
+
{ fields: ["status"] },
|
|
67
|
+
],
|
|
68
|
+
},
|
|
69
|
+
);
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
module.exports = (sequelize, DataTypes) => {
|
|
2
|
-
const SnapchatChannel = sequelize.define(
|
|
3
|
-
"SnapchatChannel",
|
|
4
|
-
{
|
|
5
|
-
channelId: {
|
|
6
|
-
type: DataTypes.STRING,
|
|
7
|
-
allowNull: false,
|
|
8
|
-
unique: true,
|
|
9
|
-
},
|
|
10
|
-
status: {
|
|
11
|
-
type: DataTypes.STRING,
|
|
12
|
-
allowNull: false,
|
|
13
|
-
defaultValue: "free",
|
|
14
|
-
validate: {
|
|
15
|
-
isIn: [["free", "used", "archived"]],
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
connectedCampaigns: {
|
|
19
|
-
type: DataTypes.JSONB,
|
|
20
|
-
allowNull: false,
|
|
21
|
-
defaultValue: [],
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
tableName: "snapchat_rsoc_channels",
|
|
26
|
-
timestamps: true,
|
|
27
|
-
}
|
|
28
|
-
);
|
|
29
|
-
|
|
30
|
-
return SnapchatChannel;
|
|
31
|
-
};
|
|
1
|
+
module.exports = (sequelize, DataTypes) => {
|
|
2
|
+
const SnapchatChannel = sequelize.define(
|
|
3
|
+
"SnapchatChannel",
|
|
4
|
+
{
|
|
5
|
+
channelId: {
|
|
6
|
+
type: DataTypes.STRING,
|
|
7
|
+
allowNull: false,
|
|
8
|
+
unique: true,
|
|
9
|
+
},
|
|
10
|
+
status: {
|
|
11
|
+
type: DataTypes.STRING,
|
|
12
|
+
allowNull: false,
|
|
13
|
+
defaultValue: "free",
|
|
14
|
+
validate: {
|
|
15
|
+
isIn: [["free", "used", "archived"]],
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
connectedCampaigns: {
|
|
19
|
+
type: DataTypes.JSONB,
|
|
20
|
+
allowNull: false,
|
|
21
|
+
defaultValue: [],
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
tableName: "snapchat_rsoc_channels",
|
|
26
|
+
timestamps: true,
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
return SnapchatChannel;
|
|
31
|
+
};
|
|
@@ -1,67 +1,67 @@
|
|
|
1
|
-
module.exports = (sequelize, DataTypes) => {
|
|
2
|
-
const SnapchatPublicProfiles = sequelize.define(
|
|
3
|
-
"SnapchatPublicProfiles",
|
|
4
|
-
{
|
|
5
|
-
id: {
|
|
6
|
-
type: DataTypes.BIGINT,
|
|
7
|
-
primaryKey: true,
|
|
8
|
-
autoIncrement: true,
|
|
9
|
-
},
|
|
10
|
-
public_profile_id: {
|
|
11
|
-
type: DataTypes.STRING(64),
|
|
12
|
-
allowNull: false,
|
|
13
|
-
unique: true,
|
|
14
|
-
comment:
|
|
15
|
-
"Snapchat public_profile_id used as creative owner on ad creation",
|
|
16
|
-
},
|
|
17
|
-
name: {
|
|
18
|
-
type: DataTypes.STRING(255),
|
|
19
|
-
allowNull: true,
|
|
20
|
-
},
|
|
21
|
-
// 2026-07-12: widened from single STRING → ARRAY(STRING). Snap allows
|
|
22
|
-
// the SAME Public Profile to be linked to MANY ad accounts (per Snap
|
|
23
|
-
// Business Center — one profile can serve multiple advertiser
|
|
24
|
-
// accounts). Storing a single ad_account_id here forced our resolver
|
|
25
|
-
// into cross-account fallback (which Snap rejects with 403 E3002).
|
|
26
|
-
// Now: each row lists every ad account this profile is authorized on.
|
|
27
|
-
ad_account_ids: {
|
|
28
|
-
type: DataTypes.ARRAY(DataTypes.STRING),
|
|
29
|
-
allowNull: false,
|
|
30
|
-
defaultValue: [],
|
|
31
|
-
comment:
|
|
32
|
-
"Snapchat ad_account_ids this profile can serve. Query with " +
|
|
33
|
-
"'X = ANY(ad_account_ids)'. Empty means unrestricted.",
|
|
34
|
-
},
|
|
35
|
-
status: {
|
|
36
|
-
type: DataTypes.STRING(16),
|
|
37
|
-
allowNull: false,
|
|
38
|
-
defaultValue: "active",
|
|
39
|
-
comment: "active | disabled",
|
|
40
|
-
},
|
|
41
|
-
tier: {
|
|
42
|
-
type: DataTypes.INTEGER,
|
|
43
|
-
allowNull: false,
|
|
44
|
-
defaultValue: 1,
|
|
45
|
-
comment:
|
|
46
|
-
"Rotation weight. Higher tier => higher probability of being picked.",
|
|
47
|
-
},
|
|
48
|
-
feed_provider: {
|
|
49
|
-
type: DataTypes.ARRAY(DataTypes.STRING),
|
|
50
|
-
allowNull: false,
|
|
51
|
-
defaultValue: [],
|
|
52
|
-
comment:
|
|
53
|
-
"Feeds this profile can serve (e.g. ['Mine - RSOC'], ['Predicto - RSOC']). Empty = unrestricted.",
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
tableName: "snapchat_public_profiles",
|
|
58
|
-
// No index on ad_account_ids directly — Postgres uses GIN on arrays
|
|
59
|
-
// and Sequelize's simple `fields` index syntax doesn't emit GIN. If
|
|
60
|
-
// query performance becomes a concern, add a raw GIN index migration:
|
|
61
|
-
// CREATE INDEX ... ON snapchat_public_profiles USING GIN (ad_account_ids);
|
|
62
|
-
indexes: [{ fields: ["status"] }],
|
|
63
|
-
}
|
|
64
|
-
);
|
|
65
|
-
|
|
66
|
-
return SnapchatPublicProfiles;
|
|
67
|
-
};
|
|
1
|
+
module.exports = (sequelize, DataTypes) => {
|
|
2
|
+
const SnapchatPublicProfiles = sequelize.define(
|
|
3
|
+
"SnapchatPublicProfiles",
|
|
4
|
+
{
|
|
5
|
+
id: {
|
|
6
|
+
type: DataTypes.BIGINT,
|
|
7
|
+
primaryKey: true,
|
|
8
|
+
autoIncrement: true,
|
|
9
|
+
},
|
|
10
|
+
public_profile_id: {
|
|
11
|
+
type: DataTypes.STRING(64),
|
|
12
|
+
allowNull: false,
|
|
13
|
+
unique: true,
|
|
14
|
+
comment:
|
|
15
|
+
"Snapchat public_profile_id used as creative owner on ad creation",
|
|
16
|
+
},
|
|
17
|
+
name: {
|
|
18
|
+
type: DataTypes.STRING(255),
|
|
19
|
+
allowNull: true,
|
|
20
|
+
},
|
|
21
|
+
// 2026-07-12: widened from single STRING → ARRAY(STRING). Snap allows
|
|
22
|
+
// the SAME Public Profile to be linked to MANY ad accounts (per Snap
|
|
23
|
+
// Business Center — one profile can serve multiple advertiser
|
|
24
|
+
// accounts). Storing a single ad_account_id here forced our resolver
|
|
25
|
+
// into cross-account fallback (which Snap rejects with 403 E3002).
|
|
26
|
+
// Now: each row lists every ad account this profile is authorized on.
|
|
27
|
+
ad_account_ids: {
|
|
28
|
+
type: DataTypes.ARRAY(DataTypes.STRING),
|
|
29
|
+
allowNull: false,
|
|
30
|
+
defaultValue: [],
|
|
31
|
+
comment:
|
|
32
|
+
"Snapchat ad_account_ids this profile can serve. Query with " +
|
|
33
|
+
"'X = ANY(ad_account_ids)'. Empty means unrestricted.",
|
|
34
|
+
},
|
|
35
|
+
status: {
|
|
36
|
+
type: DataTypes.STRING(16),
|
|
37
|
+
allowNull: false,
|
|
38
|
+
defaultValue: "active",
|
|
39
|
+
comment: "active | disabled",
|
|
40
|
+
},
|
|
41
|
+
tier: {
|
|
42
|
+
type: DataTypes.INTEGER,
|
|
43
|
+
allowNull: false,
|
|
44
|
+
defaultValue: 1,
|
|
45
|
+
comment:
|
|
46
|
+
"Rotation weight. Higher tier => higher probability of being picked.",
|
|
47
|
+
},
|
|
48
|
+
feed_provider: {
|
|
49
|
+
type: DataTypes.ARRAY(DataTypes.STRING),
|
|
50
|
+
allowNull: false,
|
|
51
|
+
defaultValue: [],
|
|
52
|
+
comment:
|
|
53
|
+
"Feeds this profile can serve (e.g. ['Mine - RSOC'], ['Predicto - RSOC']). Empty = unrestricted.",
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
tableName: "snapchat_public_profiles",
|
|
58
|
+
// No index on ad_account_ids directly — Postgres uses GIN on arrays
|
|
59
|
+
// and Sequelize's simple `fields` index syntax doesn't emit GIN. If
|
|
60
|
+
// query performance becomes a concern, add a raw GIN index migration:
|
|
61
|
+
// CREATE INDEX ... ON snapchat_public_profiles USING GIN (ad_account_ids);
|
|
62
|
+
indexes: [{ fields: ["status"] }],
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
return SnapchatPublicProfiles;
|
|
67
|
+
};
|
|
@@ -1,24 +1,24 @@
|
|
|
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;
|
|
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
24
|
};
|