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,83 +1,83 @@
|
|
|
1
|
-
module.exports = (sequelize, DataTypes) => {
|
|
2
|
-
const Tier2_UserAdAccounts = sequelize.define(
|
|
3
|
-
"Tier2_UserAdAccounts",
|
|
4
|
-
{
|
|
5
|
-
id: {
|
|
6
|
-
type: DataTypes.UUID,
|
|
7
|
-
defaultValue: DataTypes.UUIDV4,
|
|
8
|
-
primaryKey: true,
|
|
9
|
-
},
|
|
10
|
-
userId: {
|
|
11
|
-
type: DataTypes.STRING,
|
|
12
|
-
allowNull: false,
|
|
13
|
-
comment: "User ID (can be internal system ID or external ID)",
|
|
14
|
-
},
|
|
15
|
-
adAccountId: {
|
|
16
|
-
type: DataTypes.UUID,
|
|
17
|
-
allowNull: false,
|
|
18
|
-
references: {
|
|
19
|
-
model: "Tier2_AdAccounts",
|
|
20
|
-
key: "id",
|
|
21
|
-
},
|
|
22
|
-
onUpdate: "CASCADE",
|
|
23
|
-
onDelete: "CASCADE",
|
|
24
|
-
},
|
|
25
|
-
facebookAdAccountId: {
|
|
26
|
-
type: DataTypes.STRING,
|
|
27
|
-
allowNull: false,
|
|
28
|
-
comment: "Facebook Ad Account ID (for quick reference)",
|
|
29
|
-
},
|
|
30
|
-
permissions: {
|
|
31
|
-
type: DataTypes.ARRAY(DataTypes.STRING),
|
|
32
|
-
allowNull: false,
|
|
33
|
-
defaultValue: ["view", "create_campaigns", "view_performance"],
|
|
34
|
-
comment:
|
|
35
|
-
"Permissions: view, create_campaigns, edit_campaigns, view_performance, manage_assets",
|
|
36
|
-
},
|
|
37
|
-
assignedAt: {
|
|
38
|
-
type: DataTypes.DATE,
|
|
39
|
-
allowNull: false,
|
|
40
|
-
defaultValue: DataTypes.NOW,
|
|
41
|
-
},
|
|
42
|
-
assignedBy: {
|
|
43
|
-
type: DataTypes.STRING,
|
|
44
|
-
allowNull: true,
|
|
45
|
-
comment: "User ID who assigned this ad account",
|
|
46
|
-
},
|
|
47
|
-
status: {
|
|
48
|
-
type: DataTypes.ENUM("active", "suspended", "revoked"),
|
|
49
|
-
allowNull: false,
|
|
50
|
-
defaultValue: "active",
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
tableName: "Tier2_UserAdAccounts",
|
|
55
|
-
indexes: [
|
|
56
|
-
{
|
|
57
|
-
fields: ["userId"],
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
fields: ["adAccountId"],
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
fields: ["facebookAdAccountId"],
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
unique: true,
|
|
67
|
-
fields: ["userId", "adAccountId"],
|
|
68
|
-
name: "unique_user_ad_account",
|
|
69
|
-
},
|
|
70
|
-
],
|
|
71
|
-
}
|
|
72
|
-
);
|
|
73
|
-
|
|
74
|
-
Tier2_UserAdAccounts.associate = (models) => {
|
|
75
|
-
// Association with Tier2_AdAccounts
|
|
76
|
-
Tier2_UserAdAccounts.belongsTo(models.Tier2_AdAccounts, {
|
|
77
|
-
foreignKey: "adAccountId",
|
|
78
|
-
as: "adAccount",
|
|
79
|
-
});
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
return Tier2_UserAdAccounts;
|
|
83
|
-
};
|
|
1
|
+
module.exports = (sequelize, DataTypes) => {
|
|
2
|
+
const Tier2_UserAdAccounts = sequelize.define(
|
|
3
|
+
"Tier2_UserAdAccounts",
|
|
4
|
+
{
|
|
5
|
+
id: {
|
|
6
|
+
type: DataTypes.UUID,
|
|
7
|
+
defaultValue: DataTypes.UUIDV4,
|
|
8
|
+
primaryKey: true,
|
|
9
|
+
},
|
|
10
|
+
userId: {
|
|
11
|
+
type: DataTypes.STRING,
|
|
12
|
+
allowNull: false,
|
|
13
|
+
comment: "User ID (can be internal system ID or external ID)",
|
|
14
|
+
},
|
|
15
|
+
adAccountId: {
|
|
16
|
+
type: DataTypes.UUID,
|
|
17
|
+
allowNull: false,
|
|
18
|
+
references: {
|
|
19
|
+
model: "Tier2_AdAccounts",
|
|
20
|
+
key: "id",
|
|
21
|
+
},
|
|
22
|
+
onUpdate: "CASCADE",
|
|
23
|
+
onDelete: "CASCADE",
|
|
24
|
+
},
|
|
25
|
+
facebookAdAccountId: {
|
|
26
|
+
type: DataTypes.STRING,
|
|
27
|
+
allowNull: false,
|
|
28
|
+
comment: "Facebook Ad Account ID (for quick reference)",
|
|
29
|
+
},
|
|
30
|
+
permissions: {
|
|
31
|
+
type: DataTypes.ARRAY(DataTypes.STRING),
|
|
32
|
+
allowNull: false,
|
|
33
|
+
defaultValue: ["view", "create_campaigns", "view_performance"],
|
|
34
|
+
comment:
|
|
35
|
+
"Permissions: view, create_campaigns, edit_campaigns, view_performance, manage_assets",
|
|
36
|
+
},
|
|
37
|
+
assignedAt: {
|
|
38
|
+
type: DataTypes.DATE,
|
|
39
|
+
allowNull: false,
|
|
40
|
+
defaultValue: DataTypes.NOW,
|
|
41
|
+
},
|
|
42
|
+
assignedBy: {
|
|
43
|
+
type: DataTypes.STRING,
|
|
44
|
+
allowNull: true,
|
|
45
|
+
comment: "User ID who assigned this ad account",
|
|
46
|
+
},
|
|
47
|
+
status: {
|
|
48
|
+
type: DataTypes.ENUM("active", "suspended", "revoked"),
|
|
49
|
+
allowNull: false,
|
|
50
|
+
defaultValue: "active",
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
tableName: "Tier2_UserAdAccounts",
|
|
55
|
+
indexes: [
|
|
56
|
+
{
|
|
57
|
+
fields: ["userId"],
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
fields: ["adAccountId"],
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
fields: ["facebookAdAccountId"],
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
unique: true,
|
|
67
|
+
fields: ["userId", "adAccountId"],
|
|
68
|
+
name: "unique_user_ad_account",
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
Tier2_UserAdAccounts.associate = (models) => {
|
|
75
|
+
// Association with Tier2_AdAccounts
|
|
76
|
+
Tier2_UserAdAccounts.belongsTo(models.Tier2_AdAccounts, {
|
|
77
|
+
foreignKey: "adAccountId",
|
|
78
|
+
as: "adAccount",
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
return Tier2_UserAdAccounts;
|
|
83
|
+
};
|
package/models/TikTokAd.js
CHANGED
|
@@ -1,71 +1,71 @@
|
|
|
1
|
-
module.exports = (sequelize, DataTypes) =>
|
|
2
|
-
sequelize.define(
|
|
3
|
-
"TikTokAd",
|
|
4
|
-
{
|
|
5
|
-
ad_id: {
|
|
6
|
-
type: DataTypes.BIGINT,
|
|
7
|
-
primaryKey: true,
|
|
8
|
-
},
|
|
9
|
-
ad_name: {
|
|
10
|
-
type: DataTypes.STRING(255),
|
|
11
|
-
allowNull: false,
|
|
12
|
-
},
|
|
13
|
-
adgroup_id: {
|
|
14
|
-
type: DataTypes.BIGINT,
|
|
15
|
-
allowNull: false,
|
|
16
|
-
comment: "TikTok adgroup_id; loose FK to tiktok_adgroups (no DB-level constraint)",
|
|
17
|
-
},
|
|
18
|
-
campaign_id: {
|
|
19
|
-
type: DataTypes.BIGINT,
|
|
20
|
-
allowNull: false,
|
|
21
|
-
},
|
|
22
|
-
ad_account_id: {
|
|
23
|
-
type: DataTypes.STRING(64),
|
|
24
|
-
allowNull: false,
|
|
25
|
-
},
|
|
26
|
-
ad_format: {
|
|
27
|
-
type: DataTypes.STRING(50),
|
|
28
|
-
allowNull: true,
|
|
29
|
-
comment: "SINGLE_VIDEO, SINGLE_IMAGE, etc.",
|
|
30
|
-
},
|
|
31
|
-
identity_id: {
|
|
32
|
-
type: DataTypes.STRING(64),
|
|
33
|
-
allowNull: true,
|
|
34
|
-
comment: "TikTok identity (Page equivalent)",
|
|
35
|
-
},
|
|
36
|
-
landing_page_url: {
|
|
37
|
-
type: DataTypes.TEXT,
|
|
38
|
-
allowNull: true,
|
|
39
|
-
},
|
|
40
|
-
display_name: {
|
|
41
|
-
type: DataTypes.STRING(255),
|
|
42
|
-
allowNull: true,
|
|
43
|
-
},
|
|
44
|
-
operation_status: {
|
|
45
|
-
type: DataTypes.STRING(50),
|
|
46
|
-
allowNull: true,
|
|
47
|
-
comment: "ENABLE or DISABLE (TikTok native)",
|
|
48
|
-
},
|
|
49
|
-
created_at: {
|
|
50
|
-
type: DataTypes.DATE,
|
|
51
|
-
allowNull: false,
|
|
52
|
-
},
|
|
53
|
-
updated_at: {
|
|
54
|
-
type: DataTypes.DATE,
|
|
55
|
-
allowNull: true,
|
|
56
|
-
},
|
|
57
|
-
synced_at: {
|
|
58
|
-
type: DataTypes.DATE,
|
|
59
|
-
allowNull: false,
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
tableName: "tiktok_ads",
|
|
64
|
-
timestamps: false,
|
|
65
|
-
indexes: [
|
|
66
|
-
{ fields: ["adgroup_id"] },
|
|
67
|
-
{ fields: ["campaign_id"] },
|
|
68
|
-
{ fields: ["operation_status"] },
|
|
69
|
-
],
|
|
70
|
-
},
|
|
71
|
-
);
|
|
1
|
+
module.exports = (sequelize, DataTypes) =>
|
|
2
|
+
sequelize.define(
|
|
3
|
+
"TikTokAd",
|
|
4
|
+
{
|
|
5
|
+
ad_id: {
|
|
6
|
+
type: DataTypes.BIGINT,
|
|
7
|
+
primaryKey: true,
|
|
8
|
+
},
|
|
9
|
+
ad_name: {
|
|
10
|
+
type: DataTypes.STRING(255),
|
|
11
|
+
allowNull: false,
|
|
12
|
+
},
|
|
13
|
+
adgroup_id: {
|
|
14
|
+
type: DataTypes.BIGINT,
|
|
15
|
+
allowNull: false,
|
|
16
|
+
comment: "TikTok adgroup_id; loose FK to tiktok_adgroups (no DB-level constraint)",
|
|
17
|
+
},
|
|
18
|
+
campaign_id: {
|
|
19
|
+
type: DataTypes.BIGINT,
|
|
20
|
+
allowNull: false,
|
|
21
|
+
},
|
|
22
|
+
ad_account_id: {
|
|
23
|
+
type: DataTypes.STRING(64),
|
|
24
|
+
allowNull: false,
|
|
25
|
+
},
|
|
26
|
+
ad_format: {
|
|
27
|
+
type: DataTypes.STRING(50),
|
|
28
|
+
allowNull: true,
|
|
29
|
+
comment: "SINGLE_VIDEO, SINGLE_IMAGE, etc.",
|
|
30
|
+
},
|
|
31
|
+
identity_id: {
|
|
32
|
+
type: DataTypes.STRING(64),
|
|
33
|
+
allowNull: true,
|
|
34
|
+
comment: "TikTok identity (Page equivalent)",
|
|
35
|
+
},
|
|
36
|
+
landing_page_url: {
|
|
37
|
+
type: DataTypes.TEXT,
|
|
38
|
+
allowNull: true,
|
|
39
|
+
},
|
|
40
|
+
display_name: {
|
|
41
|
+
type: DataTypes.STRING(255),
|
|
42
|
+
allowNull: true,
|
|
43
|
+
},
|
|
44
|
+
operation_status: {
|
|
45
|
+
type: DataTypes.STRING(50),
|
|
46
|
+
allowNull: true,
|
|
47
|
+
comment: "ENABLE or DISABLE (TikTok native)",
|
|
48
|
+
},
|
|
49
|
+
created_at: {
|
|
50
|
+
type: DataTypes.DATE,
|
|
51
|
+
allowNull: false,
|
|
52
|
+
},
|
|
53
|
+
updated_at: {
|
|
54
|
+
type: DataTypes.DATE,
|
|
55
|
+
allowNull: true,
|
|
56
|
+
},
|
|
57
|
+
synced_at: {
|
|
58
|
+
type: DataTypes.DATE,
|
|
59
|
+
allowNull: false,
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
tableName: "tiktok_ads",
|
|
64
|
+
timestamps: false,
|
|
65
|
+
indexes: [
|
|
66
|
+
{ fields: ["adgroup_id"] },
|
|
67
|
+
{ fields: ["campaign_id"] },
|
|
68
|
+
{ fields: ["operation_status"] },
|
|
69
|
+
],
|
|
70
|
+
},
|
|
71
|
+
);
|
package/models/TikTokAdGroup.js
CHANGED
|
@@ -1,82 +1,82 @@
|
|
|
1
|
-
module.exports = (sequelize, DataTypes) =>
|
|
2
|
-
sequelize.define(
|
|
3
|
-
"TikTokAdGroup",
|
|
4
|
-
{
|
|
5
|
-
adgroup_id: {
|
|
6
|
-
type: DataTypes.BIGINT,
|
|
7
|
-
primaryKey: true,
|
|
8
|
-
},
|
|
9
|
-
adgroup_name: {
|
|
10
|
-
type: DataTypes.STRING(255),
|
|
11
|
-
allowNull: false,
|
|
12
|
-
},
|
|
13
|
-
campaign_id: {
|
|
14
|
-
type: DataTypes.BIGINT,
|
|
15
|
-
allowNull: false,
|
|
16
|
-
comment: "TikTok campaign_id; loose FK to tiktok_campaigns (no DB-level constraint)",
|
|
17
|
-
},
|
|
18
|
-
ad_account_id: {
|
|
19
|
-
type: DataTypes.STRING(64),
|
|
20
|
-
allowNull: false,
|
|
21
|
-
},
|
|
22
|
-
placement_type: {
|
|
23
|
-
type: DataTypes.STRING(50),
|
|
24
|
-
allowNull: true,
|
|
25
|
-
comment: "PLACEMENT_TYPE_AUTOMATIC / PLACEMENT_TYPE_NORMAL",
|
|
26
|
-
},
|
|
27
|
-
budget_mode: {
|
|
28
|
-
type: DataTypes.STRING(50),
|
|
29
|
-
allowNull: true,
|
|
30
|
-
},
|
|
31
|
-
budget: {
|
|
32
|
-
type: DataTypes.DECIMAL(12, 6),
|
|
33
|
-
allowNull: true,
|
|
34
|
-
},
|
|
35
|
-
bid_type: {
|
|
36
|
-
type: DataTypes.STRING(50),
|
|
37
|
-
allowNull: true,
|
|
38
|
-
},
|
|
39
|
-
bid_price: {
|
|
40
|
-
type: DataTypes.DECIMAL(12, 6),
|
|
41
|
-
allowNull: true,
|
|
42
|
-
},
|
|
43
|
-
optimize_goal: {
|
|
44
|
-
type: DataTypes.STRING(50),
|
|
45
|
-
allowNull: true,
|
|
46
|
-
},
|
|
47
|
-
operation_status: {
|
|
48
|
-
type: DataTypes.STRING(50),
|
|
49
|
-
allowNull: true,
|
|
50
|
-
comment: "ENABLE or DISABLE (TikTok native)",
|
|
51
|
-
},
|
|
52
|
-
schedule_start_time: {
|
|
53
|
-
type: DataTypes.DATE,
|
|
54
|
-
allowNull: true,
|
|
55
|
-
},
|
|
56
|
-
schedule_end_time: {
|
|
57
|
-
type: DataTypes.DATE,
|
|
58
|
-
allowNull: true,
|
|
59
|
-
},
|
|
60
|
-
created_at: {
|
|
61
|
-
type: DataTypes.DATE,
|
|
62
|
-
allowNull: false,
|
|
63
|
-
},
|
|
64
|
-
updated_at: {
|
|
65
|
-
type: DataTypes.DATE,
|
|
66
|
-
allowNull: true,
|
|
67
|
-
},
|
|
68
|
-
synced_at: {
|
|
69
|
-
type: DataTypes.DATE,
|
|
70
|
-
allowNull: false,
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
tableName: "tiktok_adgroups",
|
|
75
|
-
timestamps: false,
|
|
76
|
-
indexes: [
|
|
77
|
-
{ fields: ["campaign_id"] },
|
|
78
|
-
{ fields: ["ad_account_id"] },
|
|
79
|
-
{ fields: ["operation_status"] },
|
|
80
|
-
],
|
|
81
|
-
},
|
|
82
|
-
);
|
|
1
|
+
module.exports = (sequelize, DataTypes) =>
|
|
2
|
+
sequelize.define(
|
|
3
|
+
"TikTokAdGroup",
|
|
4
|
+
{
|
|
5
|
+
adgroup_id: {
|
|
6
|
+
type: DataTypes.BIGINT,
|
|
7
|
+
primaryKey: true,
|
|
8
|
+
},
|
|
9
|
+
adgroup_name: {
|
|
10
|
+
type: DataTypes.STRING(255),
|
|
11
|
+
allowNull: false,
|
|
12
|
+
},
|
|
13
|
+
campaign_id: {
|
|
14
|
+
type: DataTypes.BIGINT,
|
|
15
|
+
allowNull: false,
|
|
16
|
+
comment: "TikTok campaign_id; loose FK to tiktok_campaigns (no DB-level constraint)",
|
|
17
|
+
},
|
|
18
|
+
ad_account_id: {
|
|
19
|
+
type: DataTypes.STRING(64),
|
|
20
|
+
allowNull: false,
|
|
21
|
+
},
|
|
22
|
+
placement_type: {
|
|
23
|
+
type: DataTypes.STRING(50),
|
|
24
|
+
allowNull: true,
|
|
25
|
+
comment: "PLACEMENT_TYPE_AUTOMATIC / PLACEMENT_TYPE_NORMAL",
|
|
26
|
+
},
|
|
27
|
+
budget_mode: {
|
|
28
|
+
type: DataTypes.STRING(50),
|
|
29
|
+
allowNull: true,
|
|
30
|
+
},
|
|
31
|
+
budget: {
|
|
32
|
+
type: DataTypes.DECIMAL(12, 6),
|
|
33
|
+
allowNull: true,
|
|
34
|
+
},
|
|
35
|
+
bid_type: {
|
|
36
|
+
type: DataTypes.STRING(50),
|
|
37
|
+
allowNull: true,
|
|
38
|
+
},
|
|
39
|
+
bid_price: {
|
|
40
|
+
type: DataTypes.DECIMAL(12, 6),
|
|
41
|
+
allowNull: true,
|
|
42
|
+
},
|
|
43
|
+
optimize_goal: {
|
|
44
|
+
type: DataTypes.STRING(50),
|
|
45
|
+
allowNull: true,
|
|
46
|
+
},
|
|
47
|
+
operation_status: {
|
|
48
|
+
type: DataTypes.STRING(50),
|
|
49
|
+
allowNull: true,
|
|
50
|
+
comment: "ENABLE or DISABLE (TikTok native)",
|
|
51
|
+
},
|
|
52
|
+
schedule_start_time: {
|
|
53
|
+
type: DataTypes.DATE,
|
|
54
|
+
allowNull: true,
|
|
55
|
+
},
|
|
56
|
+
schedule_end_time: {
|
|
57
|
+
type: DataTypes.DATE,
|
|
58
|
+
allowNull: true,
|
|
59
|
+
},
|
|
60
|
+
created_at: {
|
|
61
|
+
type: DataTypes.DATE,
|
|
62
|
+
allowNull: false,
|
|
63
|
+
},
|
|
64
|
+
updated_at: {
|
|
65
|
+
type: DataTypes.DATE,
|
|
66
|
+
allowNull: true,
|
|
67
|
+
},
|
|
68
|
+
synced_at: {
|
|
69
|
+
type: DataTypes.DATE,
|
|
70
|
+
allowNull: false,
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
tableName: "tiktok_adgroups",
|
|
75
|
+
timestamps: false,
|
|
76
|
+
indexes: [
|
|
77
|
+
{ fields: ["campaign_id"] },
|
|
78
|
+
{ fields: ["ad_account_id"] },
|
|
79
|
+
{ fields: ["operation_status"] },
|
|
80
|
+
],
|
|
81
|
+
},
|
|
82
|
+
);
|
package/models/TikTokCampaign.js
CHANGED
|
@@ -1,71 +1,71 @@
|
|
|
1
|
-
module.exports = (sequelize, DataTypes) =>
|
|
2
|
-
sequelize.define(
|
|
3
|
-
"TikTokCampaign",
|
|
4
|
-
{
|
|
5
|
-
campaign_id: {
|
|
6
|
-
type: DataTypes.BIGINT,
|
|
7
|
-
primaryKey: true,
|
|
8
|
-
},
|
|
9
|
-
campaign_name: {
|
|
10
|
-
type: DataTypes.STRING(255),
|
|
11
|
-
allowNull: false,
|
|
12
|
-
},
|
|
13
|
-
ad_account_id: {
|
|
14
|
-
type: DataTypes.STRING(64),
|
|
15
|
-
allowNull: false,
|
|
16
|
-
},
|
|
17
|
-
objective_type: {
|
|
18
|
-
type: DataTypes.STRING(50),
|
|
19
|
-
allowNull: true,
|
|
20
|
-
},
|
|
21
|
-
budget_mode: {
|
|
22
|
-
type: DataTypes.STRING(50),
|
|
23
|
-
allowNull: true,
|
|
24
|
-
comment: "BUDGET_MODE_DAY or BUDGET_MODE_LIFETIME (TikTok native)",
|
|
25
|
-
},
|
|
26
|
-
daily_budget_usd: {
|
|
27
|
-
type: DataTypes.DECIMAL(12, 6),
|
|
28
|
-
allowNull: true,
|
|
29
|
-
comment: "Normalized USD value (TikTok returns native USD float)",
|
|
30
|
-
},
|
|
31
|
-
operation_status: {
|
|
32
|
-
type: DataTypes.STRING(50),
|
|
33
|
-
allowNull: true,
|
|
34
|
-
comment: "ENABLE or DISABLE (TikTok native)",
|
|
35
|
-
},
|
|
36
|
-
special_industries: {
|
|
37
|
-
type: DataTypes.TEXT,
|
|
38
|
-
allowNull: true,
|
|
39
|
-
comment: "JSON-serialized array of special industry tags",
|
|
40
|
-
},
|
|
41
|
-
schedule_start_time: {
|
|
42
|
-
type: DataTypes.DATE,
|
|
43
|
-
allowNull: true,
|
|
44
|
-
},
|
|
45
|
-
schedule_end_time: {
|
|
46
|
-
type: DataTypes.DATE,
|
|
47
|
-
allowNull: true,
|
|
48
|
-
},
|
|
49
|
-
created_at: {
|
|
50
|
-
type: DataTypes.DATE,
|
|
51
|
-
allowNull: false,
|
|
52
|
-
},
|
|
53
|
-
updated_at: {
|
|
54
|
-
type: DataTypes.DATE,
|
|
55
|
-
allowNull: true,
|
|
56
|
-
},
|
|
57
|
-
synced_at: {
|
|
58
|
-
type: DataTypes.DATE,
|
|
59
|
-
allowNull: false,
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
tableName: "tiktok_campaigns",
|
|
64
|
-
timestamps: false,
|
|
65
|
-
indexes: [
|
|
66
|
-
{ fields: ["ad_account_id"] },
|
|
67
|
-
{ fields: ["created_at"] },
|
|
68
|
-
{ fields: ["operation_status"] },
|
|
69
|
-
],
|
|
70
|
-
},
|
|
71
|
-
);
|
|
1
|
+
module.exports = (sequelize, DataTypes) =>
|
|
2
|
+
sequelize.define(
|
|
3
|
+
"TikTokCampaign",
|
|
4
|
+
{
|
|
5
|
+
campaign_id: {
|
|
6
|
+
type: DataTypes.BIGINT,
|
|
7
|
+
primaryKey: true,
|
|
8
|
+
},
|
|
9
|
+
campaign_name: {
|
|
10
|
+
type: DataTypes.STRING(255),
|
|
11
|
+
allowNull: false,
|
|
12
|
+
},
|
|
13
|
+
ad_account_id: {
|
|
14
|
+
type: DataTypes.STRING(64),
|
|
15
|
+
allowNull: false,
|
|
16
|
+
},
|
|
17
|
+
objective_type: {
|
|
18
|
+
type: DataTypes.STRING(50),
|
|
19
|
+
allowNull: true,
|
|
20
|
+
},
|
|
21
|
+
budget_mode: {
|
|
22
|
+
type: DataTypes.STRING(50),
|
|
23
|
+
allowNull: true,
|
|
24
|
+
comment: "BUDGET_MODE_DAY or BUDGET_MODE_LIFETIME (TikTok native)",
|
|
25
|
+
},
|
|
26
|
+
daily_budget_usd: {
|
|
27
|
+
type: DataTypes.DECIMAL(12, 6),
|
|
28
|
+
allowNull: true,
|
|
29
|
+
comment: "Normalized USD value (TikTok returns native USD float)",
|
|
30
|
+
},
|
|
31
|
+
operation_status: {
|
|
32
|
+
type: DataTypes.STRING(50),
|
|
33
|
+
allowNull: true,
|
|
34
|
+
comment: "ENABLE or DISABLE (TikTok native)",
|
|
35
|
+
},
|
|
36
|
+
special_industries: {
|
|
37
|
+
type: DataTypes.TEXT,
|
|
38
|
+
allowNull: true,
|
|
39
|
+
comment: "JSON-serialized array of special industry tags",
|
|
40
|
+
},
|
|
41
|
+
schedule_start_time: {
|
|
42
|
+
type: DataTypes.DATE,
|
|
43
|
+
allowNull: true,
|
|
44
|
+
},
|
|
45
|
+
schedule_end_time: {
|
|
46
|
+
type: DataTypes.DATE,
|
|
47
|
+
allowNull: true,
|
|
48
|
+
},
|
|
49
|
+
created_at: {
|
|
50
|
+
type: DataTypes.DATE,
|
|
51
|
+
allowNull: false,
|
|
52
|
+
},
|
|
53
|
+
updated_at: {
|
|
54
|
+
type: DataTypes.DATE,
|
|
55
|
+
allowNull: true,
|
|
56
|
+
},
|
|
57
|
+
synced_at: {
|
|
58
|
+
type: DataTypes.DATE,
|
|
59
|
+
allowNull: false,
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
tableName: "tiktok_campaigns",
|
|
64
|
+
timestamps: false,
|
|
65
|
+
indexes: [
|
|
66
|
+
{ fields: ["ad_account_id"] },
|
|
67
|
+
{ fields: ["created_at"] },
|
|
68
|
+
{ fields: ["operation_status"] },
|
|
69
|
+
],
|
|
70
|
+
},
|
|
71
|
+
);
|
package/models/TiktokChannel.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
module.exports = (sequelize, DataTypes) => {
|
|
2
|
-
const TiktokChannel = sequelize.define(
|
|
3
|
-
"TiktokChannel",
|
|
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: "tiktok_rsoc_channels",
|
|
26
|
-
timestamps: true,
|
|
27
|
-
}
|
|
28
|
-
);
|
|
29
|
-
|
|
30
|
-
return TiktokChannel;
|
|
31
|
-
};
|
|
1
|
+
module.exports = (sequelize, DataTypes) => {
|
|
2
|
+
const TiktokChannel = sequelize.define(
|
|
3
|
+
"TiktokChannel",
|
|
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: "tiktok_rsoc_channels",
|
|
26
|
+
timestamps: true,
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
return TiktokChannel;
|
|
31
|
+
};
|