clhq-postgres-module 1.1.0-alpha.170 → 1.1.0-alpha.172

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.
Files changed (40) hide show
  1. package/dist/config/data-source.js +3 -6
  2. package/dist/entities/account-analytics-summary.entity.d.ts +17 -0
  3. package/dist/entities/account-analytics-summary.entity.js +82 -0
  4. package/dist/entities/analytics-report.entity.d.ts +20 -0
  5. package/dist/entities/analytics-report.entity.js +66 -0
  6. package/dist/entities/index.d.ts +7 -0
  7. package/dist/entities/index.js +7 -0
  8. package/dist/entities/platform-config.entity.d.ts +16 -0
  9. package/dist/entities/platform-config.entity.js +72 -0
  10. package/dist/entities/post-analytics-snapshot.entity.d.ts +33 -0
  11. package/dist/entities/post-analytics-snapshot.entity.js +122 -0
  12. package/dist/entities/post-brand-analysis.entity.d.ts +26 -0
  13. package/dist/entities/post-brand-analysis.entity.js +75 -0
  14. package/dist/entities/social-account.entity.d.ts +39 -0
  15. package/dist/entities/social-account.entity.js +131 -0
  16. package/dist/entities/social-post.entity.d.ts +45 -0
  17. package/dist/entities/social-post.entity.js +171 -0
  18. package/dist/migrations/1713000000000-Baseline.d.ts +6 -0
  19. package/dist/migrations/1713000000000-Baseline.js +13 -0
  20. package/dist/migrations/1713000000001-CreateSocialConnectionTables.d.ts +6 -0
  21. package/dist/migrations/1713000000001-CreateSocialConnectionTables.js +68 -0
  22. package/dist/migrations/1713000000002-AddIsActiveToWorkspaceMembers.d.ts +6 -0
  23. package/dist/migrations/1713000000002-AddIsActiveToWorkspaceMembers.js +36 -0
  24. package/dist/migrations/1713000000003-AddDescriptionToBrandKits.d.ts +6 -0
  25. package/dist/migrations/1713000000003-AddDescriptionToBrandKits.js +20 -0
  26. package/dist/repositories/account-analytics-summary.repository.d.ts +12 -0
  27. package/dist/repositories/account-analytics-summary.repository.js +55 -0
  28. package/dist/repositories/index.d.ts +5 -0
  29. package/dist/repositories/index.js +11 -1
  30. package/dist/repositories/platform-config.repository.d.ts +10 -0
  31. package/dist/repositories/platform-config.repository.js +43 -0
  32. package/dist/repositories/post-analytics-snapshot.repository.d.ts +9 -0
  33. package/dist/repositories/post-analytics-snapshot.repository.js +50 -0
  34. package/dist/repositories/repository.module.d.ts +1 -0
  35. package/dist/repositories/repository.module.js +16 -1
  36. package/dist/repositories/social-account.repository.d.ts +9 -0
  37. package/dist/repositories/social-account.repository.js +44 -0
  38. package/dist/repositories/social-post.repository.d.ts +17 -0
  39. package/dist/repositories/social-post.repository.js +91 -0
  40. package/package.json +12 -34
@@ -1,10 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const typeorm_1 = require("typeorm");
4
- const user_entity_1 = require("../entities/user.entity");
5
- const workspace_entity_1 = require("../entities/workspace.entity");
6
- const editor_project_entity_1 = require("../entities/editor-project.entity");
7
- const user_subscription_entity_1 = require("../entities/user-subscription.entity");
4
+ const path_1 = require("path");
8
5
  const connectionUrl = process.env.PG_SESSION_POOLER_URL || process.env.PG_POOLER_URL;
9
6
  let dataSource;
10
7
  if (connectionUrl) {
@@ -13,8 +10,8 @@ if (connectionUrl) {
13
10
  url: connectionUrl,
14
11
  synchronize: false,
15
12
  logging: process.env.NODE_ENV === 'development',
16
- entities: [user_entity_1.User, workspace_entity_1.Workspace, editor_project_entity_1.EditorProject, user_subscription_entity_1.UserSubscription],
17
- migrations: [],
13
+ entities: [(0, path_1.join)(__dirname, '/../entities/*.entity{.ts,.js}')],
14
+ migrations: [(0, path_1.join)(__dirname, '/../migrations/*{.ts,.js}')],
18
15
  ssl: { rejectUnauthorized: false },
19
16
  extra: {
20
17
  max: 20,
@@ -0,0 +1,17 @@
1
+ export declare class AccountAnalyticsSummary {
2
+ id: string;
3
+ socialAccountId: string;
4
+ workspaceId: string;
5
+ platform: string;
6
+ date: string;
7
+ followerCount: number;
8
+ followersGained: number;
9
+ followersLost: number;
10
+ totalViews: number;
11
+ totalImpressions: number;
12
+ totalEngagements: number;
13
+ avgEngagementRate: number;
14
+ postsPublished: number;
15
+ platformRawMetrics: Record<string, any>;
16
+ createdAt: Date;
17
+ }
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.AccountAnalyticsSummary = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ let AccountAnalyticsSummary = class AccountAnalyticsSummary {
15
+ };
16
+ exports.AccountAnalyticsSummary = AccountAnalyticsSummary;
17
+ __decorate([
18
+ (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
19
+ __metadata("design:type", String)
20
+ ], AccountAnalyticsSummary.prototype, "id", void 0);
21
+ __decorate([
22
+ (0, typeorm_1.Column)({ name: 'social_account_id', type: 'uuid' }),
23
+ __metadata("design:type", String)
24
+ ], AccountAnalyticsSummary.prototype, "socialAccountId", void 0);
25
+ __decorate([
26
+ (0, typeorm_1.Column)({ name: 'workspace_id', type: 'uuid' }),
27
+ __metadata("design:type", String)
28
+ ], AccountAnalyticsSummary.prototype, "workspaceId", void 0);
29
+ __decorate([
30
+ (0, typeorm_1.Column)({ type: 'varchar', length: 50 }),
31
+ __metadata("design:type", String)
32
+ ], AccountAnalyticsSummary.prototype, "platform", void 0);
33
+ __decorate([
34
+ (0, typeorm_1.Column)({ type: 'date' }),
35
+ __metadata("design:type", String)
36
+ ], AccountAnalyticsSummary.prototype, "date", void 0);
37
+ __decorate([
38
+ (0, typeorm_1.Column)({ name: 'follower_count', type: 'integer', default: 0 }),
39
+ __metadata("design:type", Number)
40
+ ], AccountAnalyticsSummary.prototype, "followerCount", void 0);
41
+ __decorate([
42
+ (0, typeorm_1.Column)({ name: 'followers_gained', type: 'integer', default: 0 }),
43
+ __metadata("design:type", Number)
44
+ ], AccountAnalyticsSummary.prototype, "followersGained", void 0);
45
+ __decorate([
46
+ (0, typeorm_1.Column)({ name: 'followers_lost', type: 'integer', default: 0 }),
47
+ __metadata("design:type", Number)
48
+ ], AccountAnalyticsSummary.prototype, "followersLost", void 0);
49
+ __decorate([
50
+ (0, typeorm_1.Column)({ name: 'total_views', type: 'integer', default: 0 }),
51
+ __metadata("design:type", Number)
52
+ ], AccountAnalyticsSummary.prototype, "totalViews", void 0);
53
+ __decorate([
54
+ (0, typeorm_1.Column)({ name: 'total_impressions', type: 'integer', default: 0 }),
55
+ __metadata("design:type", Number)
56
+ ], AccountAnalyticsSummary.prototype, "totalImpressions", void 0);
57
+ __decorate([
58
+ (0, typeorm_1.Column)({ name: 'total_engagements', type: 'integer', default: 0 }),
59
+ __metadata("design:type", Number)
60
+ ], AccountAnalyticsSummary.prototype, "totalEngagements", void 0);
61
+ __decorate([
62
+ (0, typeorm_1.Column)({ name: 'avg_engagement_rate', type: 'float', default: 0 }),
63
+ __metadata("design:type", Number)
64
+ ], AccountAnalyticsSummary.prototype, "avgEngagementRate", void 0);
65
+ __decorate([
66
+ (0, typeorm_1.Column)({ name: 'posts_published', type: 'integer', default: 0 }),
67
+ __metadata("design:type", Number)
68
+ ], AccountAnalyticsSummary.prototype, "postsPublished", void 0);
69
+ __decorate([
70
+ (0, typeorm_1.Column)({ name: 'platform_raw_metrics', type: 'jsonb', default: {} }),
71
+ __metadata("design:type", Object)
72
+ ], AccountAnalyticsSummary.prototype, "platformRawMetrics", void 0);
73
+ __decorate([
74
+ (0, typeorm_1.CreateDateColumn)({ name: 'created_at' }),
75
+ __metadata("design:type", Date)
76
+ ], AccountAnalyticsSummary.prototype, "createdAt", void 0);
77
+ exports.AccountAnalyticsSummary = AccountAnalyticsSummary = __decorate([
78
+ (0, typeorm_1.Entity)('account_analytics_summaries'),
79
+ (0, typeorm_1.Index)(['socialAccountId', 'date']),
80
+ (0, typeorm_1.Index)(['workspaceId', 'date']),
81
+ (0, typeorm_1.Index)(['workspaceId', 'platform', 'date'])
82
+ ], AccountAnalyticsSummary);
@@ -0,0 +1,20 @@
1
+ export declare enum ReportType {
2
+ DAILY_SUMMARY = "DAILY_SUMMARY",
3
+ WEEKLY_SUMMARY = "WEEKLY_SUMMARY",
4
+ TOP_POSTS = "TOP_POSTS",
5
+ ENGAGEMENT_TREND = "ENGAGEMENT_TREND",
6
+ AUDIENCE_GROWTH = "AUDIENCE_GROWTH",
7
+ PLATFORM_COMPARISON = "PLATFORM_COMPARISON",
8
+ BRAND_PERFORMANCE = "BRAND_PERFORMANCE"
9
+ }
10
+ export declare class AnalyticsReport {
11
+ id: string;
12
+ workspaceId: string;
13
+ reportType: ReportType;
14
+ platform: string;
15
+ periodStart: Date;
16
+ periodEnd: Date;
17
+ data: Record<string, any>;
18
+ computedAt: Date;
19
+ createdAt: Date;
20
+ }
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.AnalyticsReport = exports.ReportType = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ var ReportType;
15
+ (function (ReportType) {
16
+ ReportType["DAILY_SUMMARY"] = "DAILY_SUMMARY";
17
+ ReportType["WEEKLY_SUMMARY"] = "WEEKLY_SUMMARY";
18
+ ReportType["TOP_POSTS"] = "TOP_POSTS";
19
+ ReportType["ENGAGEMENT_TREND"] = "ENGAGEMENT_TREND";
20
+ ReportType["AUDIENCE_GROWTH"] = "AUDIENCE_GROWTH";
21
+ ReportType["PLATFORM_COMPARISON"] = "PLATFORM_COMPARISON";
22
+ ReportType["BRAND_PERFORMANCE"] = "BRAND_PERFORMANCE";
23
+ })(ReportType || (exports.ReportType = ReportType = {}));
24
+ let AnalyticsReport = class AnalyticsReport {
25
+ };
26
+ exports.AnalyticsReport = AnalyticsReport;
27
+ __decorate([
28
+ (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
29
+ __metadata("design:type", String)
30
+ ], AnalyticsReport.prototype, "id", void 0);
31
+ __decorate([
32
+ (0, typeorm_1.Column)({ name: 'workspace_id', type: 'uuid' }),
33
+ __metadata("design:type", String)
34
+ ], AnalyticsReport.prototype, "workspaceId", void 0);
35
+ __decorate([
36
+ (0, typeorm_1.Column)({ name: 'report_type', type: 'varchar', length: 50 }),
37
+ __metadata("design:type", String)
38
+ ], AnalyticsReport.prototype, "reportType", void 0);
39
+ __decorate([
40
+ (0, typeorm_1.Column)({ type: 'varchar', length: 50, nullable: true }),
41
+ __metadata("design:type", String)
42
+ ], AnalyticsReport.prototype, "platform", void 0);
43
+ __decorate([
44
+ (0, typeorm_1.Column)({ name: 'period_start', type: 'date' }),
45
+ __metadata("design:type", Date)
46
+ ], AnalyticsReport.prototype, "periodStart", void 0);
47
+ __decorate([
48
+ (0, typeorm_1.Column)({ name: 'period_end', type: 'date' }),
49
+ __metadata("design:type", Date)
50
+ ], AnalyticsReport.prototype, "periodEnd", void 0);
51
+ __decorate([
52
+ (0, typeorm_1.Column)({ type: 'jsonb', default: {} }),
53
+ __metadata("design:type", Object)
54
+ ], AnalyticsReport.prototype, "data", void 0);
55
+ __decorate([
56
+ (0, typeorm_1.Column)({ name: 'computed_at', type: 'timestamp' }),
57
+ __metadata("design:type", Date)
58
+ ], AnalyticsReport.prototype, "computedAt", void 0);
59
+ __decorate([
60
+ (0, typeorm_1.CreateDateColumn)({ name: 'created_at' }),
61
+ __metadata("design:type", Date)
62
+ ], AnalyticsReport.prototype, "createdAt", void 0);
63
+ exports.AnalyticsReport = AnalyticsReport = __decorate([
64
+ (0, typeorm_1.Entity)('analytics_reports'),
65
+ (0, typeorm_1.Index)(['workspaceId', 'reportType', 'periodStart'])
66
+ ], AnalyticsReport);
@@ -44,3 +44,10 @@ export * from './asset-category.entity';
44
44
  export * from './project-brand-override.entity';
45
45
  export * from './ai-video-job.entity';
46
46
  export * from './ai-video-scene-task.entity';
47
+ export * from './social-account.entity';
48
+ export * from './platform-config.entity';
49
+ export * from './social-post.entity';
50
+ export * from './post-analytics-snapshot.entity';
51
+ export * from './account-analytics-summary.entity';
52
+ export * from './post-brand-analysis.entity';
53
+ export * from './analytics-report.entity';
@@ -62,3 +62,10 @@ __exportStar(require("./asset-category.entity"), exports);
62
62
  __exportStar(require("./project-brand-override.entity"), exports);
63
63
  __exportStar(require("./ai-video-job.entity"), exports);
64
64
  __exportStar(require("./ai-video-scene-task.entity"), exports);
65
+ __exportStar(require("./social-account.entity"), exports);
66
+ __exportStar(require("./platform-config.entity"), exports);
67
+ __exportStar(require("./social-post.entity"), exports);
68
+ __exportStar(require("./post-analytics-snapshot.entity"), exports);
69
+ __exportStar(require("./account-analytics-summary.entity"), exports);
70
+ __exportStar(require("./post-brand-analysis.entity"), exports);
71
+ __exportStar(require("./analytics-report.entity"), exports);
@@ -0,0 +1,16 @@
1
+ import { Workspace } from './workspace.entity';
2
+ import { SocialPlatform } from './social-account.entity';
3
+ export declare class PlatformConfig {
4
+ id: string;
5
+ workspaceId: string;
6
+ workspace: Workspace;
7
+ platform: SocialPlatform;
8
+ encryptedClientId: string | null;
9
+ encryptedClientSecret: string | null;
10
+ encryptedApiKey: string | null;
11
+ redirectUri: string | null;
12
+ scopes: string[] | null;
13
+ isActive: boolean;
14
+ createdAt: Date;
15
+ updatedAt: Date;
16
+ }
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.PlatformConfig = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const workspace_entity_1 = require("./workspace.entity");
15
+ const social_account_entity_1 = require("./social-account.entity");
16
+ let PlatformConfig = class PlatformConfig {
17
+ };
18
+ exports.PlatformConfig = PlatformConfig;
19
+ __decorate([
20
+ (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
21
+ __metadata("design:type", String)
22
+ ], PlatformConfig.prototype, "id", void 0);
23
+ __decorate([
24
+ (0, typeorm_1.Column)({ name: 'workspace_id', type: 'uuid' }),
25
+ __metadata("design:type", String)
26
+ ], PlatformConfig.prototype, "workspaceId", void 0);
27
+ __decorate([
28
+ (0, typeorm_1.ManyToOne)(() => workspace_entity_1.Workspace, { nullable: false }),
29
+ (0, typeorm_1.JoinColumn)({ name: 'workspace_id' }),
30
+ __metadata("design:type", workspace_entity_1.Workspace)
31
+ ], PlatformConfig.prototype, "workspace", void 0);
32
+ __decorate([
33
+ (0, typeorm_1.Column)({ type: 'enum', enum: social_account_entity_1.SocialPlatform }),
34
+ __metadata("design:type", String)
35
+ ], PlatformConfig.prototype, "platform", void 0);
36
+ __decorate([
37
+ (0, typeorm_1.Column)({ name: 'encrypted_client_id', type: 'text', nullable: true }),
38
+ __metadata("design:type", String)
39
+ ], PlatformConfig.prototype, "encryptedClientId", void 0);
40
+ __decorate([
41
+ (0, typeorm_1.Column)({ name: 'encrypted_client_secret', type: 'text', nullable: true }),
42
+ __metadata("design:type", String)
43
+ ], PlatformConfig.prototype, "encryptedClientSecret", void 0);
44
+ __decorate([
45
+ (0, typeorm_1.Column)({ name: 'encrypted_api_key', type: 'text', nullable: true }),
46
+ __metadata("design:type", String)
47
+ ], PlatformConfig.prototype, "encryptedApiKey", void 0);
48
+ __decorate([
49
+ (0, typeorm_1.Column)({ name: 'redirect_uri', type: 'text', nullable: true }),
50
+ __metadata("design:type", String)
51
+ ], PlatformConfig.prototype, "redirectUri", void 0);
52
+ __decorate([
53
+ (0, typeorm_1.Column)({ type: 'jsonb', nullable: true }),
54
+ __metadata("design:type", Array)
55
+ ], PlatformConfig.prototype, "scopes", void 0);
56
+ __decorate([
57
+ (0, typeorm_1.Column)({ name: 'is_active', type: 'boolean', default: true }),
58
+ __metadata("design:type", Boolean)
59
+ ], PlatformConfig.prototype, "isActive", void 0);
60
+ __decorate([
61
+ (0, typeorm_1.CreateDateColumn)({ name: 'created_at' }),
62
+ __metadata("design:type", Date)
63
+ ], PlatformConfig.prototype, "createdAt", void 0);
64
+ __decorate([
65
+ (0, typeorm_1.UpdateDateColumn)({ name: 'updated_at' }),
66
+ __metadata("design:type", Date)
67
+ ], PlatformConfig.prototype, "updatedAt", void 0);
68
+ exports.PlatformConfig = PlatformConfig = __decorate([
69
+ (0, typeorm_1.Entity)('platform_configs'),
70
+ (0, typeorm_1.Index)(['workspaceId']),
71
+ (0, typeorm_1.Unique)(['workspaceId', 'platform'])
72
+ ], PlatformConfig);
@@ -0,0 +1,33 @@
1
+ export declare class PostAnalyticsSnapshot {
2
+ id: string;
3
+ socialPostId: string;
4
+ workspaceId: string;
5
+ platform: string;
6
+ platformPostId: string;
7
+ views: number;
8
+ likes: number;
9
+ comments: number;
10
+ shares: number;
11
+ saves: number;
12
+ impressions: number;
13
+ reach: number;
14
+ watchTimeSeconds: number;
15
+ avgViewDurationSeconds: number;
16
+ avgViewPercentage: number;
17
+ subscribersGained: number;
18
+ subscribersLost: number;
19
+ profileVisits: number;
20
+ clicks: number;
21
+ ctr: number;
22
+ engagementRate: number;
23
+ platformRawMetrics: Record<string, any>;
24
+ audienceDemographics: {
25
+ ageGroups?: Record<string, number>;
26
+ genderSplit?: Record<string, number>;
27
+ topCountries?: Record<string, number>;
28
+ topCities?: Record<string, number>;
29
+ trafficSources?: Record<string, number>;
30
+ } | null;
31
+ snapshotTakenAt: Date;
32
+ createdAt: Date;
33
+ }
@@ -0,0 +1,122 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.PostAnalyticsSnapshot = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ let PostAnalyticsSnapshot = class PostAnalyticsSnapshot {
15
+ };
16
+ exports.PostAnalyticsSnapshot = PostAnalyticsSnapshot;
17
+ __decorate([
18
+ (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
19
+ __metadata("design:type", String)
20
+ ], PostAnalyticsSnapshot.prototype, "id", void 0);
21
+ __decorate([
22
+ (0, typeorm_1.Column)({ name: 'social_post_id', type: 'uuid' }),
23
+ __metadata("design:type", String)
24
+ ], PostAnalyticsSnapshot.prototype, "socialPostId", void 0);
25
+ __decorate([
26
+ (0, typeorm_1.Column)({ name: 'workspace_id', type: 'uuid' }),
27
+ __metadata("design:type", String)
28
+ ], PostAnalyticsSnapshot.prototype, "workspaceId", void 0);
29
+ __decorate([
30
+ (0, typeorm_1.Column)({ type: 'varchar', length: 50 }),
31
+ __metadata("design:type", String)
32
+ ], PostAnalyticsSnapshot.prototype, "platform", void 0);
33
+ __decorate([
34
+ (0, typeorm_1.Column)({ name: 'platform_post_id', type: 'varchar', length: 255 }),
35
+ __metadata("design:type", String)
36
+ ], PostAnalyticsSnapshot.prototype, "platformPostId", void 0);
37
+ __decorate([
38
+ (0, typeorm_1.Column)({ type: 'integer', default: 0 }),
39
+ __metadata("design:type", Number)
40
+ ], PostAnalyticsSnapshot.prototype, "views", void 0);
41
+ __decorate([
42
+ (0, typeorm_1.Column)({ type: 'integer', default: 0 }),
43
+ __metadata("design:type", Number)
44
+ ], PostAnalyticsSnapshot.prototype, "likes", void 0);
45
+ __decorate([
46
+ (0, typeorm_1.Column)({ type: 'integer', default: 0 }),
47
+ __metadata("design:type", Number)
48
+ ], PostAnalyticsSnapshot.prototype, "comments", void 0);
49
+ __decorate([
50
+ (0, typeorm_1.Column)({ type: 'integer', default: 0 }),
51
+ __metadata("design:type", Number)
52
+ ], PostAnalyticsSnapshot.prototype, "shares", void 0);
53
+ __decorate([
54
+ (0, typeorm_1.Column)({ type: 'integer', default: 0 }),
55
+ __metadata("design:type", Number)
56
+ ], PostAnalyticsSnapshot.prototype, "saves", void 0);
57
+ __decorate([
58
+ (0, typeorm_1.Column)({ type: 'integer', default: 0 }),
59
+ __metadata("design:type", Number)
60
+ ], PostAnalyticsSnapshot.prototype, "impressions", void 0);
61
+ __decorate([
62
+ (0, typeorm_1.Column)({ type: 'integer', default: 0 }),
63
+ __metadata("design:type", Number)
64
+ ], PostAnalyticsSnapshot.prototype, "reach", void 0);
65
+ __decorate([
66
+ (0, typeorm_1.Column)({ name: 'watch_time_seconds', type: 'integer', default: 0 }),
67
+ __metadata("design:type", Number)
68
+ ], PostAnalyticsSnapshot.prototype, "watchTimeSeconds", void 0);
69
+ __decorate([
70
+ (0, typeorm_1.Column)({ name: 'avg_view_duration_seconds', type: 'float', default: 0 }),
71
+ __metadata("design:type", Number)
72
+ ], PostAnalyticsSnapshot.prototype, "avgViewDurationSeconds", void 0);
73
+ __decorate([
74
+ (0, typeorm_1.Column)({ name: 'avg_view_percentage', type: 'float', default: 0 }),
75
+ __metadata("design:type", Number)
76
+ ], PostAnalyticsSnapshot.prototype, "avgViewPercentage", void 0);
77
+ __decorate([
78
+ (0, typeorm_1.Column)({ name: 'subscribers_gained', type: 'integer', default: 0 }),
79
+ __metadata("design:type", Number)
80
+ ], PostAnalyticsSnapshot.prototype, "subscribersGained", void 0);
81
+ __decorate([
82
+ (0, typeorm_1.Column)({ name: 'subscribers_lost', type: 'integer', default: 0 }),
83
+ __metadata("design:type", Number)
84
+ ], PostAnalyticsSnapshot.prototype, "subscribersLost", void 0);
85
+ __decorate([
86
+ (0, typeorm_1.Column)({ name: 'profile_visits', type: 'integer', default: 0 }),
87
+ __metadata("design:type", Number)
88
+ ], PostAnalyticsSnapshot.prototype, "profileVisits", void 0);
89
+ __decorate([
90
+ (0, typeorm_1.Column)({ type: 'integer', default: 0 }),
91
+ __metadata("design:type", Number)
92
+ ], PostAnalyticsSnapshot.prototype, "clicks", void 0);
93
+ __decorate([
94
+ (0, typeorm_1.Column)({ type: 'float', default: 0 }),
95
+ __metadata("design:type", Number)
96
+ ], PostAnalyticsSnapshot.prototype, "ctr", void 0);
97
+ __decorate([
98
+ (0, typeorm_1.Column)({ name: 'engagement_rate', type: 'float', default: 0 }),
99
+ __metadata("design:type", Number)
100
+ ], PostAnalyticsSnapshot.prototype, "engagementRate", void 0);
101
+ __decorate([
102
+ (0, typeorm_1.Column)({ name: 'platform_raw_metrics', type: 'jsonb', default: {} }),
103
+ __metadata("design:type", Object)
104
+ ], PostAnalyticsSnapshot.prototype, "platformRawMetrics", void 0);
105
+ __decorate([
106
+ (0, typeorm_1.Column)({ name: 'audience_demographics', type: 'jsonb', nullable: true }),
107
+ __metadata("design:type", Object)
108
+ ], PostAnalyticsSnapshot.prototype, "audienceDemographics", void 0);
109
+ __decorate([
110
+ (0, typeorm_1.Column)({ name: 'snapshot_taken_at', type: 'timestamp' }),
111
+ __metadata("design:type", Date)
112
+ ], PostAnalyticsSnapshot.prototype, "snapshotTakenAt", void 0);
113
+ __decorate([
114
+ (0, typeorm_1.CreateDateColumn)({ name: 'created_at' }),
115
+ __metadata("design:type", Date)
116
+ ], PostAnalyticsSnapshot.prototype, "createdAt", void 0);
117
+ exports.PostAnalyticsSnapshot = PostAnalyticsSnapshot = __decorate([
118
+ (0, typeorm_1.Entity)('post_analytics_snapshots'),
119
+ (0, typeorm_1.Index)(['socialPostId', 'snapshotTakenAt']),
120
+ (0, typeorm_1.Index)(['workspaceId', 'snapshotTakenAt']),
121
+ (0, typeorm_1.Index)(['workspaceId', 'platform', 'snapshotTakenAt'])
122
+ ], PostAnalyticsSnapshot);
@@ -0,0 +1,26 @@
1
+ import { SocialPost } from './social-post.entity';
2
+ export declare class PostBrandAnalysis {
3
+ id: string;
4
+ socialPostId: string;
5
+ workspaceId: string;
6
+ brandKitId: string;
7
+ brandComplianceScore: number;
8
+ usedBrandColors: boolean;
9
+ usedBrandFonts: boolean;
10
+ usedBrandLogo: boolean;
11
+ usedBrandWatermark: boolean;
12
+ offBrandElements: string[];
13
+ projectMetadataSnapshot: {
14
+ projectType?: string;
15
+ targetPlatform?: string;
16
+ clipCount?: number;
17
+ durationMs?: number;
18
+ hasMusic?: boolean;
19
+ hasCaptions?: boolean;
20
+ hasVoiceover?: boolean;
21
+ colorPalette?: string[];
22
+ fontFamilies?: string[];
23
+ } | null;
24
+ createdAt: Date;
25
+ socialPost: SocialPost;
26
+ }
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.PostBrandAnalysis = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const social_post_entity_1 = require("./social-post.entity");
15
+ let PostBrandAnalysis = class PostBrandAnalysis {
16
+ };
17
+ exports.PostBrandAnalysis = PostBrandAnalysis;
18
+ __decorate([
19
+ (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
20
+ __metadata("design:type", String)
21
+ ], PostBrandAnalysis.prototype, "id", void 0);
22
+ __decorate([
23
+ (0, typeorm_1.Column)({ name: 'social_post_id', type: 'uuid' }),
24
+ __metadata("design:type", String)
25
+ ], PostBrandAnalysis.prototype, "socialPostId", void 0);
26
+ __decorate([
27
+ (0, typeorm_1.Column)({ name: 'workspace_id', type: 'uuid' }),
28
+ __metadata("design:type", String)
29
+ ], PostBrandAnalysis.prototype, "workspaceId", void 0);
30
+ __decorate([
31
+ (0, typeorm_1.Column)({ name: 'brand_kit_id', type: 'uuid', nullable: true }),
32
+ __metadata("design:type", String)
33
+ ], PostBrandAnalysis.prototype, "brandKitId", void 0);
34
+ __decorate([
35
+ (0, typeorm_1.Column)({ name: 'brand_compliance_score', type: 'float', nullable: true }),
36
+ __metadata("design:type", Number)
37
+ ], PostBrandAnalysis.prototype, "brandComplianceScore", void 0);
38
+ __decorate([
39
+ (0, typeorm_1.Column)({ name: 'used_brand_colors', type: 'boolean', default: false }),
40
+ __metadata("design:type", Boolean)
41
+ ], PostBrandAnalysis.prototype, "usedBrandColors", void 0);
42
+ __decorate([
43
+ (0, typeorm_1.Column)({ name: 'used_brand_fonts', type: 'boolean', default: false }),
44
+ __metadata("design:type", Boolean)
45
+ ], PostBrandAnalysis.prototype, "usedBrandFonts", void 0);
46
+ __decorate([
47
+ (0, typeorm_1.Column)({ name: 'used_brand_logo', type: 'boolean', default: false }),
48
+ __metadata("design:type", Boolean)
49
+ ], PostBrandAnalysis.prototype, "usedBrandLogo", void 0);
50
+ __decorate([
51
+ (0, typeorm_1.Column)({ name: 'used_brand_watermark', type: 'boolean', default: false }),
52
+ __metadata("design:type", Boolean)
53
+ ], PostBrandAnalysis.prototype, "usedBrandWatermark", void 0);
54
+ __decorate([
55
+ (0, typeorm_1.Column)({ name: 'off_brand_elements', type: 'jsonb', default: [] }),
56
+ __metadata("design:type", Array)
57
+ ], PostBrandAnalysis.prototype, "offBrandElements", void 0);
58
+ __decorate([
59
+ (0, typeorm_1.Column)({ name: 'project_metadata_snapshot', type: 'jsonb', nullable: true }),
60
+ __metadata("design:type", Object)
61
+ ], PostBrandAnalysis.prototype, "projectMetadataSnapshot", void 0);
62
+ __decorate([
63
+ (0, typeorm_1.CreateDateColumn)({ name: 'created_at' }),
64
+ __metadata("design:type", Date)
65
+ ], PostBrandAnalysis.prototype, "createdAt", void 0);
66
+ __decorate([
67
+ (0, typeorm_1.ManyToOne)(() => social_post_entity_1.SocialPost),
68
+ (0, typeorm_1.JoinColumn)({ name: 'social_post_id' }),
69
+ __metadata("design:type", social_post_entity_1.SocialPost)
70
+ ], PostBrandAnalysis.prototype, "socialPost", void 0);
71
+ exports.PostBrandAnalysis = PostBrandAnalysis = __decorate([
72
+ (0, typeorm_1.Entity)('post_brand_analyses'),
73
+ (0, typeorm_1.Index)(['socialPostId']),
74
+ (0, typeorm_1.Index)(['workspaceId', 'brandKitId'])
75
+ ], PostBrandAnalysis);
@@ -0,0 +1,39 @@
1
+ import { Workspace } from './workspace.entity';
2
+ export declare enum SocialPlatform {
3
+ YOUTUBE = "YOUTUBE",
4
+ TIKTOK = "TIKTOK",
5
+ INSTAGRAM = "INSTAGRAM",
6
+ LINKEDIN = "LINKEDIN"
7
+ }
8
+ export declare enum AuthMethod {
9
+ OAUTH = "OAUTH",
10
+ API_KEY = "API_KEY"
11
+ }
12
+ export declare enum SocialAccountStatus {
13
+ ACTIVE = "active",
14
+ EXPIRED = "expired",
15
+ REVOKED = "revoked",
16
+ ERROR = "error"
17
+ }
18
+ export declare class SocialAccount {
19
+ id: string;
20
+ workspaceId: string;
21
+ workspace: Workspace;
22
+ connectedByUserId: string;
23
+ platform: SocialPlatform;
24
+ authMethod: AuthMethod;
25
+ platformAccountId: string;
26
+ platformAccountName: string | null;
27
+ platformProfileUrl: string | null;
28
+ platformAvatarUrl: string | null;
29
+ encryptedAccessToken: string | null;
30
+ encryptedRefreshToken: string | null;
31
+ encryptedApiKey: string | null;
32
+ tokenExpiresAt: Date | null;
33
+ platformMetadata: Record<string, unknown> | null;
34
+ status: SocialAccountStatus;
35
+ lastError: string | null;
36
+ lastSyncedAt: Date | null;
37
+ createdAt: Date;
38
+ updatedAt: Date;
39
+ }