@venturialstd/social-network 0.0.1
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/constants/content-element.constant.d.ts +14 -0
- package/dist/constants/content-element.constant.d.ts.map +1 -0
- package/dist/constants/content-element.constant.js +18 -0
- package/dist/constants/content-element.constant.js.map +1 -0
- package/dist/constants/feed.constant.d.ts +6 -0
- package/dist/constants/feed.constant.d.ts.map +1 -0
- package/dist/constants/feed.constant.js +9 -0
- package/dist/constants/feed.constant.js.map +1 -0
- package/dist/constants/social-network.constant.d.ts +32 -0
- package/dist/constants/social-network.constant.d.ts.map +1 -0
- package/dist/constants/social-network.constant.js +41 -0
- package/dist/constants/social-network.constant.js.map +1 -0
- package/dist/entities/comment.entity.d.ts +13 -0
- package/dist/entities/comment.entity.d.ts.map +1 -0
- package/dist/entities/comment.entity.js +93 -0
- package/dist/entities/comment.entity.js.map +1 -0
- package/dist/entities/content-hashtag.entity.d.ts +9 -0
- package/dist/entities/content-hashtag.entity.d.ts.map +1 -0
- package/dist/entities/content-hashtag.entity.js +63 -0
- package/dist/entities/content-hashtag.entity.js.map +1 -0
- package/dist/entities/content-music.entity.d.ts +13 -0
- package/dist/entities/content-music.entity.d.ts.map +1 -0
- package/dist/entities/content-music.entity.js +95 -0
- package/dist/entities/content-music.entity.js.map +1 -0
- package/dist/entities/content-tagged-place.entity.d.ts +9 -0
- package/dist/entities/content-tagged-place.entity.d.ts.map +1 -0
- package/dist/entities/content-tagged-place.entity.js +62 -0
- package/dist/entities/content-tagged-place.entity.js.map +1 -0
- package/dist/entities/content-tagged-user.entity.d.ts +9 -0
- package/dist/entities/content-tagged-user.entity.d.ts.map +1 -0
- package/dist/entities/content-tagged-user.entity.js +62 -0
- package/dist/entities/content-tagged-user.entity.js.map +1 -0
- package/dist/entities/follow.entity.d.ts +8 -0
- package/dist/entities/follow.entity.d.ts.map +1 -0
- package/dist/entities/follow.entity.js +55 -0
- package/dist/entities/follow.entity.js.map +1 -0
- package/dist/entities/friend-request.entity.d.ts +12 -0
- package/dist/entities/friend-request.entity.d.ts.map +1 -0
- package/dist/entities/friend-request.entity.js +87 -0
- package/dist/entities/friend-request.entity.js.map +1 -0
- package/dist/entities/friendship.entity.d.ts +12 -0
- package/dist/entities/friendship.entity.d.ts.map +1 -0
- package/dist/entities/friendship.entity.js +88 -0
- package/dist/entities/friendship.entity.js.map +1 -0
- package/dist/entities/post.entity.d.ts +14 -0
- package/dist/entities/post.entity.d.ts.map +1 -0
- package/dist/entities/post.entity.js +99 -0
- package/dist/entities/post.entity.js.map +1 -0
- package/dist/entities/reaction.entity.d.ts +11 -0
- package/dist/entities/reaction.entity.d.ts.map +1 -0
- package/dist/entities/reaction.entity.js +79 -0
- package/dist/entities/reaction.entity.js.map +1 -0
- package/dist/entities/reel.entity.d.ts +13 -0
- package/dist/entities/reel.entity.d.ts.map +1 -0
- package/dist/entities/reel.entity.js +94 -0
- package/dist/entities/reel.entity.js.map +1 -0
- package/dist/entities/save.entity.d.ts +10 -0
- package/dist/entities/save.entity.d.ts.map +1 -0
- package/dist/entities/save.entity.js +64 -0
- package/dist/entities/save.entity.js.map +1 -0
- package/dist/entities/story.entity.d.ts +13 -0
- package/dist/entities/story.entity.d.ts.map +1 -0
- package/dist/entities/story.entity.js +87 -0
- package/dist/entities/story.entity.js.map +1 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +51 -0
- package/dist/index.js.map +1 -0
- package/dist/services/comment.service.d.ts +20 -0
- package/dist/services/comment.service.d.ts.map +1 -0
- package/dist/services/comment.service.js +74 -0
- package/dist/services/comment.service.js.map +1 -0
- package/dist/services/content-hashtag.service.d.ts +23 -0
- package/dist/services/content-hashtag.service.d.ts.map +1 -0
- package/dist/services/content-hashtag.service.js +84 -0
- package/dist/services/content-hashtag.service.js.map +1 -0
- package/dist/services/content-music.service.d.ts +26 -0
- package/dist/services/content-music.service.d.ts.map +1 -0
- package/dist/services/content-music.service.js +100 -0
- package/dist/services/content-music.service.js.map +1 -0
- package/dist/services/content-tagged-place.service.d.ts +16 -0
- package/dist/services/content-tagged-place.service.d.ts.map +1 -0
- package/dist/services/content-tagged-place.service.js +66 -0
- package/dist/services/content-tagged-place.service.js.map +1 -0
- package/dist/services/content-tagged-user.service.d.ts +16 -0
- package/dist/services/content-tagged-user.service.d.ts.map +1 -0
- package/dist/services/content-tagged-user.service.js +66 -0
- package/dist/services/content-tagged-user.service.js.map +1 -0
- package/dist/services/feed.service.d.ts +14 -0
- package/dist/services/feed.service.d.ts.map +1 -0
- package/dist/services/feed.service.js +135 -0
- package/dist/services/feed.service.js.map +1 -0
- package/dist/services/follow.service.d.ts +21 -0
- package/dist/services/follow.service.d.ts.map +1 -0
- package/dist/services/follow.service.js +78 -0
- package/dist/services/follow.service.js.map +1 -0
- package/dist/services/friend-request.service.d.ts +16 -0
- package/dist/services/friend-request.service.d.ts.map +1 -0
- package/dist/services/friend-request.service.js +106 -0
- package/dist/services/friend-request.service.js.map +1 -0
- package/dist/services/friendship.service.d.ts +17 -0
- package/dist/services/friendship.service.d.ts.map +1 -0
- package/dist/services/friendship.service.js +79 -0
- package/dist/services/friendship.service.js.map +1 -0
- package/dist/services/post.service.d.ts +10 -0
- package/dist/services/post.service.d.ts.map +1 -0
- package/dist/services/post.service.js +48 -0
- package/dist/services/post.service.js.map +1 -0
- package/dist/services/reaction.service.d.ts +19 -0
- package/dist/services/reaction.service.d.ts.map +1 -0
- package/dist/services/reaction.service.js +88 -0
- package/dist/services/reaction.service.js.map +1 -0
- package/dist/services/reel.service.d.ts +8 -0
- package/dist/services/reel.service.d.ts.map +1 -0
- package/dist/services/reel.service.js +34 -0
- package/dist/services/reel.service.js.map +1 -0
- package/dist/services/save.service.d.ts +17 -0
- package/dist/services/save.service.d.ts.map +1 -0
- package/dist/services/save.service.js +65 -0
- package/dist/services/save.service.js.map +1 -0
- package/dist/services/story.service.d.ts +14 -0
- package/dist/services/story.service.d.ts.map +1 -0
- package/dist/services/story.service.js +50 -0
- package/dist/services/story.service.js.map +1 -0
- package/dist/social-network.module.d.ts +3 -0
- package/dist/social-network.module.d.ts.map +1 -0
- package/dist/social-network.module.js +80 -0
- package/dist/social-network.module.js.map +1 -0
- package/dist/types/content-element.types.d.ts +84 -0
- package/dist/types/content-element.types.d.ts.map +1 -0
- package/dist/types/content-element.types.js +3 -0
- package/dist/types/content-element.types.js.map +1 -0
- package/dist/types/content-music.types.d.ts +8 -0
- package/dist/types/content-music.types.d.ts.map +1 -0
- package/dist/types/content-music.types.js +3 -0
- package/dist/types/content-music.types.js.map +1 -0
- package/dist/types/feed.types.d.ts +28 -0
- package/dist/types/feed.types.d.ts.map +1 -0
- package/dist/types/feed.types.js +3 -0
- package/dist/types/feed.types.js.map +1 -0
- package/package.json +37 -0
|
@@ -0,0 +1,64 @@
|
|
|
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.Save = void 0;
|
|
13
|
+
const class_validator_1 = require("class-validator");
|
|
14
|
+
const typeorm_1 = require("typeorm");
|
|
15
|
+
const social_network_constant_1 = require("../constants/social-network.constant");
|
|
16
|
+
let Save = class Save {
|
|
17
|
+
id;
|
|
18
|
+
userId;
|
|
19
|
+
targetType;
|
|
20
|
+
targetId;
|
|
21
|
+
metadata;
|
|
22
|
+
createdAt;
|
|
23
|
+
};
|
|
24
|
+
exports.Save = Save;
|
|
25
|
+
__decorate([
|
|
26
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
27
|
+
__metadata("design:type", String)
|
|
28
|
+
], Save.prototype, "id", void 0);
|
|
29
|
+
__decorate([
|
|
30
|
+
(0, typeorm_1.Column)({ type: 'uuid' }),
|
|
31
|
+
(0, typeorm_1.Index)(),
|
|
32
|
+
__metadata("design:type", String)
|
|
33
|
+
], Save.prototype, "userId", void 0);
|
|
34
|
+
__decorate([
|
|
35
|
+
(0, typeorm_1.Column)({
|
|
36
|
+
type: 'enum',
|
|
37
|
+
enum: social_network_constant_1.ContentTargetType,
|
|
38
|
+
}),
|
|
39
|
+
__metadata("design:type", String)
|
|
40
|
+
], Save.prototype, "targetType", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, typeorm_1.Column)({ type: 'uuid' }),
|
|
43
|
+
__metadata("design:type", String)
|
|
44
|
+
], Save.prototype, "targetId", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, class_validator_1.IsOptional)(),
|
|
47
|
+
(0, typeorm_1.Column)({ type: 'jsonb', nullable: true }),
|
|
48
|
+
__metadata("design:type", Object)
|
|
49
|
+
], Save.prototype, "metadata", void 0);
|
|
50
|
+
__decorate([
|
|
51
|
+
(0, typeorm_1.CreateDateColumn)({
|
|
52
|
+
name: 'createdAt',
|
|
53
|
+
nullable: false,
|
|
54
|
+
type: 'timestamptz',
|
|
55
|
+
default: () => 'CURRENT_TIMESTAMP',
|
|
56
|
+
}),
|
|
57
|
+
__metadata("design:type", Date)
|
|
58
|
+
], Save.prototype, "createdAt", void 0);
|
|
59
|
+
exports.Save = Save = __decorate([
|
|
60
|
+
(0, typeorm_1.Entity)('social_save'),
|
|
61
|
+
(0, typeorm_1.Index)(['userId', 'targetType', 'targetId'], { unique: true }),
|
|
62
|
+
(0, typeorm_1.Index)(['userId'])
|
|
63
|
+
], Save);
|
|
64
|
+
//# sourceMappingURL=save.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"save.entity.js","sourceRoot":"","sources":["../../src/entities/save.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAyD;AACzD,qCAMiB;AAEjB,kFAAyE;AAKlE,IAAM,IAAI,GAAV,MAAM,IAAI;IAEf,EAAE,CAAS;IAIX,MAAM,CAAS;IAMf,UAAU,CAAoB;IAG9B,QAAQ,CAAS;IAIjB,QAAQ,CAA0B;IAQlC,SAAS,CAAO;CACjB,CAAA;AA5BY,oBAAI;AAEf;IADC,IAAA,gCAAsB,EAAC,MAAM,CAAC;;gCACpB;AAIX;IAFC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IACxB,IAAA,eAAK,GAAE;;oCACO;AAMf;IAJC,IAAA,gBAAM,EAAC;QACN,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,2CAAiB;KACxB,CAAC;;wCAC4B;AAG9B;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;sCACR;AAIjB;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;sCACR;AAQlC;IANC,IAAA,0BAAgB,EAAC;QAChB,IAAI,EAAE,WAAW;QACjB,QAAQ,EAAE,KAAK;QACf,IAAI,EAAE,aAAa;QACnB,OAAO,EAAE,GAAG,EAAE,CAAC,mBAAmB;KACnC,CAAC;8BACS,IAAI;uCAAC;eA3BL,IAAI;IAHhB,IAAA,gBAAM,EAAC,aAAa,CAAC;IACrB,IAAA,eAAK,EAAC,CAAC,QAAQ,EAAE,YAAY,EAAE,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IAC7D,IAAA,eAAK,EAAC,CAAC,QAAQ,CAAC,CAAC;GACL,IAAI,CA4BhB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { StoryMediaType } from '../constants/social-network.constant';
|
|
2
|
+
export declare class Story {
|
|
3
|
+
id: string;
|
|
4
|
+
userId: string;
|
|
5
|
+
mediaUrl: string;
|
|
6
|
+
mediaType: StoryMediaType;
|
|
7
|
+
caption: string;
|
|
8
|
+
elements: Record<string, unknown>[];
|
|
9
|
+
expiresAt: Date;
|
|
10
|
+
metadata: Record<string, unknown>;
|
|
11
|
+
createdAt: Date;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=story.entity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"story.entity.d.ts","sourceRoot":"","sources":["../../src/entities/story.entity.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAEtE,qBAEa,KAAK;IAEhB,EAAE,EAAE,MAAM,CAAC;IAMX,MAAM,EAAE,MAAM,CAAC;IAKf,QAAQ,EAAE,MAAM,CAAC;IAQjB,SAAS,EAAE,cAAc,CAAC;IAK1B,OAAO,EAAE,MAAM,CAAC;IAShB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IAMpC,SAAS,EAAE,IAAI,CAAC;IAIhB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAQlC,SAAS,EAAE,IAAI,CAAC;CACjB"}
|
|
@@ -0,0 +1,87 @@
|
|
|
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.Story = void 0;
|
|
13
|
+
const class_validator_1 = require("class-validator");
|
|
14
|
+
const typeorm_1 = require("typeorm");
|
|
15
|
+
const social_network_constant_1 = require("../constants/social-network.constant");
|
|
16
|
+
let Story = class Story {
|
|
17
|
+
id;
|
|
18
|
+
userId;
|
|
19
|
+
mediaUrl;
|
|
20
|
+
mediaType;
|
|
21
|
+
caption;
|
|
22
|
+
elements;
|
|
23
|
+
expiresAt;
|
|
24
|
+
metadata;
|
|
25
|
+
createdAt;
|
|
26
|
+
};
|
|
27
|
+
exports.Story = Story;
|
|
28
|
+
__decorate([
|
|
29
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
30
|
+
__metadata("design:type", String)
|
|
31
|
+
], Story.prototype, "id", void 0);
|
|
32
|
+
__decorate([
|
|
33
|
+
(0, class_validator_1.IsString)(),
|
|
34
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
35
|
+
(0, typeorm_1.Column)({ type: 'uuid' }),
|
|
36
|
+
(0, typeorm_1.Index)(),
|
|
37
|
+
__metadata("design:type", String)
|
|
38
|
+
], Story.prototype, "userId", void 0);
|
|
39
|
+
__decorate([
|
|
40
|
+
(0, class_validator_1.IsString)(),
|
|
41
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
42
|
+
(0, typeorm_1.Column)(),
|
|
43
|
+
__metadata("design:type", String)
|
|
44
|
+
], Story.prototype, "mediaUrl", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, class_validator_1.IsString)(),
|
|
47
|
+
(0, typeorm_1.Column)({
|
|
48
|
+
type: 'enum',
|
|
49
|
+
enum: social_network_constant_1.StoryMediaType,
|
|
50
|
+
default: social_network_constant_1.StoryMediaType.IMAGE,
|
|
51
|
+
}),
|
|
52
|
+
__metadata("design:type", String)
|
|
53
|
+
], Story.prototype, "mediaType", void 0);
|
|
54
|
+
__decorate([
|
|
55
|
+
(0, class_validator_1.IsString)(),
|
|
56
|
+
(0, class_validator_1.IsOptional)(),
|
|
57
|
+
(0, typeorm_1.Column)({ type: 'text', nullable: true }),
|
|
58
|
+
__metadata("design:type", String)
|
|
59
|
+
], Story.prototype, "caption", void 0);
|
|
60
|
+
__decorate([
|
|
61
|
+
(0, class_validator_1.IsOptional)(),
|
|
62
|
+
(0, typeorm_1.Column)({ type: 'jsonb', nullable: true, default: [] }),
|
|
63
|
+
__metadata("design:type", Array)
|
|
64
|
+
], Story.prototype, "elements", void 0);
|
|
65
|
+
__decorate([
|
|
66
|
+
(0, typeorm_1.Column)({ type: 'timestamptz' }),
|
|
67
|
+
__metadata("design:type", Date)
|
|
68
|
+
], Story.prototype, "expiresAt", void 0);
|
|
69
|
+
__decorate([
|
|
70
|
+
(0, class_validator_1.IsOptional)(),
|
|
71
|
+
(0, typeorm_1.Column)({ type: 'jsonb', nullable: true }),
|
|
72
|
+
__metadata("design:type", Object)
|
|
73
|
+
], Story.prototype, "metadata", void 0);
|
|
74
|
+
__decorate([
|
|
75
|
+
(0, typeorm_1.CreateDateColumn)({
|
|
76
|
+
name: 'createdAt',
|
|
77
|
+
nullable: false,
|
|
78
|
+
type: 'timestamptz',
|
|
79
|
+
default: () => 'CURRENT_TIMESTAMP',
|
|
80
|
+
}),
|
|
81
|
+
__metadata("design:type", Date)
|
|
82
|
+
], Story.prototype, "createdAt", void 0);
|
|
83
|
+
exports.Story = Story = __decorate([
|
|
84
|
+
(0, typeorm_1.Entity)('social_story'),
|
|
85
|
+
(0, typeorm_1.Index)(['userId', 'createdAt'])
|
|
86
|
+
], Story);
|
|
87
|
+
//# sourceMappingURL=story.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"story.entity.js","sourceRoot":"","sources":["../../src/entities/story.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAmE;AACnE,qCAMiB;AAEjB,kFAAsE;AAI/D,IAAM,KAAK,GAAX,MAAM,KAAK;IAEhB,EAAE,CAAS;IAMX,MAAM,CAAS;IAKf,QAAQ,CAAS;IAQjB,SAAS,CAAiB;IAK1B,OAAO,CAAS;IAShB,QAAQ,CAA4B;IAMpC,SAAS,CAAO;IAIhB,QAAQ,CAA0B;IAQlC,SAAS,CAAO;CACjB,CAAA;AAtDY,sBAAK;AAEhB;IADC,IAAA,gCAAsB,EAAC,MAAM,CAAC;;iCACpB;AAMX;IAJC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;IACZ,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IACxB,IAAA,eAAK,GAAE;;qCACO;AAKf;IAHC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;IACZ,IAAA,gBAAM,GAAE;;uCACQ;AAQjB;IANC,IAAA,0BAAQ,GAAE;IACV,IAAA,gBAAM,EAAC;QACN,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,wCAAc;QACpB,OAAO,EAAE,wCAAc,CAAC,KAAK;KAC9B,CAAC;;wCACwB;AAK1B;IAHC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;IACZ,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;sCACzB;AAShB;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;uCACnB;AAMpC;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;8BACrB,IAAI;wCAAC;AAIhB;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;uCACR;AAQlC;IANC,IAAA,0BAAgB,EAAC;QAChB,IAAI,EAAE,WAAW;QACjB,QAAQ,EAAE,KAAK;QACf,IAAI,EAAE,aAAa;QACnB,OAAO,EAAE,GAAG,EAAE,CAAC,mBAAmB;KACnC,CAAC;8BACS,IAAI;wCAAC;gBArDL,KAAK;IAFjB,IAAA,gBAAM,EAAC,cAAc,CAAC;IACtB,IAAA,eAAK,EAAC,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;GAClB,KAAK,CAsDjB"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export * from './constants/content-element.constant';
|
|
2
|
+
export * from './constants/feed.constant';
|
|
3
|
+
export * from './constants/social-network.constant';
|
|
4
|
+
export * from './entities/comment.entity';
|
|
5
|
+
export * from './entities/content-hashtag.entity';
|
|
6
|
+
export * from './entities/content-music.entity';
|
|
7
|
+
export * from './entities/content-tagged-place.entity';
|
|
8
|
+
export * from './entities/content-tagged-user.entity';
|
|
9
|
+
export * from './entities/follow.entity';
|
|
10
|
+
export * from './entities/friend-request.entity';
|
|
11
|
+
export * from './entities/friendship.entity';
|
|
12
|
+
export * from './entities/post.entity';
|
|
13
|
+
export * from './entities/reaction.entity';
|
|
14
|
+
export * from './entities/reel.entity';
|
|
15
|
+
export * from './entities/save.entity';
|
|
16
|
+
export * from './entities/story.entity';
|
|
17
|
+
export * from './services/comment.service';
|
|
18
|
+
export * from './services/content-hashtag.service';
|
|
19
|
+
export * from './services/feed.service';
|
|
20
|
+
export * from './services/content-music.service';
|
|
21
|
+
export * from './services/content-tagged-place.service';
|
|
22
|
+
export * from './services/content-tagged-user.service';
|
|
23
|
+
export * from './services/follow.service';
|
|
24
|
+
export * from './services/friend-request.service';
|
|
25
|
+
export * from './services/friendship.service';
|
|
26
|
+
export * from './services/post.service';
|
|
27
|
+
export * from './services/reaction.service';
|
|
28
|
+
export * from './services/reel.service';
|
|
29
|
+
export * from './services/save.service';
|
|
30
|
+
export * from './services/story.service';
|
|
31
|
+
export * from './social-network.module';
|
|
32
|
+
export * from './types/content-element.types';
|
|
33
|
+
export * from './types/content-music.types';
|
|
34
|
+
export * from './types/feed.types';
|
|
35
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sCAAsC,CAAC;AACrD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qCAAqC,CAAC;AACpD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mCAAmC,CAAC;AAClD,cAAc,iCAAiC,CAAC;AAChD,cAAc,wCAAwC,CAAC;AACvD,cAAc,uCAAuC,CAAC;AACtD,cAAc,0BAA0B,CAAC;AACzC,cAAc,kCAAkC,CAAC;AACjD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,oCAAoC,CAAC;AACnD,cAAc,yBAAyB,CAAC;AACxC,cAAc,kCAAkC,CAAC;AACjD,cAAc,yCAAyC,CAAC;AACxD,cAAc,wCAAwC,CAAC;AACvD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mCAAmC,CAAC;AAClD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./constants/content-element.constant"), exports);
|
|
18
|
+
__exportStar(require("./constants/feed.constant"), exports);
|
|
19
|
+
__exportStar(require("./constants/social-network.constant"), exports);
|
|
20
|
+
__exportStar(require("./entities/comment.entity"), exports);
|
|
21
|
+
__exportStar(require("./entities/content-hashtag.entity"), exports);
|
|
22
|
+
__exportStar(require("./entities/content-music.entity"), exports);
|
|
23
|
+
__exportStar(require("./entities/content-tagged-place.entity"), exports);
|
|
24
|
+
__exportStar(require("./entities/content-tagged-user.entity"), exports);
|
|
25
|
+
__exportStar(require("./entities/follow.entity"), exports);
|
|
26
|
+
__exportStar(require("./entities/friend-request.entity"), exports);
|
|
27
|
+
__exportStar(require("./entities/friendship.entity"), exports);
|
|
28
|
+
__exportStar(require("./entities/post.entity"), exports);
|
|
29
|
+
__exportStar(require("./entities/reaction.entity"), exports);
|
|
30
|
+
__exportStar(require("./entities/reel.entity"), exports);
|
|
31
|
+
__exportStar(require("./entities/save.entity"), exports);
|
|
32
|
+
__exportStar(require("./entities/story.entity"), exports);
|
|
33
|
+
__exportStar(require("./services/comment.service"), exports);
|
|
34
|
+
__exportStar(require("./services/content-hashtag.service"), exports);
|
|
35
|
+
__exportStar(require("./services/feed.service"), exports);
|
|
36
|
+
__exportStar(require("./services/content-music.service"), exports);
|
|
37
|
+
__exportStar(require("./services/content-tagged-place.service"), exports);
|
|
38
|
+
__exportStar(require("./services/content-tagged-user.service"), exports);
|
|
39
|
+
__exportStar(require("./services/follow.service"), exports);
|
|
40
|
+
__exportStar(require("./services/friend-request.service"), exports);
|
|
41
|
+
__exportStar(require("./services/friendship.service"), exports);
|
|
42
|
+
__exportStar(require("./services/post.service"), exports);
|
|
43
|
+
__exportStar(require("./services/reaction.service"), exports);
|
|
44
|
+
__exportStar(require("./services/reel.service"), exports);
|
|
45
|
+
__exportStar(require("./services/save.service"), exports);
|
|
46
|
+
__exportStar(require("./services/story.service"), exports);
|
|
47
|
+
__exportStar(require("./social-network.module"), exports);
|
|
48
|
+
__exportStar(require("./types/content-element.types"), exports);
|
|
49
|
+
__exportStar(require("./types/content-music.types"), exports);
|
|
50
|
+
__exportStar(require("./types/feed.types"), exports);
|
|
51
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uEAAqD;AACrD,4DAA0C;AAC1C,sEAAoD;AACpD,4DAA0C;AAC1C,oEAAkD;AAClD,kEAAgD;AAChD,yEAAuD;AACvD,wEAAsD;AACtD,2DAAyC;AACzC,mEAAiD;AACjD,+DAA6C;AAC7C,yDAAuC;AACvC,6DAA2C;AAC3C,yDAAuC;AACvC,yDAAuC;AACvC,0DAAwC;AACxC,6DAA2C;AAC3C,qEAAmD;AACnD,0DAAwC;AACxC,mEAAiD;AACjD,0EAAwD;AACxD,yEAAuD;AACvD,4DAA0C;AAC1C,oEAAkD;AAClD,gEAA8C;AAC9C,0DAAwC;AACxC,8DAA4C;AAC5C,0DAAwC;AACxC,0DAAwC;AACxC,2DAAyC;AACzC,0DAAwC;AACxC,gEAA8C;AAC9C,8DAA4C;AAC5C,qDAAmC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { TypeOrmCrudService } from '@dataui/crud-typeorm';
|
|
2
|
+
import { Repository } from 'typeorm';
|
|
3
|
+
import { ContentTargetType } from '../constants/social-network.constant';
|
|
4
|
+
import { Comment } from '../entities/comment.entity';
|
|
5
|
+
export declare class CommentService extends TypeOrmCrudService<Comment> {
|
|
6
|
+
readonly repo: Repository<Comment>;
|
|
7
|
+
constructor(repo: Repository<Comment>);
|
|
8
|
+
reply(parentId: string, userId: string, text: string, targetType?: ContentTargetType, targetId?: string): Promise<Comment>;
|
|
9
|
+
getReplies(parentId: string, options?: {
|
|
10
|
+
take?: number;
|
|
11
|
+
skip?: number;
|
|
12
|
+
}): Promise<Comment[]>;
|
|
13
|
+
getCommentsForTarget(targetType: ContentTargetType, targetId: string, options?: {
|
|
14
|
+
take?: number;
|
|
15
|
+
skip?: number;
|
|
16
|
+
topLevelOnly?: boolean;
|
|
17
|
+
}): Promise<Comment[]>;
|
|
18
|
+
getCommentCountForTarget(targetType: ContentTargetType, targetId: string): Promise<number>;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=comment.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comment.service.d.ts","sourceRoot":"","sources":["../../src/services/comment.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAG1D,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAErD,qBACa,cAAe,SAAQ,kBAAkB,CAAC,OAAO,CAAC;aAG3C,IAAI,EAAE,UAAU,CAAC,OAAO,CAAC;gBAAzB,IAAI,EAAE,UAAU,CAAC,OAAO,CAAC;IAKrC,KAAK,CACT,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,UAAU,CAAC,EAAE,iBAAiB,EAC9B,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,OAAO,CAAC;IAab,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAS5F,oBAAoB,CACxB,UAAU,EAAE,iBAAiB,EAC7B,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,OAAO,CAAA;KAAE,GACjE,OAAO,CAAC,OAAO,EAAE,CAAC;IAaf,wBAAwB,CAAC,UAAU,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAGjG"}
|
|
@@ -0,0 +1,74 @@
|
|
|
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.CommentService = void 0;
|
|
16
|
+
const crud_typeorm_1 = require("@dataui/crud-typeorm");
|
|
17
|
+
const common_1 = require("@nestjs/common");
|
|
18
|
+
const typeorm_1 = require("@nestjs/typeorm");
|
|
19
|
+
const typeorm_2 = require("typeorm");
|
|
20
|
+
const comment_entity_1 = require("../entities/comment.entity");
|
|
21
|
+
let CommentService = class CommentService extends crud_typeorm_1.TypeOrmCrudService {
|
|
22
|
+
repo;
|
|
23
|
+
constructor(repo) {
|
|
24
|
+
super(repo);
|
|
25
|
+
this.repo = repo;
|
|
26
|
+
}
|
|
27
|
+
async reply(parentId, userId, text, targetType, targetId) {
|
|
28
|
+
const parent = await this.repo.findOne({ where: { id: parentId } });
|
|
29
|
+
if (!parent)
|
|
30
|
+
throw new Error('Parent comment not found');
|
|
31
|
+
const comment = this.repo.create({
|
|
32
|
+
userId,
|
|
33
|
+
text,
|
|
34
|
+
targetType: targetType ?? parent.targetType,
|
|
35
|
+
targetId: targetId ?? parent.targetId,
|
|
36
|
+
parentId,
|
|
37
|
+
});
|
|
38
|
+
return this.repo.save(comment);
|
|
39
|
+
}
|
|
40
|
+
async getReplies(parentId, options) {
|
|
41
|
+
const qb = this.repo
|
|
42
|
+
.createQueryBuilder('c')
|
|
43
|
+
.where('c.parentId = :parentId', { parentId });
|
|
44
|
+
if (options?.take)
|
|
45
|
+
qb.take(options.take);
|
|
46
|
+
if (options?.skip)
|
|
47
|
+
qb.skip(options.skip);
|
|
48
|
+
return qb.orderBy('c.createdAt', 'ASC').getMany();
|
|
49
|
+
}
|
|
50
|
+
async getCommentsForTarget(targetType, targetId, options) {
|
|
51
|
+
const qb = this.repo
|
|
52
|
+
.createQueryBuilder('c')
|
|
53
|
+
.where('c.targetType = :targetType', { targetType })
|
|
54
|
+
.andWhere('c.targetId = :targetId', { targetId });
|
|
55
|
+
if (options?.topLevelOnly !== false) {
|
|
56
|
+
qb.andWhere('c.parentId IS NULL');
|
|
57
|
+
}
|
|
58
|
+
if (options?.take)
|
|
59
|
+
qb.take(options.take);
|
|
60
|
+
if (options?.skip)
|
|
61
|
+
qb.skip(options.skip);
|
|
62
|
+
return qb.orderBy('c.createdAt', 'ASC').getMany();
|
|
63
|
+
}
|
|
64
|
+
async getCommentCountForTarget(targetType, targetId) {
|
|
65
|
+
return this.repo.count({ where: { targetType, targetId } });
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
exports.CommentService = CommentService;
|
|
69
|
+
exports.CommentService = CommentService = __decorate([
|
|
70
|
+
(0, common_1.Injectable)(),
|
|
71
|
+
__param(0, (0, typeorm_1.InjectRepository)(comment_entity_1.Comment)),
|
|
72
|
+
__metadata("design:paramtypes", [typeorm_2.Repository])
|
|
73
|
+
], CommentService);
|
|
74
|
+
//# sourceMappingURL=comment.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comment.service.js","sourceRoot":"","sources":["../../src/services/comment.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,uDAA0D;AAC1D,2CAA4C;AAC5C,6CAAmD;AACnD,qCAAqC;AAGrC,+DAAqD;AAG9C,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,iCAA2B;IAG3C;IAFlB,YAEkB,IAAyB;QAEzC,KAAK,CAAC,IAAI,CAAC,CAAC;QAFI,SAAI,GAAJ,IAAI,CAAqB;IAG3C,CAAC;IAED,KAAK,CAAC,KAAK,CACT,QAAgB,EAChB,MAAc,EACd,IAAY,EACZ,UAA8B,EAC9B,QAAiB;QAEjB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC;QACpE,IAAI,CAAC,MAAM;YAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;QACzD,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;YAC/B,MAAM;YACN,IAAI;YACJ,UAAU,EAAE,UAAU,IAAI,MAAM,CAAC,UAAU;YAC3C,QAAQ,EAAE,QAAQ,IAAI,MAAM,CAAC,QAAQ;YACrC,QAAQ;SACT,CAAC,CAAC;QACH,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACjC,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,QAAgB,EAAE,OAA0C;QAC3E,MAAM,EAAE,GAAG,IAAI,CAAC,IAAI;aACjB,kBAAkB,CAAC,GAAG,CAAC;aACvB,KAAK,CAAC,wBAAwB,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC;QACjD,IAAI,OAAO,EAAE,IAAI;YAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACzC,IAAI,OAAO,EAAE,IAAI;YAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACzC,OAAO,EAAE,CAAC,OAAO,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC;IACpD,CAAC;IAED,KAAK,CAAC,oBAAoB,CACxB,UAA6B,EAC7B,QAAgB,EAChB,OAAkE;QAElE,MAAM,EAAE,GAAG,IAAI,CAAC,IAAI;aACjB,kBAAkB,CAAC,GAAG,CAAC;aACvB,KAAK,CAAC,4BAA4B,EAAE,EAAE,UAAU,EAAE,CAAC;aACnD,QAAQ,CAAC,wBAAwB,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC;QACpD,IAAI,OAAO,EAAE,YAAY,KAAK,KAAK,EAAE,CAAC;YACpC,EAAE,CAAC,QAAQ,CAAC,oBAAoB,CAAC,CAAC;QACpC,CAAC;QACD,IAAI,OAAO,EAAE,IAAI;YAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACzC,IAAI,OAAO,EAAE,IAAI;YAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACzC,OAAO,EAAE,CAAC,OAAO,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC;IACpD,CAAC;IAED,KAAK,CAAC,wBAAwB,CAAC,UAA6B,EAAE,QAAgB;QAC5E,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC;IAC9D,CAAC;CACF,CAAA;AAxDY,wCAAc;yBAAd,cAAc;IAD1B,IAAA,mBAAU,GAAE;IAGR,WAAA,IAAA,0BAAgB,EAAC,wBAAO,CAAC,CAAA;qCACJ,oBAAU;GAHvB,cAAc,CAwD1B"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { TypeOrmCrudService } from '@dataui/crud-typeorm';
|
|
2
|
+
import { Repository } from 'typeorm';
|
|
3
|
+
import { TaggableContentType } from '../constants/social-network.constant';
|
|
4
|
+
import { ContentHashtag } from '../entities/content-hashtag.entity';
|
|
5
|
+
export declare class ContentHashtagService extends TypeOrmCrudService<ContentHashtag> {
|
|
6
|
+
readonly repo: Repository<ContentHashtag>;
|
|
7
|
+
constructor(repo: Repository<ContentHashtag>);
|
|
8
|
+
addHashtag(contentType: TaggableContentType, contentId: string, tag: string): Promise<ContentHashtag>;
|
|
9
|
+
removeHashtag(contentType: TaggableContentType, contentId: string, tag: string): Promise<void>;
|
|
10
|
+
getHashtagsForContent(contentType: TaggableContentType, contentId: string): Promise<string[]>;
|
|
11
|
+
getContentIdsByHashtag(tag: string, contentType: TaggableContentType, options?: {
|
|
12
|
+
take?: number;
|
|
13
|
+
skip?: number;
|
|
14
|
+
}): Promise<string[]>;
|
|
15
|
+
getTrendingHashtags(options?: {
|
|
16
|
+
contentType?: TaggableContentType;
|
|
17
|
+
limit?: number;
|
|
18
|
+
}): Promise<{
|
|
19
|
+
tag: string;
|
|
20
|
+
count: number;
|
|
21
|
+
}[]>;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=content-hashtag.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-hashtag.service.d.ts","sourceRoot":"","sources":["../../src/services/content-hashtag.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAG1D,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAEpE,qBACa,qBAAsB,SAAQ,kBAAkB,CAAC,cAAc,CAAC;aAGzD,IAAI,EAAE,UAAU,CAAC,cAAc,CAAC;gBAAhC,IAAI,EAAE,UAAU,CAAC,cAAc,CAAC;IAK5C,UAAU,CACd,WAAW,EAAE,mBAAmB,EAChC,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,cAAc,CAAC;IAUpB,aAAa,CACjB,WAAW,EAAE,mBAAmB,EAChC,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,IAAI,CAAC;IAKV,qBAAqB,CACzB,WAAW,EAAE,mBAAmB,EAChC,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,EAAE,CAAC;IAQd,sBAAsB,CAC1B,GAAG,EAAE,MAAM,EACX,WAAW,EAAE,mBAAmB,EAChC,OAAO,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,GACzC,OAAO,CAAC,MAAM,EAAE,CAAC;IAad,mBAAmB,CACvB,OAAO,CAAC,EAAE;QAAE,WAAW,CAAC,EAAE,mBAAmB,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAC9D,OAAO,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAc7C"}
|
|
@@ -0,0 +1,84 @@
|
|
|
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.ContentHashtagService = void 0;
|
|
16
|
+
const crud_typeorm_1 = require("@dataui/crud-typeorm");
|
|
17
|
+
const common_1 = require("@nestjs/common");
|
|
18
|
+
const typeorm_1 = require("@nestjs/typeorm");
|
|
19
|
+
const typeorm_2 = require("typeorm");
|
|
20
|
+
const content_hashtag_entity_1 = require("../entities/content-hashtag.entity");
|
|
21
|
+
let ContentHashtagService = class ContentHashtagService extends crud_typeorm_1.TypeOrmCrudService {
|
|
22
|
+
repo;
|
|
23
|
+
constructor(repo) {
|
|
24
|
+
super(repo);
|
|
25
|
+
this.repo = repo;
|
|
26
|
+
}
|
|
27
|
+
async addHashtag(contentType, contentId, tag) {
|
|
28
|
+
const normalizedTag = tag.replace(/^#/, '').toLowerCase();
|
|
29
|
+
let row = await this.repo.findOne({
|
|
30
|
+
where: { contentType, contentId, tag: normalizedTag },
|
|
31
|
+
});
|
|
32
|
+
if (row)
|
|
33
|
+
return row;
|
|
34
|
+
row = this.repo.create({ contentType, contentId, tag: normalizedTag });
|
|
35
|
+
return this.repo.save(row);
|
|
36
|
+
}
|
|
37
|
+
async removeHashtag(contentType, contentId, tag) {
|
|
38
|
+
const normalizedTag = tag.replace(/^#/, '').toLowerCase();
|
|
39
|
+
await this.repo.delete({ contentType, contentId, tag: normalizedTag });
|
|
40
|
+
}
|
|
41
|
+
async getHashtagsForContent(contentType, contentId) {
|
|
42
|
+
const rows = await this.repo.find({
|
|
43
|
+
where: { contentType, contentId },
|
|
44
|
+
select: ['tag'],
|
|
45
|
+
});
|
|
46
|
+
return rows.map((r) => r.tag);
|
|
47
|
+
}
|
|
48
|
+
async getContentIdsByHashtag(tag, contentType, options) {
|
|
49
|
+
const normalizedTag = tag.replace(/^#/, '').toLowerCase();
|
|
50
|
+
const qb = this.repo
|
|
51
|
+
.createQueryBuilder('h')
|
|
52
|
+
.select('h.contentId')
|
|
53
|
+
.where('h.tag = :tag', { tag: normalizedTag })
|
|
54
|
+
.andWhere('h.contentType = :contentType', { contentType });
|
|
55
|
+
if (options?.take)
|
|
56
|
+
qb.take(options.take);
|
|
57
|
+
if (options?.skip)
|
|
58
|
+
qb.skip(options.skip);
|
|
59
|
+
const rows = await qb.orderBy('h.createdAt', 'DESC').getRawMany();
|
|
60
|
+
return rows.map((r) => r.contentId);
|
|
61
|
+
}
|
|
62
|
+
async getTrendingHashtags(options) {
|
|
63
|
+
const qb = this.repo
|
|
64
|
+
.createQueryBuilder('h')
|
|
65
|
+
.select('h.tag', 'tag')
|
|
66
|
+
.addSelect('COUNT(*)', 'count')
|
|
67
|
+
.groupBy('h.tag')
|
|
68
|
+
.orderBy('count', 'DESC');
|
|
69
|
+
if (options?.contentType) {
|
|
70
|
+
qb.andWhere('h.contentType = :contentType', { contentType: options.contentType });
|
|
71
|
+
}
|
|
72
|
+
if (options?.limit)
|
|
73
|
+
qb.limit(options.limit);
|
|
74
|
+
const rows = await qb.getRawMany();
|
|
75
|
+
return rows.map((r) => ({ tag: r.tag, count: parseInt(r.count, 10) }));
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
exports.ContentHashtagService = ContentHashtagService;
|
|
79
|
+
exports.ContentHashtagService = ContentHashtagService = __decorate([
|
|
80
|
+
(0, common_1.Injectable)(),
|
|
81
|
+
__param(0, (0, typeorm_1.InjectRepository)(content_hashtag_entity_1.ContentHashtag)),
|
|
82
|
+
__metadata("design:paramtypes", [typeorm_2.Repository])
|
|
83
|
+
], ContentHashtagService);
|
|
84
|
+
//# sourceMappingURL=content-hashtag.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-hashtag.service.js","sourceRoot":"","sources":["../../src/services/content-hashtag.service.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { TypeOrmCrudService } from '@dataui/crud-typeorm';
|
|
2
|
+
import { Repository } from 'typeorm';
|
|
3
|
+
import { TaggableContentType } from '../constants/social-network.constant';
|
|
4
|
+
import { ContentMusic } from '../entities/content-music.entity';
|
|
5
|
+
import { AddMusicInput } from '../types/content-music.types';
|
|
6
|
+
export declare class ContentMusicService extends TypeOrmCrudService<ContentMusic> {
|
|
7
|
+
readonly repo: Repository<ContentMusic>;
|
|
8
|
+
constructor(repo: Repository<ContentMusic>);
|
|
9
|
+
addMusic(contentType: TaggableContentType, contentId: string, data: AddMusicInput): Promise<ContentMusic>;
|
|
10
|
+
removeMusic(contentType: TaggableContentType, contentId: string, trackId: string): Promise<void>;
|
|
11
|
+
getMusicForContent(contentType: TaggableContentType, contentId: string): Promise<ContentMusic[]>;
|
|
12
|
+
getContentIdsByTrack(trackId: string, contentType: TaggableContentType, options?: {
|
|
13
|
+
take?: number;
|
|
14
|
+
skip?: number;
|
|
15
|
+
}): Promise<string[]>;
|
|
16
|
+
getTrendingTracks(options?: {
|
|
17
|
+
contentType?: TaggableContentType;
|
|
18
|
+
limit?: number;
|
|
19
|
+
}): Promise<{
|
|
20
|
+
trackId: string;
|
|
21
|
+
title?: string;
|
|
22
|
+
artist?: string;
|
|
23
|
+
count: number;
|
|
24
|
+
}[]>;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=content-music.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-music.service.d.ts","sourceRoot":"","sources":["../../src/services/content-music.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAG1D,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,qBACa,mBAAoB,SAAQ,kBAAkB,CAAC,YAAY,CAAC;aAGrD,IAAI,EAAE,UAAU,CAAC,YAAY,CAAC;gBAA9B,IAAI,EAAE,UAAU,CAAC,YAAY,CAAC;IAK1C,QAAQ,CACZ,WAAW,EAAE,mBAAmB,EAChC,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,aAAa,GAClB,OAAO,CAAC,YAAY,CAAC;IAuBlB,WAAW,CACf,WAAW,EAAE,mBAAmB,EAChC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,IAAI,CAAC;IAIV,kBAAkB,CACtB,WAAW,EAAE,mBAAmB,EAChC,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,YAAY,EAAE,CAAC;IAOpB,oBAAoB,CACxB,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,mBAAmB,EAChC,OAAO,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,GACzC,OAAO,CAAC,MAAM,EAAE,CAAC;IAYd,iBAAiB,CACrB,OAAO,CAAC,EAAE;QAAE,WAAW,CAAC,EAAE,mBAAmB,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAC9D,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAqBlF"}
|
|
@@ -0,0 +1,100 @@
|
|
|
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.ContentMusicService = void 0;
|
|
16
|
+
const crud_typeorm_1 = require("@dataui/crud-typeorm");
|
|
17
|
+
const common_1 = require("@nestjs/common");
|
|
18
|
+
const typeorm_1 = require("@nestjs/typeorm");
|
|
19
|
+
const typeorm_2 = require("typeorm");
|
|
20
|
+
const content_music_entity_1 = require("../entities/content-music.entity");
|
|
21
|
+
let ContentMusicService = class ContentMusicService extends crud_typeorm_1.TypeOrmCrudService {
|
|
22
|
+
repo;
|
|
23
|
+
constructor(repo) {
|
|
24
|
+
super(repo);
|
|
25
|
+
this.repo = repo;
|
|
26
|
+
}
|
|
27
|
+
async addMusic(contentType, contentId, data) {
|
|
28
|
+
let row = await this.repo.findOne({
|
|
29
|
+
where: { contentType, contentId, trackId: data.trackId },
|
|
30
|
+
});
|
|
31
|
+
if (row) {
|
|
32
|
+
row.title = data.title ?? row.title;
|
|
33
|
+
row.artist = data.artist ?? row.artist;
|
|
34
|
+
row.startOffsetSeconds = data.startOffsetSeconds ?? row.startOffsetSeconds;
|
|
35
|
+
row.endOffsetSeconds = data.endOffsetSeconds ?? row.endOffsetSeconds;
|
|
36
|
+
return this.repo.save(row);
|
|
37
|
+
}
|
|
38
|
+
row = this.repo.create({
|
|
39
|
+
contentType,
|
|
40
|
+
contentId,
|
|
41
|
+
trackId: data.trackId,
|
|
42
|
+
title: data.title,
|
|
43
|
+
artist: data.artist,
|
|
44
|
+
startOffsetSeconds: data.startOffsetSeconds,
|
|
45
|
+
endOffsetSeconds: data.endOffsetSeconds,
|
|
46
|
+
});
|
|
47
|
+
return this.repo.save(row);
|
|
48
|
+
}
|
|
49
|
+
async removeMusic(contentType, contentId, trackId) {
|
|
50
|
+
await this.repo.delete({ contentType, contentId, trackId });
|
|
51
|
+
}
|
|
52
|
+
async getMusicForContent(contentType, contentId) {
|
|
53
|
+
return this.repo.find({
|
|
54
|
+
where: { contentType, contentId },
|
|
55
|
+
order: { createdAt: 'ASC' },
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
async getContentIdsByTrack(trackId, contentType, options) {
|
|
59
|
+
const qb = this.repo
|
|
60
|
+
.createQueryBuilder('m')
|
|
61
|
+
.select('m.contentId')
|
|
62
|
+
.where('m.trackId = :trackId', { trackId })
|
|
63
|
+
.andWhere('m.contentType = :contentType', { contentType });
|
|
64
|
+
if (options?.take)
|
|
65
|
+
qb.take(options.take);
|
|
66
|
+
if (options?.skip)
|
|
67
|
+
qb.skip(options.skip);
|
|
68
|
+
const rows = await qb.orderBy('m.createdAt', 'DESC').getRawMany();
|
|
69
|
+
return rows.map((r) => r.contentId);
|
|
70
|
+
}
|
|
71
|
+
async getTrendingTracks(options) {
|
|
72
|
+
const qb = this.repo
|
|
73
|
+
.createQueryBuilder('m')
|
|
74
|
+
.select('m.trackId', 'trackId')
|
|
75
|
+
.addSelect('MAX(m.title)', 'title')
|
|
76
|
+
.addSelect('MAX(m.artist)', 'artist')
|
|
77
|
+
.addSelect('COUNT(*)', 'count')
|
|
78
|
+
.groupBy('m.trackId')
|
|
79
|
+
.orderBy('count', 'DESC');
|
|
80
|
+
if (options?.contentType) {
|
|
81
|
+
qb.andWhere('m.contentType = :contentType', { contentType: options.contentType });
|
|
82
|
+
}
|
|
83
|
+
if (options?.limit)
|
|
84
|
+
qb.limit(options.limit);
|
|
85
|
+
const rows = await qb.getRawMany();
|
|
86
|
+
return rows.map((r) => ({
|
|
87
|
+
trackId: r.trackId,
|
|
88
|
+
title: r.title ?? undefined,
|
|
89
|
+
artist: r.artist ?? undefined,
|
|
90
|
+
count: parseInt(r.count, 10),
|
|
91
|
+
}));
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
exports.ContentMusicService = ContentMusicService;
|
|
95
|
+
exports.ContentMusicService = ContentMusicService = __decorate([
|
|
96
|
+
(0, common_1.Injectable)(),
|
|
97
|
+
__param(0, (0, typeorm_1.InjectRepository)(content_music_entity_1.ContentMusic)),
|
|
98
|
+
__metadata("design:paramtypes", [typeorm_2.Repository])
|
|
99
|
+
], ContentMusicService);
|
|
100
|
+
//# sourceMappingURL=content-music.service.js.map
|