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.
- package/dist/config/data-source.js +3 -6
- package/dist/entities/account-analytics-summary.entity.d.ts +17 -0
- package/dist/entities/account-analytics-summary.entity.js +82 -0
- package/dist/entities/analytics-report.entity.d.ts +20 -0
- package/dist/entities/analytics-report.entity.js +66 -0
- package/dist/entities/index.d.ts +7 -0
- package/dist/entities/index.js +7 -0
- package/dist/entities/platform-config.entity.d.ts +16 -0
- package/dist/entities/platform-config.entity.js +72 -0
- package/dist/entities/post-analytics-snapshot.entity.d.ts +33 -0
- package/dist/entities/post-analytics-snapshot.entity.js +122 -0
- package/dist/entities/post-brand-analysis.entity.d.ts +26 -0
- package/dist/entities/post-brand-analysis.entity.js +75 -0
- package/dist/entities/social-account.entity.d.ts +39 -0
- package/dist/entities/social-account.entity.js +131 -0
- package/dist/entities/social-post.entity.d.ts +45 -0
- package/dist/entities/social-post.entity.js +171 -0
- package/dist/migrations/1713000000000-Baseline.d.ts +6 -0
- package/dist/migrations/1713000000000-Baseline.js +13 -0
- package/dist/migrations/1713000000001-CreateSocialConnectionTables.d.ts +6 -0
- package/dist/migrations/1713000000001-CreateSocialConnectionTables.js +68 -0
- package/dist/migrations/1713000000002-AddIsActiveToWorkspaceMembers.d.ts +6 -0
- package/dist/migrations/1713000000002-AddIsActiveToWorkspaceMembers.js +36 -0
- package/dist/migrations/1713000000003-AddDescriptionToBrandKits.d.ts +6 -0
- package/dist/migrations/1713000000003-AddDescriptionToBrandKits.js +20 -0
- package/dist/repositories/account-analytics-summary.repository.d.ts +12 -0
- package/dist/repositories/account-analytics-summary.repository.js +55 -0
- package/dist/repositories/index.d.ts +5 -0
- package/dist/repositories/index.js +11 -1
- package/dist/repositories/platform-config.repository.d.ts +10 -0
- package/dist/repositories/platform-config.repository.js +43 -0
- package/dist/repositories/post-analytics-snapshot.repository.d.ts +9 -0
- package/dist/repositories/post-analytics-snapshot.repository.js +50 -0
- package/dist/repositories/repository.module.d.ts +1 -0
- package/dist/repositories/repository.module.js +16 -1
- package/dist/repositories/social-account.repository.d.ts +9 -0
- package/dist/repositories/social-account.repository.js +44 -0
- package/dist/repositories/social-post.repository.d.ts +17 -0
- package/dist/repositories/social-post.repository.js +91 -0
- package/package.json +12 -34
|
@@ -0,0 +1,131 @@
|
|
|
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.SocialAccount = exports.SocialAccountStatus = exports.AuthMethod = exports.SocialPlatform = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const workspace_entity_1 = require("./workspace.entity");
|
|
15
|
+
var SocialPlatform;
|
|
16
|
+
(function (SocialPlatform) {
|
|
17
|
+
SocialPlatform["YOUTUBE"] = "YOUTUBE";
|
|
18
|
+
SocialPlatform["TIKTOK"] = "TIKTOK";
|
|
19
|
+
SocialPlatform["INSTAGRAM"] = "INSTAGRAM";
|
|
20
|
+
SocialPlatform["LINKEDIN"] = "LINKEDIN";
|
|
21
|
+
})(SocialPlatform || (exports.SocialPlatform = SocialPlatform = {}));
|
|
22
|
+
var AuthMethod;
|
|
23
|
+
(function (AuthMethod) {
|
|
24
|
+
AuthMethod["OAUTH"] = "OAUTH";
|
|
25
|
+
AuthMethod["API_KEY"] = "API_KEY";
|
|
26
|
+
})(AuthMethod || (exports.AuthMethod = AuthMethod = {}));
|
|
27
|
+
var SocialAccountStatus;
|
|
28
|
+
(function (SocialAccountStatus) {
|
|
29
|
+
SocialAccountStatus["ACTIVE"] = "active";
|
|
30
|
+
SocialAccountStatus["EXPIRED"] = "expired";
|
|
31
|
+
SocialAccountStatus["REVOKED"] = "revoked";
|
|
32
|
+
SocialAccountStatus["ERROR"] = "error";
|
|
33
|
+
})(SocialAccountStatus || (exports.SocialAccountStatus = SocialAccountStatus = {}));
|
|
34
|
+
let SocialAccount = class SocialAccount {
|
|
35
|
+
};
|
|
36
|
+
exports.SocialAccount = SocialAccount;
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
39
|
+
__metadata("design:type", String)
|
|
40
|
+
], SocialAccount.prototype, "id", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, typeorm_1.Column)({ name: 'workspace_id', type: 'uuid' }),
|
|
43
|
+
__metadata("design:type", String)
|
|
44
|
+
], SocialAccount.prototype, "workspaceId", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, typeorm_1.ManyToOne)(() => workspace_entity_1.Workspace, { nullable: false }),
|
|
47
|
+
(0, typeorm_1.JoinColumn)({ name: 'workspace_id' }),
|
|
48
|
+
__metadata("design:type", workspace_entity_1.Workspace)
|
|
49
|
+
], SocialAccount.prototype, "workspace", void 0);
|
|
50
|
+
__decorate([
|
|
51
|
+
(0, typeorm_1.Column)({ name: 'connected_by_user_id', type: 'uuid' }),
|
|
52
|
+
__metadata("design:type", String)
|
|
53
|
+
], SocialAccount.prototype, "connectedByUserId", void 0);
|
|
54
|
+
__decorate([
|
|
55
|
+
(0, typeorm_1.Column)({ type: 'enum', enum: SocialPlatform }),
|
|
56
|
+
__metadata("design:type", String)
|
|
57
|
+
], SocialAccount.prototype, "platform", void 0);
|
|
58
|
+
__decorate([
|
|
59
|
+
(0, typeorm_1.Column)({ name: 'auth_method', type: 'enum', enum: AuthMethod }),
|
|
60
|
+
__metadata("design:type", String)
|
|
61
|
+
], SocialAccount.prototype, "authMethod", void 0);
|
|
62
|
+
__decorate([
|
|
63
|
+
(0, typeorm_1.Column)({ name: 'platform_account_id', type: 'varchar', length: 255 }),
|
|
64
|
+
__metadata("design:type", String)
|
|
65
|
+
], SocialAccount.prototype, "platformAccountId", void 0);
|
|
66
|
+
__decorate([
|
|
67
|
+
(0, typeorm_1.Column)({
|
|
68
|
+
name: 'platform_account_name',
|
|
69
|
+
type: 'varchar',
|
|
70
|
+
length: 255,
|
|
71
|
+
nullable: true,
|
|
72
|
+
}),
|
|
73
|
+
__metadata("design:type", String)
|
|
74
|
+
], SocialAccount.prototype, "platformAccountName", void 0);
|
|
75
|
+
__decorate([
|
|
76
|
+
(0, typeorm_1.Column)({ name: 'platform_profile_url', type: 'text', nullable: true }),
|
|
77
|
+
__metadata("design:type", String)
|
|
78
|
+
], SocialAccount.prototype, "platformProfileUrl", void 0);
|
|
79
|
+
__decorate([
|
|
80
|
+
(0, typeorm_1.Column)({ name: 'platform_avatar_url', type: 'text', nullable: true }),
|
|
81
|
+
__metadata("design:type", String)
|
|
82
|
+
], SocialAccount.prototype, "platformAvatarUrl", void 0);
|
|
83
|
+
__decorate([
|
|
84
|
+
(0, typeorm_1.Column)({ name: 'encrypted_access_token', type: 'text', nullable: true }),
|
|
85
|
+
__metadata("design:type", String)
|
|
86
|
+
], SocialAccount.prototype, "encryptedAccessToken", void 0);
|
|
87
|
+
__decorate([
|
|
88
|
+
(0, typeorm_1.Column)({ name: 'encrypted_refresh_token', type: 'text', nullable: true }),
|
|
89
|
+
__metadata("design:type", String)
|
|
90
|
+
], SocialAccount.prototype, "encryptedRefreshToken", void 0);
|
|
91
|
+
__decorate([
|
|
92
|
+
(0, typeorm_1.Column)({ name: 'encrypted_api_key', type: 'text', nullable: true }),
|
|
93
|
+
__metadata("design:type", String)
|
|
94
|
+
], SocialAccount.prototype, "encryptedApiKey", void 0);
|
|
95
|
+
__decorate([
|
|
96
|
+
(0, typeorm_1.Column)({ name: 'token_expires_at', type: 'timestamp', nullable: true }),
|
|
97
|
+
__metadata("design:type", Date)
|
|
98
|
+
], SocialAccount.prototype, "tokenExpiresAt", void 0);
|
|
99
|
+
__decorate([
|
|
100
|
+
(0, typeorm_1.Column)({ name: 'platform_metadata', type: 'jsonb', nullable: true }),
|
|
101
|
+
__metadata("design:type", Object)
|
|
102
|
+
], SocialAccount.prototype, "platformMetadata", void 0);
|
|
103
|
+
__decorate([
|
|
104
|
+
(0, typeorm_1.Column)({
|
|
105
|
+
type: 'enum',
|
|
106
|
+
enum: SocialAccountStatus,
|
|
107
|
+
default: SocialAccountStatus.ACTIVE,
|
|
108
|
+
}),
|
|
109
|
+
__metadata("design:type", String)
|
|
110
|
+
], SocialAccount.prototype, "status", void 0);
|
|
111
|
+
__decorate([
|
|
112
|
+
(0, typeorm_1.Column)({ name: 'last_error', type: 'text', nullable: true }),
|
|
113
|
+
__metadata("design:type", String)
|
|
114
|
+
], SocialAccount.prototype, "lastError", void 0);
|
|
115
|
+
__decorate([
|
|
116
|
+
(0, typeorm_1.Column)({ name: 'last_synced_at', type: 'timestamp', nullable: true }),
|
|
117
|
+
__metadata("design:type", Date)
|
|
118
|
+
], SocialAccount.prototype, "lastSyncedAt", void 0);
|
|
119
|
+
__decorate([
|
|
120
|
+
(0, typeorm_1.CreateDateColumn)({ name: 'created_at' }),
|
|
121
|
+
__metadata("design:type", Date)
|
|
122
|
+
], SocialAccount.prototype, "createdAt", void 0);
|
|
123
|
+
__decorate([
|
|
124
|
+
(0, typeorm_1.UpdateDateColumn)({ name: 'updated_at' }),
|
|
125
|
+
__metadata("design:type", Date)
|
|
126
|
+
], SocialAccount.prototype, "updatedAt", void 0);
|
|
127
|
+
exports.SocialAccount = SocialAccount = __decorate([
|
|
128
|
+
(0, typeorm_1.Entity)('social_accounts'),
|
|
129
|
+
(0, typeorm_1.Index)(['workspaceId']),
|
|
130
|
+
(0, typeorm_1.Index)(['workspaceId', 'platform'])
|
|
131
|
+
], SocialAccount);
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Workspace } from './workspace.entity';
|
|
2
|
+
import { SocialAccount, SocialPlatform } from './social-account.entity';
|
|
3
|
+
export { SocialPlatform } from './social-account.entity';
|
|
4
|
+
export declare enum SocialPostStatus {
|
|
5
|
+
PENDING = "pending",
|
|
6
|
+
UPLOADING = "uploading",
|
|
7
|
+
PROCESSING = "processing",
|
|
8
|
+
SCHEDULED = "scheduled",
|
|
9
|
+
PUBLISHED = "published",
|
|
10
|
+
FAILED = "failed",
|
|
11
|
+
CANCELLED = "cancelled"
|
|
12
|
+
}
|
|
13
|
+
export declare enum SocialPostVisibility {
|
|
14
|
+
PUBLIC = "public",
|
|
15
|
+
PRIVATE = "private",
|
|
16
|
+
UNLISTED = "unlisted",
|
|
17
|
+
DRAFT = "draft"
|
|
18
|
+
}
|
|
19
|
+
export declare class SocialPost {
|
|
20
|
+
id: string;
|
|
21
|
+
workspaceId: string;
|
|
22
|
+
workspace: Workspace;
|
|
23
|
+
userId: string;
|
|
24
|
+
socialAccountId: string;
|
|
25
|
+
socialAccount: SocialAccount;
|
|
26
|
+
projectId: string | null;
|
|
27
|
+
videoRenderId: string | null;
|
|
28
|
+
platform: SocialPlatform;
|
|
29
|
+
title: string | null;
|
|
30
|
+
description: string | null;
|
|
31
|
+
tags: string[] | null;
|
|
32
|
+
visibility: string | null;
|
|
33
|
+
thumbnailS3Key: string | null;
|
|
34
|
+
platformSpecificOptions: Record<string, unknown> | null;
|
|
35
|
+
scheduledAt: Date | null;
|
|
36
|
+
status: SocialPostStatus;
|
|
37
|
+
platformPostId: string | null;
|
|
38
|
+
platformPostUrl: string | null;
|
|
39
|
+
lastError: string | null;
|
|
40
|
+
retryCount: number;
|
|
41
|
+
publishedAt: Date | null;
|
|
42
|
+
creditReservationId: string | null;
|
|
43
|
+
createdAt: Date;
|
|
44
|
+
updatedAt: Date;
|
|
45
|
+
}
|
|
@@ -0,0 +1,171 @@
|
|
|
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.SocialPost = exports.SocialPostVisibility = exports.SocialPostStatus = exports.SocialPlatform = 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
|
+
var social_account_entity_2 = require("./social-account.entity");
|
|
17
|
+
Object.defineProperty(exports, "SocialPlatform", { enumerable: true, get: function () { return social_account_entity_2.SocialPlatform; } });
|
|
18
|
+
var SocialPostStatus;
|
|
19
|
+
(function (SocialPostStatus) {
|
|
20
|
+
SocialPostStatus["PENDING"] = "pending";
|
|
21
|
+
SocialPostStatus["UPLOADING"] = "uploading";
|
|
22
|
+
SocialPostStatus["PROCESSING"] = "processing";
|
|
23
|
+
SocialPostStatus["SCHEDULED"] = "scheduled";
|
|
24
|
+
SocialPostStatus["PUBLISHED"] = "published";
|
|
25
|
+
SocialPostStatus["FAILED"] = "failed";
|
|
26
|
+
SocialPostStatus["CANCELLED"] = "cancelled";
|
|
27
|
+
})(SocialPostStatus || (exports.SocialPostStatus = SocialPostStatus = {}));
|
|
28
|
+
var SocialPostVisibility;
|
|
29
|
+
(function (SocialPostVisibility) {
|
|
30
|
+
SocialPostVisibility["PUBLIC"] = "public";
|
|
31
|
+
SocialPostVisibility["PRIVATE"] = "private";
|
|
32
|
+
SocialPostVisibility["UNLISTED"] = "unlisted";
|
|
33
|
+
SocialPostVisibility["DRAFT"] = "draft";
|
|
34
|
+
})(SocialPostVisibility || (exports.SocialPostVisibility = SocialPostVisibility = {}));
|
|
35
|
+
let SocialPost = class SocialPost {
|
|
36
|
+
};
|
|
37
|
+
exports.SocialPost = SocialPost;
|
|
38
|
+
__decorate([
|
|
39
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
40
|
+
__metadata("design:type", String)
|
|
41
|
+
], SocialPost.prototype, "id", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
(0, typeorm_1.Column)({ name: 'workspace_id', type: 'uuid' }),
|
|
44
|
+
__metadata("design:type", String)
|
|
45
|
+
], SocialPost.prototype, "workspaceId", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
(0, typeorm_1.ManyToOne)(() => workspace_entity_1.Workspace, { nullable: false }),
|
|
48
|
+
(0, typeorm_1.JoinColumn)({ name: 'workspace_id' }),
|
|
49
|
+
__metadata("design:type", workspace_entity_1.Workspace)
|
|
50
|
+
], SocialPost.prototype, "workspace", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
(0, typeorm_1.Column)({ name: 'user_id', type: 'uuid' }),
|
|
53
|
+
__metadata("design:type", String)
|
|
54
|
+
], SocialPost.prototype, "userId", void 0);
|
|
55
|
+
__decorate([
|
|
56
|
+
(0, typeorm_1.Column)({ name: 'social_account_id', type: 'uuid' }),
|
|
57
|
+
__metadata("design:type", String)
|
|
58
|
+
], SocialPost.prototype, "socialAccountId", void 0);
|
|
59
|
+
__decorate([
|
|
60
|
+
(0, typeorm_1.ManyToOne)(() => social_account_entity_1.SocialAccount, { nullable: false }),
|
|
61
|
+
(0, typeorm_1.JoinColumn)({ name: 'social_account_id' }),
|
|
62
|
+
__metadata("design:type", social_account_entity_1.SocialAccount)
|
|
63
|
+
], SocialPost.prototype, "socialAccount", void 0);
|
|
64
|
+
__decorate([
|
|
65
|
+
(0, typeorm_1.Column)({ name: 'project_id', type: 'varchar', length: 255, nullable: true }),
|
|
66
|
+
__metadata("design:type", String)
|
|
67
|
+
], SocialPost.prototype, "projectId", void 0);
|
|
68
|
+
__decorate([
|
|
69
|
+
(0, typeorm_1.Column)({
|
|
70
|
+
name: 'video_render_id',
|
|
71
|
+
type: 'varchar',
|
|
72
|
+
length: 255,
|
|
73
|
+
nullable: true,
|
|
74
|
+
}),
|
|
75
|
+
__metadata("design:type", String)
|
|
76
|
+
], SocialPost.prototype, "videoRenderId", void 0);
|
|
77
|
+
__decorate([
|
|
78
|
+
(0, typeorm_1.Column)({ type: 'enum', enum: social_account_entity_1.SocialPlatform }),
|
|
79
|
+
__metadata("design:type", String)
|
|
80
|
+
], SocialPost.prototype, "platform", void 0);
|
|
81
|
+
__decorate([
|
|
82
|
+
(0, typeorm_1.Column)({ type: 'varchar', length: 500, nullable: true }),
|
|
83
|
+
__metadata("design:type", String)
|
|
84
|
+
], SocialPost.prototype, "title", void 0);
|
|
85
|
+
__decorate([
|
|
86
|
+
(0, typeorm_1.Column)({ type: 'text', nullable: true }),
|
|
87
|
+
__metadata("design:type", String)
|
|
88
|
+
], SocialPost.prototype, "description", void 0);
|
|
89
|
+
__decorate([
|
|
90
|
+
(0, typeorm_1.Column)({ type: 'jsonb', nullable: true }),
|
|
91
|
+
__metadata("design:type", Array)
|
|
92
|
+
], SocialPost.prototype, "tags", void 0);
|
|
93
|
+
__decorate([
|
|
94
|
+
(0, typeorm_1.Column)({ name: 'visibility', type: 'varchar', length: 50, nullable: true }),
|
|
95
|
+
__metadata("design:type", String)
|
|
96
|
+
], SocialPost.prototype, "visibility", void 0);
|
|
97
|
+
__decorate([
|
|
98
|
+
(0, typeorm_1.Column)({
|
|
99
|
+
name: 'thumbnail_s3_key',
|
|
100
|
+
type: 'varchar',
|
|
101
|
+
length: 500,
|
|
102
|
+
nullable: true,
|
|
103
|
+
}),
|
|
104
|
+
__metadata("design:type", String)
|
|
105
|
+
], SocialPost.prototype, "thumbnailS3Key", void 0);
|
|
106
|
+
__decorate([
|
|
107
|
+
(0, typeorm_1.Column)({ name: 'platform_specific_options', type: 'jsonb', nullable: true }),
|
|
108
|
+
__metadata("design:type", Object)
|
|
109
|
+
], SocialPost.prototype, "platformSpecificOptions", void 0);
|
|
110
|
+
__decorate([
|
|
111
|
+
(0, typeorm_1.Column)({ name: 'scheduled_at', type: 'timestamp', nullable: true }),
|
|
112
|
+
__metadata("design:type", Date)
|
|
113
|
+
], SocialPost.prototype, "scheduledAt", void 0);
|
|
114
|
+
__decorate([
|
|
115
|
+
(0, typeorm_1.Column)({
|
|
116
|
+
type: 'enum',
|
|
117
|
+
enum: SocialPostStatus,
|
|
118
|
+
default: SocialPostStatus.PENDING,
|
|
119
|
+
}),
|
|
120
|
+
__metadata("design:type", String)
|
|
121
|
+
], SocialPost.prototype, "status", void 0);
|
|
122
|
+
__decorate([
|
|
123
|
+
(0, typeorm_1.Column)({
|
|
124
|
+
name: 'platform_post_id',
|
|
125
|
+
type: 'varchar',
|
|
126
|
+
length: 255,
|
|
127
|
+
nullable: true,
|
|
128
|
+
}),
|
|
129
|
+
__metadata("design:type", String)
|
|
130
|
+
], SocialPost.prototype, "platformPostId", void 0);
|
|
131
|
+
__decorate([
|
|
132
|
+
(0, typeorm_1.Column)({ name: 'platform_post_url', type: 'text', nullable: true }),
|
|
133
|
+
__metadata("design:type", String)
|
|
134
|
+
], SocialPost.prototype, "platformPostUrl", void 0);
|
|
135
|
+
__decorate([
|
|
136
|
+
(0, typeorm_1.Column)({ name: 'last_error', type: 'text', nullable: true }),
|
|
137
|
+
__metadata("design:type", String)
|
|
138
|
+
], SocialPost.prototype, "lastError", void 0);
|
|
139
|
+
__decorate([
|
|
140
|
+
(0, typeorm_1.Column)({ name: 'retry_count', type: 'int', default: 0 }),
|
|
141
|
+
__metadata("design:type", Number)
|
|
142
|
+
], SocialPost.prototype, "retryCount", void 0);
|
|
143
|
+
__decorate([
|
|
144
|
+
(0, typeorm_1.Column)({ name: 'published_at', type: 'timestamp', nullable: true }),
|
|
145
|
+
__metadata("design:type", Date)
|
|
146
|
+
], SocialPost.prototype, "publishedAt", void 0);
|
|
147
|
+
__decorate([
|
|
148
|
+
(0, typeorm_1.Column)({
|
|
149
|
+
name: 'credit_reservation_id',
|
|
150
|
+
type: 'varchar',
|
|
151
|
+
length: 255,
|
|
152
|
+
nullable: true,
|
|
153
|
+
}),
|
|
154
|
+
__metadata("design:type", String)
|
|
155
|
+
], SocialPost.prototype, "creditReservationId", void 0);
|
|
156
|
+
__decorate([
|
|
157
|
+
(0, typeorm_1.CreateDateColumn)({ name: 'created_at' }),
|
|
158
|
+
__metadata("design:type", Date)
|
|
159
|
+
], SocialPost.prototype, "createdAt", void 0);
|
|
160
|
+
__decorate([
|
|
161
|
+
(0, typeorm_1.UpdateDateColumn)({ name: 'updated_at' }),
|
|
162
|
+
__metadata("design:type", Date)
|
|
163
|
+
], SocialPost.prototype, "updatedAt", void 0);
|
|
164
|
+
exports.SocialPost = SocialPost = __decorate([
|
|
165
|
+
(0, typeorm_1.Entity)('social_posts'),
|
|
166
|
+
(0, typeorm_1.Index)(['workspaceId']),
|
|
167
|
+
(0, typeorm_1.Index)(['socialAccountId']),
|
|
168
|
+
(0, typeorm_1.Index)(['projectId']),
|
|
169
|
+
(0, typeorm_1.Index)(['status']),
|
|
170
|
+
(0, typeorm_1.Index)(['workspaceId', 'publishedAt'])
|
|
171
|
+
], SocialPost);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Baseline1713000000000 = void 0;
|
|
4
|
+
class Baseline1713000000000 {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.name = 'Baseline1713000000000';
|
|
7
|
+
}
|
|
8
|
+
async up(_queryRunner) {
|
|
9
|
+
}
|
|
10
|
+
async down(_queryRunner) {
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.Baseline1713000000000 = Baseline1713000000000;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from 'typeorm';
|
|
2
|
+
export declare class CreateSocialConnectionTables1713000000001 implements MigrationInterface {
|
|
3
|
+
name: string;
|
|
4
|
+
up(queryRunner: QueryRunner): Promise<void>;
|
|
5
|
+
down(queryRunner: QueryRunner): Promise<void>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CreateSocialConnectionTables1713000000001 = void 0;
|
|
4
|
+
class CreateSocialConnectionTables1713000000001 {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.name = 'CreateSocialConnectionTables1713000000001';
|
|
7
|
+
}
|
|
8
|
+
async up(queryRunner) {
|
|
9
|
+
await queryRunner.query(`
|
|
10
|
+
CREATE TABLE IF NOT EXISTS social_accounts (
|
|
11
|
+
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
12
|
+
workspace_id UUID NOT NULL REFERENCES workspaces(id) ON DELETE CASCADE,
|
|
13
|
+
connected_by_user_id UUID NOT NULL,
|
|
14
|
+
platform VARCHAR(50) NOT NULL,
|
|
15
|
+
auth_method VARCHAR(20) NOT NULL,
|
|
16
|
+
platform_account_id VARCHAR(255) NOT NULL,
|
|
17
|
+
platform_account_name VARCHAR(255),
|
|
18
|
+
platform_profile_url TEXT,
|
|
19
|
+
platform_avatar_url TEXT,
|
|
20
|
+
encrypted_access_token TEXT,
|
|
21
|
+
encrypted_refresh_token TEXT,
|
|
22
|
+
encrypted_api_key TEXT,
|
|
23
|
+
token_expires_at TIMESTAMP WITH TIME ZONE,
|
|
24
|
+
platform_metadata JSONB,
|
|
25
|
+
status VARCHAR(20) NOT NULL DEFAULT 'active',
|
|
26
|
+
last_error TEXT,
|
|
27
|
+
last_synced_at TIMESTAMP WITH TIME ZONE,
|
|
28
|
+
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
|
|
29
|
+
updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
|
|
30
|
+
)
|
|
31
|
+
`);
|
|
32
|
+
await queryRunner.query(`
|
|
33
|
+
CREATE INDEX IF NOT EXISTS idx_social_accounts_workspace_id
|
|
34
|
+
ON social_accounts(workspace_id)
|
|
35
|
+
`);
|
|
36
|
+
await queryRunner.query(`
|
|
37
|
+
CREATE INDEX IF NOT EXISTS idx_social_accounts_workspace_platform
|
|
38
|
+
ON social_accounts(workspace_id, platform)
|
|
39
|
+
`);
|
|
40
|
+
await queryRunner.query(`
|
|
41
|
+
CREATE TABLE IF NOT EXISTS platform_configs (
|
|
42
|
+
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
43
|
+
workspace_id UUID NOT NULL REFERENCES workspaces(id) ON DELETE CASCADE,
|
|
44
|
+
platform VARCHAR(50) NOT NULL,
|
|
45
|
+
encrypted_client_id TEXT,
|
|
46
|
+
encrypted_client_secret TEXT,
|
|
47
|
+
encrypted_api_key TEXT,
|
|
48
|
+
redirect_uri TEXT,
|
|
49
|
+
scopes JSONB,
|
|
50
|
+
is_active BOOLEAN NOT NULL DEFAULT TRUE,
|
|
51
|
+
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
|
|
52
|
+
updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
|
|
53
|
+
CONSTRAINT uq_platform_configs_workspace_platform UNIQUE (workspace_id, platform)
|
|
54
|
+
)
|
|
55
|
+
`);
|
|
56
|
+
await queryRunner.query(`
|
|
57
|
+
CREATE INDEX IF NOT EXISTS idx_platform_configs_workspace_id
|
|
58
|
+
ON platform_configs(workspace_id)
|
|
59
|
+
`);
|
|
60
|
+
await queryRunner.query(`ALTER TABLE social_accounts ENABLE ROW LEVEL SECURITY`);
|
|
61
|
+
await queryRunner.query(`ALTER TABLE platform_configs ENABLE ROW LEVEL SECURITY`);
|
|
62
|
+
}
|
|
63
|
+
async down(queryRunner) {
|
|
64
|
+
await queryRunner.query(`DROP TABLE IF EXISTS platform_configs`);
|
|
65
|
+
await queryRunner.query(`DROP TABLE IF EXISTS social_accounts`);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.CreateSocialConnectionTables1713000000001 = CreateSocialConnectionTables1713000000001;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from 'typeorm';
|
|
2
|
+
export declare class AddIsActiveToWorkspaceMembers1713000000002 implements MigrationInterface {
|
|
3
|
+
name: string;
|
|
4
|
+
up(queryRunner: QueryRunner): Promise<void>;
|
|
5
|
+
down(queryRunner: QueryRunner): Promise<void>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AddIsActiveToWorkspaceMembers1713000000002 = void 0;
|
|
4
|
+
class AddIsActiveToWorkspaceMembers1713000000002 {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.name = 'AddIsActiveToWorkspaceMembers1713000000002';
|
|
7
|
+
}
|
|
8
|
+
async up(queryRunner) {
|
|
9
|
+
await queryRunner.query(`
|
|
10
|
+
ALTER TABLE workspace_members
|
|
11
|
+
ADD COLUMN IF NOT EXISTS is_active BOOLEAN NOT NULL DEFAULT TRUE
|
|
12
|
+
`);
|
|
13
|
+
await queryRunner.query(`
|
|
14
|
+
UPDATE workspace_members
|
|
15
|
+
SET is_active = (status = 'active')
|
|
16
|
+
WHERE is_active IS DISTINCT FROM (status = 'active')
|
|
17
|
+
`);
|
|
18
|
+
await queryRunner.query(`
|
|
19
|
+
CREATE INDEX IF NOT EXISTS idx_workspace_members_is_active
|
|
20
|
+
ON workspace_members(is_active)
|
|
21
|
+
`);
|
|
22
|
+
await queryRunner.query(`
|
|
23
|
+
COMMENT ON COLUMN workspace_members.is_active
|
|
24
|
+
IS 'Whether this membership is active (derived from status for backwards compat)'
|
|
25
|
+
`);
|
|
26
|
+
}
|
|
27
|
+
async down(queryRunner) {
|
|
28
|
+
await queryRunner.query(`
|
|
29
|
+
DROP INDEX IF EXISTS idx_workspace_members_is_active
|
|
30
|
+
`);
|
|
31
|
+
await queryRunner.query(`
|
|
32
|
+
ALTER TABLE workspace_members DROP COLUMN IF EXISTS is_active
|
|
33
|
+
`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.AddIsActiveToWorkspaceMembers1713000000002 = AddIsActiveToWorkspaceMembers1713000000002;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AddDescriptionToBrandKits1713000000003 = void 0;
|
|
4
|
+
class AddDescriptionToBrandKits1713000000003 {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.name = 'AddDescriptionToBrandKits1713000000003';
|
|
7
|
+
}
|
|
8
|
+
async up(queryRunner) {
|
|
9
|
+
await queryRunner.query(`
|
|
10
|
+
ALTER TABLE brand_kits
|
|
11
|
+
ADD COLUMN IF NOT EXISTS description TEXT
|
|
12
|
+
`);
|
|
13
|
+
}
|
|
14
|
+
async down(queryRunner) {
|
|
15
|
+
await queryRunner.query(`
|
|
16
|
+
ALTER TABLE brand_kits DROP COLUMN IF EXISTS description
|
|
17
|
+
`);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.AddDescriptionToBrandKits1713000000003 = AddDescriptionToBrandKits1713000000003;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DataSource, Repository } from 'typeorm';
|
|
2
|
+
import { AccountAnalyticsSummary } from '../entities/account-analytics-summary.entity';
|
|
3
|
+
export declare class AccountAnalyticsSummaryRepository extends Repository<AccountAnalyticsSummary> {
|
|
4
|
+
private dataSource;
|
|
5
|
+
constructor(dataSource: DataSource);
|
|
6
|
+
findByAccountInRange(socialAccountId: string, startDate: string, endDate: string): Promise<AccountAnalyticsSummary[]>;
|
|
7
|
+
findByWorkspaceInRange(workspaceId: string, startDate: string, endDate: string): Promise<AccountAnalyticsSummary[]>;
|
|
8
|
+
upsertForDate(data: Partial<AccountAnalyticsSummary> & {
|
|
9
|
+
socialAccountId: string;
|
|
10
|
+
date: string;
|
|
11
|
+
}): Promise<AccountAnalyticsSummary>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
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.AccountAnalyticsSummaryRepository = void 0;
|
|
13
|
+
const common_1 = require("@nestjs/common");
|
|
14
|
+
const typeorm_1 = require("typeorm");
|
|
15
|
+
const account_analytics_summary_entity_1 = require("../entities/account-analytics-summary.entity");
|
|
16
|
+
let AccountAnalyticsSummaryRepository = class AccountAnalyticsSummaryRepository extends typeorm_1.Repository {
|
|
17
|
+
constructor(dataSource) {
|
|
18
|
+
super(account_analytics_summary_entity_1.AccountAnalyticsSummary, dataSource.createEntityManager());
|
|
19
|
+
this.dataSource = dataSource;
|
|
20
|
+
}
|
|
21
|
+
async findByAccountInRange(socialAccountId, startDate, endDate) {
|
|
22
|
+
return this.find({
|
|
23
|
+
where: {
|
|
24
|
+
socialAccountId,
|
|
25
|
+
date: (0, typeorm_1.Between)(startDate, endDate),
|
|
26
|
+
},
|
|
27
|
+
order: { date: 'ASC' },
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
async findByWorkspaceInRange(workspaceId, startDate, endDate) {
|
|
31
|
+
return this.find({
|
|
32
|
+
where: {
|
|
33
|
+
workspaceId,
|
|
34
|
+
date: (0, typeorm_1.Between)(startDate, endDate),
|
|
35
|
+
},
|
|
36
|
+
order: { date: 'ASC' },
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
async upsertForDate(data) {
|
|
40
|
+
const existing = await this.findOne({
|
|
41
|
+
where: { socialAccountId: data.socialAccountId, date: data.date },
|
|
42
|
+
});
|
|
43
|
+
if (existing) {
|
|
44
|
+
Object.assign(existing, data);
|
|
45
|
+
return this.save(existing);
|
|
46
|
+
}
|
|
47
|
+
const entity = this.create(data);
|
|
48
|
+
return this.save(entity);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
exports.AccountAnalyticsSummaryRepository = AccountAnalyticsSummaryRepository;
|
|
52
|
+
exports.AccountAnalyticsSummaryRepository = AccountAnalyticsSummaryRepository = __decorate([
|
|
53
|
+
(0, common_1.Injectable)(),
|
|
54
|
+
__metadata("design:paramtypes", [typeorm_1.DataSource])
|
|
55
|
+
], AccountAnalyticsSummaryRepository);
|
|
@@ -43,3 +43,8 @@ export { AssetCategoryRepository } from './asset-category.repository';
|
|
|
43
43
|
export { ProjectBrandOverrideRepository } from './project-brand-override.repository';
|
|
44
44
|
export { AiVideoJobRepository } from './ai-video-job.repository';
|
|
45
45
|
export { AiVideoSceneTaskRepository } from './ai-video-scene-task.repository';
|
|
46
|
+
export { SocialAccountRepository } from './social-account.repository';
|
|
47
|
+
export { PlatformConfigRepository } from './platform-config.repository';
|
|
48
|
+
export { SocialPostRepository } from './social-post.repository';
|
|
49
|
+
export { PostAnalyticsSnapshotRepository } from './post-analytics-snapshot.repository';
|
|
50
|
+
export { AccountAnalyticsSummaryRepository } from './account-analytics-summary.repository';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AiVideoSceneTaskRepository = exports.AiVideoJobRepository = exports.ProjectBrandOverrideRepository = exports.AssetCategoryRepository = exports.BrandAssetRepository = exports.BrandKitRepository = exports.ProjectShareRepository = exports.RemotionRenderRepository = exports.ItemRepository = exports.SceneRepository = exports.ProjectSceneRepository = exports.MetadataActivityLogRepository = exports.AiEmbeddingRepository = exports.UserContextRepository = exports.ProjectMetadataRepository = exports.AssetMetadataRepository = exports.AudioWaveformRepository = exports.VideoFilmstripRepository = exports.VideoSubtitleRepository = exports.VideoRenderRepository = exports.VideoTranscodeRepository = exports.EffectRepository = exports.AssetRepository = exports.AiUsageRepository = exports.ReferralEventRepository = exports.RewardRuleRepository = exports.PlanCreditConfigurationRepository = exports.CreditTransactionRepository = exports.CreditAllocationRepository = exports.StripeWebhookRepository = exports.PaymentTransactionRepository = exports.SubscriptionUsageRepository = exports.UserSubscriptionRepository = exports.PlanRepository = exports.SubscriptionPlanRepository = exports.CommentRepository = exports.EditorProjectRepository = exports.InviteRepository = exports.WorkspaceMemberRepository = exports.WorkspaceRepository = exports.AuthSessionRepository = exports.UserOnboardingRepository = exports.UserProfileRepository = exports.UserRepository = exports.BaseRepository = void 0;
|
|
3
|
+
exports.AccountAnalyticsSummaryRepository = exports.PostAnalyticsSnapshotRepository = exports.SocialPostRepository = exports.PlatformConfigRepository = exports.SocialAccountRepository = exports.AiVideoSceneTaskRepository = exports.AiVideoJobRepository = exports.ProjectBrandOverrideRepository = exports.AssetCategoryRepository = exports.BrandAssetRepository = exports.BrandKitRepository = exports.ProjectShareRepository = exports.RemotionRenderRepository = exports.ItemRepository = exports.SceneRepository = exports.ProjectSceneRepository = exports.MetadataActivityLogRepository = exports.AiEmbeddingRepository = exports.UserContextRepository = exports.ProjectMetadataRepository = exports.AssetMetadataRepository = exports.AudioWaveformRepository = exports.VideoFilmstripRepository = exports.VideoSubtitleRepository = exports.VideoRenderRepository = exports.VideoTranscodeRepository = exports.EffectRepository = exports.AssetRepository = exports.AiUsageRepository = exports.ReferralEventRepository = exports.RewardRuleRepository = exports.PlanCreditConfigurationRepository = exports.CreditTransactionRepository = exports.CreditAllocationRepository = exports.StripeWebhookRepository = exports.PaymentTransactionRepository = exports.SubscriptionUsageRepository = exports.UserSubscriptionRepository = exports.PlanRepository = exports.SubscriptionPlanRepository = exports.CommentRepository = exports.EditorProjectRepository = exports.InviteRepository = exports.WorkspaceMemberRepository = exports.WorkspaceRepository = exports.AuthSessionRepository = exports.UserOnboardingRepository = exports.UserProfileRepository = exports.UserRepository = exports.BaseRepository = void 0;
|
|
4
4
|
var base_repository_1 = require("./base.repository");
|
|
5
5
|
Object.defineProperty(exports, "BaseRepository", { enumerable: true, get: function () { return base_repository_1.BaseRepository; } });
|
|
6
6
|
var user_repository_1 = require("./user.repository");
|
|
@@ -91,3 +91,13 @@ var ai_video_job_repository_1 = require("./ai-video-job.repository");
|
|
|
91
91
|
Object.defineProperty(exports, "AiVideoJobRepository", { enumerable: true, get: function () { return ai_video_job_repository_1.AiVideoJobRepository; } });
|
|
92
92
|
var ai_video_scene_task_repository_1 = require("./ai-video-scene-task.repository");
|
|
93
93
|
Object.defineProperty(exports, "AiVideoSceneTaskRepository", { enumerable: true, get: function () { return ai_video_scene_task_repository_1.AiVideoSceneTaskRepository; } });
|
|
94
|
+
var social_account_repository_1 = require("./social-account.repository");
|
|
95
|
+
Object.defineProperty(exports, "SocialAccountRepository", { enumerable: true, get: function () { return social_account_repository_1.SocialAccountRepository; } });
|
|
96
|
+
var platform_config_repository_1 = require("./platform-config.repository");
|
|
97
|
+
Object.defineProperty(exports, "PlatformConfigRepository", { enumerable: true, get: function () { return platform_config_repository_1.PlatformConfigRepository; } });
|
|
98
|
+
var social_post_repository_1 = require("./social-post.repository");
|
|
99
|
+
Object.defineProperty(exports, "SocialPostRepository", { enumerable: true, get: function () { return social_post_repository_1.SocialPostRepository; } });
|
|
100
|
+
var post_analytics_snapshot_repository_1 = require("./post-analytics-snapshot.repository");
|
|
101
|
+
Object.defineProperty(exports, "PostAnalyticsSnapshotRepository", { enumerable: true, get: function () { return post_analytics_snapshot_repository_1.PostAnalyticsSnapshotRepository; } });
|
|
102
|
+
var account_analytics_summary_repository_1 = require("./account-analytics-summary.repository");
|
|
103
|
+
Object.defineProperty(exports, "AccountAnalyticsSummaryRepository", { enumerable: true, get: function () { return account_analytics_summary_repository_1.AccountAnalyticsSummaryRepository; } });
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Repository } from 'typeorm';
|
|
2
|
+
import { BaseRepository } from './base.repository';
|
|
3
|
+
import { PlatformConfig } from '../entities/platform-config.entity';
|
|
4
|
+
import { SocialPlatform } from '../entities/social-account.entity';
|
|
5
|
+
export declare class PlatformConfigRepository extends BaseRepository<PlatformConfig> {
|
|
6
|
+
private readonly platformConfigRepository;
|
|
7
|
+
constructor(platformConfigRepository: Repository<PlatformConfig>);
|
|
8
|
+
findByWorkspace(workspaceId: string): Promise<PlatformConfig[]>;
|
|
9
|
+
findByWorkspaceAndPlatform(workspaceId: string, platform: SocialPlatform): Promise<PlatformConfig | null>;
|
|
10
|
+
}
|