clhq-postgres-module 1.1.0-alpha.169 → 1.1.0-alpha.171
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/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/entities/workspace-member.entity.js +1 -1
- 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 +1 -1
|
@@ -0,0 +1,44 @@
|
|
|
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
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.SocialAccountRepository = void 0;
|
|
16
|
+
const typeorm_1 = require("typeorm");
|
|
17
|
+
const common_1 = require("@nestjs/common");
|
|
18
|
+
const typeorm_2 = require("@nestjs/typeorm");
|
|
19
|
+
const base_repository_1 = require("./base.repository");
|
|
20
|
+
const social_account_entity_1 = require("../entities/social-account.entity");
|
|
21
|
+
let SocialAccountRepository = class SocialAccountRepository extends base_repository_1.BaseRepository {
|
|
22
|
+
constructor(socialAccountRepository) {
|
|
23
|
+
super(socialAccountRepository);
|
|
24
|
+
this.socialAccountRepository = socialAccountRepository;
|
|
25
|
+
}
|
|
26
|
+
async findByWorkspace(workspaceId) {
|
|
27
|
+
return this.socialAccountRepository.find({
|
|
28
|
+
where: { workspaceId },
|
|
29
|
+
order: { createdAt: 'DESC' },
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
async findByWorkspaceAndPlatform(workspaceId, platform) {
|
|
33
|
+
return this.socialAccountRepository.find({
|
|
34
|
+
where: { workspaceId, platform },
|
|
35
|
+
order: { createdAt: 'DESC' },
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
exports.SocialAccountRepository = SocialAccountRepository;
|
|
40
|
+
exports.SocialAccountRepository = SocialAccountRepository = __decorate([
|
|
41
|
+
(0, common_1.Injectable)(),
|
|
42
|
+
__param(0, (0, typeorm_2.InjectRepository)(social_account_entity_1.SocialAccount)),
|
|
43
|
+
__metadata("design:paramtypes", [typeorm_1.Repository])
|
|
44
|
+
], SocialAccountRepository);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Repository } from 'typeorm';
|
|
2
|
+
import { BaseRepository } from './base.repository';
|
|
3
|
+
import { SocialPost, SocialPostStatus, SocialPlatform } from '../entities/social-post.entity';
|
|
4
|
+
export interface SocialPostFilters {
|
|
5
|
+
platform?: SocialPlatform;
|
|
6
|
+
status?: SocialPostStatus;
|
|
7
|
+
startDate?: Date;
|
|
8
|
+
endDate?: Date;
|
|
9
|
+
}
|
|
10
|
+
export declare class SocialPostRepository extends BaseRepository<SocialPost> {
|
|
11
|
+
private readonly socialPostRepository;
|
|
12
|
+
constructor(socialPostRepository: Repository<SocialPost>);
|
|
13
|
+
findByWorkspace(workspaceId: string, filters?: SocialPostFilters, limit?: number, offset?: number): Promise<SocialPost[]>;
|
|
14
|
+
findByAccount(socialAccountId: string): Promise<SocialPost[]>;
|
|
15
|
+
countByWorkspaceThisMonth(workspaceId: string): Promise<number>;
|
|
16
|
+
findById(id: string): Promise<SocialPost | null>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
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
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.SocialPostRepository = void 0;
|
|
16
|
+
const typeorm_1 = require("typeorm");
|
|
17
|
+
const common_1 = require("@nestjs/common");
|
|
18
|
+
const typeorm_2 = require("@nestjs/typeorm");
|
|
19
|
+
const base_repository_1 = require("./base.repository");
|
|
20
|
+
const social_post_entity_1 = require("../entities/social-post.entity");
|
|
21
|
+
let SocialPostRepository = class SocialPostRepository extends base_repository_1.BaseRepository {
|
|
22
|
+
constructor(socialPostRepository) {
|
|
23
|
+
super(socialPostRepository);
|
|
24
|
+
this.socialPostRepository = socialPostRepository;
|
|
25
|
+
}
|
|
26
|
+
async findByWorkspace(workspaceId, filters, limit = 20, offset = 0) {
|
|
27
|
+
const where = { workspaceId };
|
|
28
|
+
if (filters?.platform) {
|
|
29
|
+
where.platform = filters.platform;
|
|
30
|
+
}
|
|
31
|
+
if (filters?.status) {
|
|
32
|
+
where.status = filters.status;
|
|
33
|
+
}
|
|
34
|
+
const query = this.socialPostRepository
|
|
35
|
+
.createQueryBuilder('post')
|
|
36
|
+
.where('post.workspace_id = :workspaceId', { workspaceId });
|
|
37
|
+
if (filters?.platform) {
|
|
38
|
+
query.andWhere('post.platform = :platform', {
|
|
39
|
+
platform: filters.platform,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
if (filters?.status) {
|
|
43
|
+
query.andWhere('post.status = :status', { status: filters.status });
|
|
44
|
+
}
|
|
45
|
+
if (filters?.startDate) {
|
|
46
|
+
query.andWhere('post.created_at >= :startDate', {
|
|
47
|
+
startDate: filters.startDate,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
if (filters?.endDate) {
|
|
51
|
+
query.andWhere('post.created_at <= :endDate', {
|
|
52
|
+
endDate: filters.endDate,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
return query
|
|
56
|
+
.orderBy('post.created_at', 'DESC')
|
|
57
|
+
.skip(offset)
|
|
58
|
+
.take(limit)
|
|
59
|
+
.getMany();
|
|
60
|
+
}
|
|
61
|
+
async findByAccount(socialAccountId) {
|
|
62
|
+
return this.socialPostRepository.find({
|
|
63
|
+
where: { socialAccountId },
|
|
64
|
+
order: { createdAt: 'DESC' },
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
async countByWorkspaceThisMonth(workspaceId) {
|
|
68
|
+
const startOfMonth = new Date();
|
|
69
|
+
startOfMonth.setDate(1);
|
|
70
|
+
startOfMonth.setHours(0, 0, 0, 0);
|
|
71
|
+
return this.socialPostRepository.count({
|
|
72
|
+
where: {
|
|
73
|
+
workspaceId,
|
|
74
|
+
status: social_post_entity_1.SocialPostStatus.PUBLISHED,
|
|
75
|
+
publishedAt: undefined,
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
async findById(id) {
|
|
80
|
+
return this.socialPostRepository.findOne({
|
|
81
|
+
where: { id },
|
|
82
|
+
relations: ['socialAccount', 'workspace'],
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
exports.SocialPostRepository = SocialPostRepository;
|
|
87
|
+
exports.SocialPostRepository = SocialPostRepository = __decorate([
|
|
88
|
+
(0, common_1.Injectable)(),
|
|
89
|
+
__param(0, (0, typeorm_2.InjectRepository)(social_post_entity_1.SocialPost)),
|
|
90
|
+
__metadata("design:paramtypes", [typeorm_1.Repository])
|
|
91
|
+
], SocialPostRepository);
|