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,36 +1,36 @@
|
|
|
1
|
-
module.exports = (sequelize, DataTypes) => {
|
|
2
|
-
const MineRedirectDomain = sequelize.define(
|
|
3
|
-
"MineRedirectDomain",
|
|
4
|
-
{
|
|
5
|
-
id: {
|
|
6
|
-
type: DataTypes.INTEGER,
|
|
7
|
-
primaryKey: true,
|
|
8
|
-
autoIncrement: true,
|
|
9
|
-
},
|
|
10
|
-
domain: {
|
|
11
|
-
type: DataTypes.STRING(255),
|
|
12
|
-
allowNull: false,
|
|
13
|
-
unique: true,
|
|
14
|
-
comment: "Redirect domain, e.g. searchitallday.com",
|
|
15
|
-
},
|
|
16
|
-
weight: {
|
|
17
|
-
type: DataTypes.INTEGER,
|
|
18
|
-
allowNull: false,
|
|
19
|
-
defaultValue: 33,
|
|
20
|
-
comment: "Traffic weight for weighted-random selection among active rows",
|
|
21
|
-
},
|
|
22
|
-
active: {
|
|
23
|
-
type: DataTypes.BOOLEAN,
|
|
24
|
-
allowNull: false,
|
|
25
|
-
defaultValue: true,
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
tableName: "mine_redirect_domains",
|
|
30
|
-
timestamps: true,
|
|
31
|
-
createdAt: "created_at",
|
|
32
|
-
updatedAt: false,
|
|
33
|
-
}
|
|
34
|
-
);
|
|
35
|
-
return MineRedirectDomain;
|
|
36
|
-
};
|
|
1
|
+
module.exports = (sequelize, DataTypes) => {
|
|
2
|
+
const MineRedirectDomain = sequelize.define(
|
|
3
|
+
"MineRedirectDomain",
|
|
4
|
+
{
|
|
5
|
+
id: {
|
|
6
|
+
type: DataTypes.INTEGER,
|
|
7
|
+
primaryKey: true,
|
|
8
|
+
autoIncrement: true,
|
|
9
|
+
},
|
|
10
|
+
domain: {
|
|
11
|
+
type: DataTypes.STRING(255),
|
|
12
|
+
allowNull: false,
|
|
13
|
+
unique: true,
|
|
14
|
+
comment: "Redirect domain, e.g. searchitallday.com",
|
|
15
|
+
},
|
|
16
|
+
weight: {
|
|
17
|
+
type: DataTypes.INTEGER,
|
|
18
|
+
allowNull: false,
|
|
19
|
+
defaultValue: 33,
|
|
20
|
+
comment: "Traffic weight for weighted-random selection among active rows",
|
|
21
|
+
},
|
|
22
|
+
active: {
|
|
23
|
+
type: DataTypes.BOOLEAN,
|
|
24
|
+
allowNull: false,
|
|
25
|
+
defaultValue: true,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
tableName: "mine_redirect_domains",
|
|
30
|
+
timestamps: true,
|
|
31
|
+
createdAt: "created_at",
|
|
32
|
+
updatedAt: false,
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
return MineRedirectDomain;
|
|
36
|
+
};
|
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
module.exports = (sequelize, DataTypes) => {
|
|
2
|
-
/**
|
|
3
|
-
* Durable audit log of every inbound Mine webhook call (article-ready / policy-decision).
|
|
4
|
-
* Purpose: observability, security audit (signature failures), idempotency, replay/reconcile.
|
|
5
|
-
* Correlation is by string ids (provider_id / adset_id / ad_id) — no FK, to stay decoupled
|
|
6
|
-
* from the article/ad lifecycle and tolerate webhooks that arrive before the local row exists.
|
|
7
|
-
*/
|
|
8
|
-
const MineWebhookEvent = sequelize.define(
|
|
9
|
-
"MineWebhookEvent",
|
|
10
|
-
{
|
|
11
|
-
id: {
|
|
12
|
-
type: DataTypes.INTEGER,
|
|
13
|
-
primaryKey: true,
|
|
14
|
-
autoIncrement: true,
|
|
15
|
-
},
|
|
16
|
-
event_id: { type: DataTypes.STRING, allowNull: true }, // Mine's unique id (idempotency)
|
|
17
|
-
event_type: { type: DataTypes.STRING, allowNull: false }, // 'article-ready' | 'policy-decision'
|
|
18
|
-
endpoint: { type: DataTypes.STRING, allowNull: true },
|
|
19
|
-
source_ip: { type: DataTypes.STRING, allowNull: true },
|
|
20
|
-
|
|
21
|
-
signature_valid: { type: DataTypes.BOOLEAN, allowNull: true },
|
|
22
|
-
http_status: { type: DataTypes.INTEGER, allowNull: true },
|
|
23
|
-
|
|
24
|
-
payload: { type: DataTypes.JSONB, allowNull: true },
|
|
25
|
-
|
|
26
|
-
provider_id: { type: DataTypes.STRING, allowNull: true },
|
|
27
|
-
adset_id: { type: DataTypes.STRING, allowNull: true },
|
|
28
|
-
ad_id: { type: DataTypes.STRING, allowNull: true },
|
|
29
|
-
matched_agrsaid: { type: DataTypes.STRING, allowNull: true },
|
|
30
|
-
|
|
31
|
-
// received | processed | skipped | duplicate | rejected_signature | rejected_validation | failed
|
|
32
|
-
outcome: { type: DataTypes.STRING, allowNull: false, defaultValue: "received" },
|
|
33
|
-
outcome_reason: { type: DataTypes.TEXT, allowNull: true },
|
|
34
|
-
|
|
35
|
-
received_at: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW },
|
|
36
|
-
processed_at: { type: DataTypes.DATE, allowNull: true },
|
|
37
|
-
duration_ms: { type: DataTypes.INTEGER, allowNull: true },
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
tableName: "mine_webhook_events",
|
|
41
|
-
indexes: [
|
|
42
|
-
{ fields: ["event_id"] },
|
|
43
|
-
{ fields: ["event_type"] },
|
|
44
|
-
{ fields: ["outcome"] },
|
|
45
|
-
{ fields: ["provider_id"] },
|
|
46
|
-
{ fields: ["adset_id"] },
|
|
47
|
-
{ fields: [{ name: "received_at", order: "DESC" }] },
|
|
48
|
-
],
|
|
49
|
-
}
|
|
50
|
-
);
|
|
51
|
-
|
|
52
|
-
return MineWebhookEvent;
|
|
53
|
-
};
|
|
1
|
+
module.exports = (sequelize, DataTypes) => {
|
|
2
|
+
/**
|
|
3
|
+
* Durable audit log of every inbound Mine webhook call (article-ready / policy-decision).
|
|
4
|
+
* Purpose: observability, security audit (signature failures), idempotency, replay/reconcile.
|
|
5
|
+
* Correlation is by string ids (provider_id / adset_id / ad_id) — no FK, to stay decoupled
|
|
6
|
+
* from the article/ad lifecycle and tolerate webhooks that arrive before the local row exists.
|
|
7
|
+
*/
|
|
8
|
+
const MineWebhookEvent = sequelize.define(
|
|
9
|
+
"MineWebhookEvent",
|
|
10
|
+
{
|
|
11
|
+
id: {
|
|
12
|
+
type: DataTypes.INTEGER,
|
|
13
|
+
primaryKey: true,
|
|
14
|
+
autoIncrement: true,
|
|
15
|
+
},
|
|
16
|
+
event_id: { type: DataTypes.STRING, allowNull: true }, // Mine's unique id (idempotency)
|
|
17
|
+
event_type: { type: DataTypes.STRING, allowNull: false }, // 'article-ready' | 'policy-decision'
|
|
18
|
+
endpoint: { type: DataTypes.STRING, allowNull: true },
|
|
19
|
+
source_ip: { type: DataTypes.STRING, allowNull: true },
|
|
20
|
+
|
|
21
|
+
signature_valid: { type: DataTypes.BOOLEAN, allowNull: true },
|
|
22
|
+
http_status: { type: DataTypes.INTEGER, allowNull: true },
|
|
23
|
+
|
|
24
|
+
payload: { type: DataTypes.JSONB, allowNull: true },
|
|
25
|
+
|
|
26
|
+
provider_id: { type: DataTypes.STRING, allowNull: true },
|
|
27
|
+
adset_id: { type: DataTypes.STRING, allowNull: true },
|
|
28
|
+
ad_id: { type: DataTypes.STRING, allowNull: true },
|
|
29
|
+
matched_agrsaid: { type: DataTypes.STRING, allowNull: true },
|
|
30
|
+
|
|
31
|
+
// received | processed | skipped | duplicate | rejected_signature | rejected_validation | failed
|
|
32
|
+
outcome: { type: DataTypes.STRING, allowNull: false, defaultValue: "received" },
|
|
33
|
+
outcome_reason: { type: DataTypes.TEXT, allowNull: true },
|
|
34
|
+
|
|
35
|
+
received_at: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW },
|
|
36
|
+
processed_at: { type: DataTypes.DATE, allowNull: true },
|
|
37
|
+
duration_ms: { type: DataTypes.INTEGER, allowNull: true },
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
tableName: "mine_webhook_events",
|
|
41
|
+
indexes: [
|
|
42
|
+
{ fields: ["event_id"] },
|
|
43
|
+
{ fields: ["event_type"] },
|
|
44
|
+
{ fields: ["outcome"] },
|
|
45
|
+
{ fields: ["provider_id"] },
|
|
46
|
+
{ fields: ["adset_id"] },
|
|
47
|
+
{ fields: [{ name: "received_at", order: "DESC" }] },
|
|
48
|
+
],
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
return MineWebhookEvent;
|
|
53
|
+
};
|
package/models/Pages.js
CHANGED
|
@@ -1,117 +1,117 @@
|
|
|
1
|
-
module.exports = (sequelize, DataTypes) => {
|
|
2
|
-
const Pages = sequelize.define(
|
|
3
|
-
"Pages",
|
|
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
|
-
link: {
|
|
20
|
-
type: DataTypes.STRING,
|
|
21
|
-
allowNull: true,
|
|
22
|
-
},
|
|
23
|
-
feedProvider: {
|
|
24
|
-
type: DataTypes.ARRAY(DataTypes.STRING),
|
|
25
|
-
allowNull: false,
|
|
26
|
-
defaultValue: [], // Default value is an empty array
|
|
27
|
-
},
|
|
28
|
-
tasks: {
|
|
29
|
-
type: DataTypes.ARRAY(DataTypes.STRING),
|
|
30
|
-
allowNull: false,
|
|
31
|
-
defaultValue: [], // Default value is an empty array
|
|
32
|
-
},
|
|
33
|
-
is_published: {
|
|
34
|
-
type: DataTypes.BOOLEAN,
|
|
35
|
-
allowNull: false,
|
|
36
|
-
defaultValue: true,
|
|
37
|
-
},
|
|
38
|
-
Category: {
|
|
39
|
-
type: DataTypes.STRING,
|
|
40
|
-
allowNull: true,
|
|
41
|
-
},
|
|
42
|
-
Owner: {
|
|
43
|
-
type: DataTypes.STRING,
|
|
44
|
-
allowNull: true,
|
|
45
|
-
},
|
|
46
|
-
Status: {
|
|
47
|
-
type: DataTypes.STRING,
|
|
48
|
-
allowNull: true,
|
|
49
|
-
},
|
|
50
|
-
AdLibrary: {
|
|
51
|
-
type: DataTypes.STRING,
|
|
52
|
-
allowNull: true,
|
|
53
|
-
},
|
|
54
|
-
BusinessManager: {
|
|
55
|
-
type: DataTypes.STRING,
|
|
56
|
-
allowNull: true,
|
|
57
|
-
},
|
|
58
|
-
Users: {
|
|
59
|
-
type: DataTypes.ARRAY(DataTypes.STRING),
|
|
60
|
-
allowNull: false,
|
|
61
|
-
defaultValue: [],
|
|
62
|
-
},
|
|
63
|
-
Archived: {
|
|
64
|
-
type: DataTypes.BOOLEAN,
|
|
65
|
-
allowNull: true,
|
|
66
|
-
},
|
|
67
|
-
ads_limit: {
|
|
68
|
-
type: DataTypes.INTEGER,
|
|
69
|
-
allowNull: true,
|
|
70
|
-
defaultValue: 0,
|
|
71
|
-
comment:
|
|
72
|
-
"Number of currently active ads running on this page (Max limit: 250)",
|
|
73
|
-
},
|
|
74
|
-
instagram_user_id: {
|
|
75
|
-
type: DataTypes.STRING,
|
|
76
|
-
allowNull: true,
|
|
77
|
-
comment:
|
|
78
|
-
"Instagram User ID (Page-backed Instagram Account ID) for this page",
|
|
79
|
-
},
|
|
80
|
-
promotion_eligible: {
|
|
81
|
-
type: DataTypes.BOOLEAN,
|
|
82
|
-
allowNull: true,
|
|
83
|
-
defaultValue: true,
|
|
84
|
-
comment:
|
|
85
|
-
"Whether this page is eligible for advertising (synced from Facebook promotion_eligible field)",
|
|
86
|
-
},
|
|
87
|
-
// access_token: {
|
|
88
|
-
// type: DataTypes.STRING,
|
|
89
|
-
// allowNull: true,
|
|
90
|
-
// comment: "Facebook page access token",
|
|
91
|
-
// },
|
|
92
|
-
platform: {
|
|
93
|
-
type: DataTypes.ENUM("fb", "tt", "snp"),
|
|
94
|
-
allowNull: false,
|
|
95
|
-
defaultValue: "fb",
|
|
96
|
-
comment: "Ad platform identifier: fb=Facebook, tt=TikTok, snp=Snapchat",
|
|
97
|
-
},
|
|
98
|
-
identity_type: {
|
|
99
|
-
type: DataTypes.STRING(32),
|
|
100
|
-
allowNull: true,
|
|
101
|
-
comment:
|
|
102
|
-
"TikTok identity type (e.g. CUSTOMIZED_USER / BC_AUTH_TT) when platform='tt'. NULL for fb/snp.",
|
|
103
|
-
},
|
|
104
|
-
identity_authorized_bc_id: {
|
|
105
|
-
type: DataTypes.STRING(64),
|
|
106
|
-
allowNull: true,
|
|
107
|
-
comment:
|
|
108
|
-
"TikTok Business Center the identity is authorized to (platform='tt'). NULL for fb/snp.",
|
|
109
|
-
},
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
tableName: "Pages",
|
|
113
|
-
}
|
|
114
|
-
);
|
|
115
|
-
|
|
116
|
-
return Pages;
|
|
117
|
-
};
|
|
1
|
+
module.exports = (sequelize, DataTypes) => {
|
|
2
|
+
const Pages = sequelize.define(
|
|
3
|
+
"Pages",
|
|
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
|
+
link: {
|
|
20
|
+
type: DataTypes.STRING,
|
|
21
|
+
allowNull: true,
|
|
22
|
+
},
|
|
23
|
+
feedProvider: {
|
|
24
|
+
type: DataTypes.ARRAY(DataTypes.STRING),
|
|
25
|
+
allowNull: false,
|
|
26
|
+
defaultValue: [], // Default value is an empty array
|
|
27
|
+
},
|
|
28
|
+
tasks: {
|
|
29
|
+
type: DataTypes.ARRAY(DataTypes.STRING),
|
|
30
|
+
allowNull: false,
|
|
31
|
+
defaultValue: [], // Default value is an empty array
|
|
32
|
+
},
|
|
33
|
+
is_published: {
|
|
34
|
+
type: DataTypes.BOOLEAN,
|
|
35
|
+
allowNull: false,
|
|
36
|
+
defaultValue: true,
|
|
37
|
+
},
|
|
38
|
+
Category: {
|
|
39
|
+
type: DataTypes.STRING,
|
|
40
|
+
allowNull: true,
|
|
41
|
+
},
|
|
42
|
+
Owner: {
|
|
43
|
+
type: DataTypes.STRING,
|
|
44
|
+
allowNull: true,
|
|
45
|
+
},
|
|
46
|
+
Status: {
|
|
47
|
+
type: DataTypes.STRING,
|
|
48
|
+
allowNull: true,
|
|
49
|
+
},
|
|
50
|
+
AdLibrary: {
|
|
51
|
+
type: DataTypes.STRING,
|
|
52
|
+
allowNull: true,
|
|
53
|
+
},
|
|
54
|
+
BusinessManager: {
|
|
55
|
+
type: DataTypes.STRING,
|
|
56
|
+
allowNull: true,
|
|
57
|
+
},
|
|
58
|
+
Users: {
|
|
59
|
+
type: DataTypes.ARRAY(DataTypes.STRING),
|
|
60
|
+
allowNull: false,
|
|
61
|
+
defaultValue: [],
|
|
62
|
+
},
|
|
63
|
+
Archived: {
|
|
64
|
+
type: DataTypes.BOOLEAN,
|
|
65
|
+
allowNull: true,
|
|
66
|
+
},
|
|
67
|
+
ads_limit: {
|
|
68
|
+
type: DataTypes.INTEGER,
|
|
69
|
+
allowNull: true,
|
|
70
|
+
defaultValue: 0,
|
|
71
|
+
comment:
|
|
72
|
+
"Number of currently active ads running on this page (Max limit: 250)",
|
|
73
|
+
},
|
|
74
|
+
instagram_user_id: {
|
|
75
|
+
type: DataTypes.STRING,
|
|
76
|
+
allowNull: true,
|
|
77
|
+
comment:
|
|
78
|
+
"Instagram User ID (Page-backed Instagram Account ID) for this page",
|
|
79
|
+
},
|
|
80
|
+
promotion_eligible: {
|
|
81
|
+
type: DataTypes.BOOLEAN,
|
|
82
|
+
allowNull: true,
|
|
83
|
+
defaultValue: true,
|
|
84
|
+
comment:
|
|
85
|
+
"Whether this page is eligible for advertising (synced from Facebook promotion_eligible field)",
|
|
86
|
+
},
|
|
87
|
+
// access_token: {
|
|
88
|
+
// type: DataTypes.STRING,
|
|
89
|
+
// allowNull: true,
|
|
90
|
+
// comment: "Facebook page access token",
|
|
91
|
+
// },
|
|
92
|
+
platform: {
|
|
93
|
+
type: DataTypes.ENUM("fb", "tt", "snp"),
|
|
94
|
+
allowNull: false,
|
|
95
|
+
defaultValue: "fb",
|
|
96
|
+
comment: "Ad platform identifier: fb=Facebook, tt=TikTok, snp=Snapchat",
|
|
97
|
+
},
|
|
98
|
+
identity_type: {
|
|
99
|
+
type: DataTypes.STRING(32),
|
|
100
|
+
allowNull: true,
|
|
101
|
+
comment:
|
|
102
|
+
"TikTok identity type (e.g. CUSTOMIZED_USER / BC_AUTH_TT) when platform='tt'. NULL for fb/snp.",
|
|
103
|
+
},
|
|
104
|
+
identity_authorized_bc_id: {
|
|
105
|
+
type: DataTypes.STRING(64),
|
|
106
|
+
allowNull: true,
|
|
107
|
+
comment:
|
|
108
|
+
"TikTok Business Center the identity is authorized to (platform='tt'). NULL for fb/snp.",
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
tableName: "Pages",
|
|
113
|
+
}
|
|
114
|
+
);
|
|
115
|
+
|
|
116
|
+
return Pages;
|
|
117
|
+
};
|
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
module.exports = (sequelize, DataTypes) => {
|
|
2
|
-
const PipelineExecution = sequelize.define(
|
|
3
|
-
"PipelineExecution",
|
|
4
|
-
{
|
|
5
|
-
id: {
|
|
6
|
-
type: DataTypes.UUID,
|
|
7
|
-
defaultValue: DataTypes.UUIDV4,
|
|
8
|
-
primaryKey: true,
|
|
9
|
-
},
|
|
10
|
-
startTime: {
|
|
11
|
-
type: DataTypes.DATE,
|
|
12
|
-
allowNull: false,
|
|
13
|
-
},
|
|
14
|
-
endTime: {
|
|
15
|
-
type: DataTypes.DATE,
|
|
16
|
-
allowNull: false,
|
|
17
|
-
},
|
|
18
|
-
status: {
|
|
19
|
-
type: DataTypes.ENUM("success", "failed"),
|
|
20
|
-
allowNull: false,
|
|
21
|
-
},
|
|
22
|
-
fbDaysBack: {
|
|
23
|
-
type: DataTypes.INTEGER,
|
|
24
|
-
allowNull: true,
|
|
25
|
-
},
|
|
26
|
-
codeFuelDaysBack: {
|
|
27
|
-
type: DataTypes.INTEGER,
|
|
28
|
-
allowNull: true,
|
|
29
|
-
},
|
|
30
|
-
tonicDaysBack: {
|
|
31
|
-
type: DataTypes.INTEGER,
|
|
32
|
-
allowNull: true,
|
|
33
|
-
},
|
|
34
|
-
compadoDaysBack: { // Added missing column
|
|
35
|
-
type: DataTypes.INTEGER,
|
|
36
|
-
allowNull: true,
|
|
37
|
-
},
|
|
38
|
-
cfn2sDaysBack: { // Added missing column
|
|
39
|
-
type: DataTypes.INTEGER,
|
|
40
|
-
allowNull: true,
|
|
41
|
-
},
|
|
42
|
-
error: {
|
|
43
|
-
type: DataTypes.TEXT,
|
|
44
|
-
allowNull: true,
|
|
45
|
-
},
|
|
46
|
-
feedTimestamps: { // Added new column for feed timestamps
|
|
47
|
-
type: DataTypes.JSONB, // Use JSONB for PostgreSQL
|
|
48
|
-
allowNull: true,
|
|
49
|
-
field: 'feed_timestamps', // Map to snake_case column name
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
tableName: "pipeline_executions",
|
|
54
|
-
timestamps: true,
|
|
55
|
-
}
|
|
56
|
-
);
|
|
57
|
-
|
|
58
|
-
return PipelineExecution;
|
|
59
|
-
};
|
|
1
|
+
module.exports = (sequelize, DataTypes) => {
|
|
2
|
+
const PipelineExecution = sequelize.define(
|
|
3
|
+
"PipelineExecution",
|
|
4
|
+
{
|
|
5
|
+
id: {
|
|
6
|
+
type: DataTypes.UUID,
|
|
7
|
+
defaultValue: DataTypes.UUIDV4,
|
|
8
|
+
primaryKey: true,
|
|
9
|
+
},
|
|
10
|
+
startTime: {
|
|
11
|
+
type: DataTypes.DATE,
|
|
12
|
+
allowNull: false,
|
|
13
|
+
},
|
|
14
|
+
endTime: {
|
|
15
|
+
type: DataTypes.DATE,
|
|
16
|
+
allowNull: false,
|
|
17
|
+
},
|
|
18
|
+
status: {
|
|
19
|
+
type: DataTypes.ENUM("success", "failed"),
|
|
20
|
+
allowNull: false,
|
|
21
|
+
},
|
|
22
|
+
fbDaysBack: {
|
|
23
|
+
type: DataTypes.INTEGER,
|
|
24
|
+
allowNull: true,
|
|
25
|
+
},
|
|
26
|
+
codeFuelDaysBack: {
|
|
27
|
+
type: DataTypes.INTEGER,
|
|
28
|
+
allowNull: true,
|
|
29
|
+
},
|
|
30
|
+
tonicDaysBack: {
|
|
31
|
+
type: DataTypes.INTEGER,
|
|
32
|
+
allowNull: true,
|
|
33
|
+
},
|
|
34
|
+
compadoDaysBack: { // Added missing column
|
|
35
|
+
type: DataTypes.INTEGER,
|
|
36
|
+
allowNull: true,
|
|
37
|
+
},
|
|
38
|
+
cfn2sDaysBack: { // Added missing column
|
|
39
|
+
type: DataTypes.INTEGER,
|
|
40
|
+
allowNull: true,
|
|
41
|
+
},
|
|
42
|
+
error: {
|
|
43
|
+
type: DataTypes.TEXT,
|
|
44
|
+
allowNull: true,
|
|
45
|
+
},
|
|
46
|
+
feedTimestamps: { // Added new column for feed timestamps
|
|
47
|
+
type: DataTypes.JSONB, // Use JSONB for PostgreSQL
|
|
48
|
+
allowNull: true,
|
|
49
|
+
field: 'feed_timestamps', // Map to snake_case column name
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
tableName: "pipeline_executions",
|
|
54
|
+
timestamps: true,
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
return PipelineExecution;
|
|
59
|
+
};
|
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
module.exports = (sequelize, DataTypes) => {
|
|
2
|
-
const PolicyDogsCreativeCache = sequelize.define(
|
|
3
|
-
"PolicyDogsCreativeCache",
|
|
4
|
-
{
|
|
5
|
-
id: {
|
|
6
|
-
type: DataTypes.INTEGER,
|
|
7
|
-
primaryKey: true,
|
|
8
|
-
autoIncrement: true,
|
|
9
|
-
},
|
|
10
|
-
ad_account_id: {
|
|
11
|
-
type: DataTypes.STRING,
|
|
12
|
-
allowNull: false,
|
|
13
|
-
comment: "Facebook ad account ID (e.g., act_123456)",
|
|
14
|
-
},
|
|
15
|
-
page_id: {
|
|
16
|
-
type: DataTypes.STRING,
|
|
17
|
-
allowNull: false,
|
|
18
|
-
comment: "Facebook page ID used in the creative",
|
|
19
|
-
},
|
|
20
|
-
dog_url: {
|
|
21
|
-
type: DataTypes.TEXT,
|
|
22
|
-
allowNull: false,
|
|
23
|
-
comment: "The dog article URL used in the creative",
|
|
24
|
-
},
|
|
25
|
-
creative_id: {
|
|
26
|
-
type: DataTypes.STRING,
|
|
27
|
-
allowNull: false,
|
|
28
|
-
comment: "Facebook creative ID to reuse",
|
|
29
|
-
},
|
|
30
|
-
created_at: {
|
|
31
|
-
type: DataTypes.DATE,
|
|
32
|
-
allowNull: false,
|
|
33
|
-
defaultValue: DataTypes.NOW,
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
tableName: "policy_dogs_creative_cache",
|
|
38
|
-
timestamps: false,
|
|
39
|
-
indexes: [
|
|
40
|
-
{
|
|
41
|
-
unique: true,
|
|
42
|
-
fields: ["ad_account_id", "page_id", "dog_url"],
|
|
43
|
-
name: "idx_dogs_creative_cache_unique",
|
|
44
|
-
},
|
|
45
|
-
],
|
|
46
|
-
}
|
|
47
|
-
);
|
|
48
|
-
|
|
49
|
-
return PolicyDogsCreativeCache;
|
|
50
|
-
};
|
|
1
|
+
module.exports = (sequelize, DataTypes) => {
|
|
2
|
+
const PolicyDogsCreativeCache = sequelize.define(
|
|
3
|
+
"PolicyDogsCreativeCache",
|
|
4
|
+
{
|
|
5
|
+
id: {
|
|
6
|
+
type: DataTypes.INTEGER,
|
|
7
|
+
primaryKey: true,
|
|
8
|
+
autoIncrement: true,
|
|
9
|
+
},
|
|
10
|
+
ad_account_id: {
|
|
11
|
+
type: DataTypes.STRING,
|
|
12
|
+
allowNull: false,
|
|
13
|
+
comment: "Facebook ad account ID (e.g., act_123456)",
|
|
14
|
+
},
|
|
15
|
+
page_id: {
|
|
16
|
+
type: DataTypes.STRING,
|
|
17
|
+
allowNull: false,
|
|
18
|
+
comment: "Facebook page ID used in the creative",
|
|
19
|
+
},
|
|
20
|
+
dog_url: {
|
|
21
|
+
type: DataTypes.TEXT,
|
|
22
|
+
allowNull: false,
|
|
23
|
+
comment: "The dog article URL used in the creative",
|
|
24
|
+
},
|
|
25
|
+
creative_id: {
|
|
26
|
+
type: DataTypes.STRING,
|
|
27
|
+
allowNull: false,
|
|
28
|
+
comment: "Facebook creative ID to reuse",
|
|
29
|
+
},
|
|
30
|
+
created_at: {
|
|
31
|
+
type: DataTypes.DATE,
|
|
32
|
+
allowNull: false,
|
|
33
|
+
defaultValue: DataTypes.NOW,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
tableName: "policy_dogs_creative_cache",
|
|
38
|
+
timestamps: false,
|
|
39
|
+
indexes: [
|
|
40
|
+
{
|
|
41
|
+
unique: true,
|
|
42
|
+
fields: ["ad_account_id", "page_id", "dog_url"],
|
|
43
|
+
name: "idx_dogs_creative_cache_unique",
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
return PolicyDogsCreativeCache;
|
|
50
|
+
};
|