@grapadigital/shared-schemas 1.0.186 → 1.0.187
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/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/schemas/comment.schema.d.ts +72 -0
- package/dist/schemas/comment.schema.js +117 -0
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/schemas/comment.schema.ts +95 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './schemas/action.schema';
|
|
2
2
|
export * from './schemas/client.schema';
|
|
3
3
|
export * from './schemas/content.schema';
|
|
4
|
+
export * from './schemas/comment.schema';
|
|
4
5
|
export * from './schemas/influencer.schema';
|
|
5
6
|
export * from './schemas/supplier.schema';
|
|
6
7
|
export * from './schemas/campaign.schema';
|
package/dist/index.js
CHANGED
|
@@ -18,6 +18,7 @@ exports.NoteMentionSchema = exports.NoteMention = exports.NoteSchema = exports.N
|
|
|
18
18
|
__exportStar(require("./schemas/action.schema"), exports);
|
|
19
19
|
__exportStar(require("./schemas/client.schema"), exports);
|
|
20
20
|
__exportStar(require("./schemas/content.schema"), exports);
|
|
21
|
+
__exportStar(require("./schemas/comment.schema"), exports);
|
|
21
22
|
__exportStar(require("./schemas/influencer.schema"), exports);
|
|
22
23
|
__exportStar(require("./schemas/supplier.schema"), exports);
|
|
23
24
|
__exportStar(require("./schemas/campaign.schema"), exports);
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/// <reference types="mongoose/types/aggregate" />
|
|
2
|
+
/// <reference types="mongoose/types/callback" />
|
|
3
|
+
/// <reference types="mongoose/types/collection" />
|
|
4
|
+
/// <reference types="mongoose/types/connection" />
|
|
5
|
+
/// <reference types="mongoose/types/cursor" />
|
|
6
|
+
/// <reference types="mongoose/types/document" />
|
|
7
|
+
/// <reference types="mongoose/types/error" />
|
|
8
|
+
/// <reference types="mongoose/types/expressions" />
|
|
9
|
+
/// <reference types="mongoose/types/helpers" />
|
|
10
|
+
/// <reference types="mongoose/types/middlewares" />
|
|
11
|
+
/// <reference types="mongoose/types/indexes" />
|
|
12
|
+
/// <reference types="mongoose/types/models" />
|
|
13
|
+
/// <reference types="mongoose/types/mongooseoptions" />
|
|
14
|
+
/// <reference types="mongoose/types/pipelinestage" />
|
|
15
|
+
/// <reference types="mongoose/types/populate" />
|
|
16
|
+
/// <reference types="mongoose/types/query" />
|
|
17
|
+
/// <reference types="mongoose/types/schemaoptions" />
|
|
18
|
+
/// <reference types="mongoose/types/session" />
|
|
19
|
+
/// <reference types="mongoose/types/types" />
|
|
20
|
+
/// <reference types="mongoose/types/utility" />
|
|
21
|
+
/// <reference types="mongoose/types/validation" />
|
|
22
|
+
/// <reference types="mongoose/types/virtuals" />
|
|
23
|
+
/// <reference types="mongoose/types/schematypes" />
|
|
24
|
+
/// <reference types="mongoose/types/inferschematype" />
|
|
25
|
+
/// <reference types="mongoose/types/inferrawdoctype" />
|
|
26
|
+
import { HydratedDocument, Schema as MongooseSchema, Types } from 'mongoose';
|
|
27
|
+
import { Content } from './content.schema';
|
|
28
|
+
import { Action } from './action.schema';
|
|
29
|
+
export type CommentDocument = HydratedDocument<Comment>;
|
|
30
|
+
export declare class Comment {
|
|
31
|
+
_id?: Types.ObjectId;
|
|
32
|
+
content: Types.ObjectId | Content;
|
|
33
|
+
action: Types.ObjectId | Action;
|
|
34
|
+
externalId: string;
|
|
35
|
+
author: string;
|
|
36
|
+
authorProfileUrl?: string | null;
|
|
37
|
+
authorThumbnailUrl?: string | null;
|
|
38
|
+
text: string;
|
|
39
|
+
url?: string | null;
|
|
40
|
+
postedAt: Date;
|
|
41
|
+
likeCount?: number;
|
|
42
|
+
parent?: Types.ObjectId | Comment | null;
|
|
43
|
+
target?: ('brand' | 'influencer' | 'content' | 'emoji' | 'spam')[];
|
|
44
|
+
polarity?: 'positive' | 'negative' | 'neutral' | null;
|
|
45
|
+
funnel?: 'awareness' | 'consideration' | 'conversion' | null;
|
|
46
|
+
isEmojiOnly?: boolean;
|
|
47
|
+
isSpam?: boolean;
|
|
48
|
+
createdAt?: Date;
|
|
49
|
+
updatedAt?: Date;
|
|
50
|
+
}
|
|
51
|
+
export declare const CommentSchema: MongooseSchema<Comment, import("mongoose").Model<Comment, any, any, any, import("mongoose").Document<unknown, any, Comment, any, {}> & Comment & Required<{
|
|
52
|
+
_id: Types.ObjectId;
|
|
53
|
+
}> & {
|
|
54
|
+
__v: number;
|
|
55
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Comment, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<Comment>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<Comment> & Required<{
|
|
56
|
+
_id: Types.ObjectId;
|
|
57
|
+
}> & {
|
|
58
|
+
__v: number;
|
|
59
|
+
}>;
|
|
60
|
+
export declare const CommentModel: import("mongoose").Model<Comment, {}, {}, {}, import("mongoose").Document<unknown, {}, Comment, {}, import("mongoose").DefaultSchemaOptions> & Comment & Required<{
|
|
61
|
+
_id: Types.ObjectId;
|
|
62
|
+
}> & {
|
|
63
|
+
__v: number;
|
|
64
|
+
}, MongooseSchema<Comment, import("mongoose").Model<Comment, any, any, any, import("mongoose").Document<unknown, any, Comment, any, {}> & Comment & Required<{
|
|
65
|
+
_id: Types.ObjectId;
|
|
66
|
+
}> & {
|
|
67
|
+
__v: number;
|
|
68
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Comment, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<Comment>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<Comment> & Required<{
|
|
69
|
+
_id: Types.ObjectId;
|
|
70
|
+
}> & {
|
|
71
|
+
__v: number;
|
|
72
|
+
}>>;
|
|
@@ -0,0 +1,117 @@
|
|
|
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.CommentModel = exports.CommentSchema = exports.Comment = void 0;
|
|
13
|
+
const mongoose_1 = require("@nestjs/mongoose");
|
|
14
|
+
const mongoose_2 = require("mongoose");
|
|
15
|
+
let Comment = class Comment {
|
|
16
|
+
};
|
|
17
|
+
__decorate([
|
|
18
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, auto: true, required: false }),
|
|
19
|
+
__metadata("design:type", mongoose_2.Types.ObjectId)
|
|
20
|
+
], Comment.prototype, "_id", void 0);
|
|
21
|
+
__decorate([
|
|
22
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, ref: 'Content', required: true }),
|
|
23
|
+
__metadata("design:type", Object)
|
|
24
|
+
], Comment.prototype, "content", void 0);
|
|
25
|
+
__decorate([
|
|
26
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, ref: 'Action', required: true }),
|
|
27
|
+
__metadata("design:type", Object)
|
|
28
|
+
], Comment.prototype, "action", void 0);
|
|
29
|
+
__decorate([
|
|
30
|
+
(0, mongoose_1.Prop)({ type: String, required: true }),
|
|
31
|
+
__metadata("design:type", String)
|
|
32
|
+
], Comment.prototype, "externalId", void 0);
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, mongoose_1.Prop)({ type: String, required: true }),
|
|
35
|
+
__metadata("design:type", String)
|
|
36
|
+
], Comment.prototype, "author", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, mongoose_1.Prop)({ type: String, required: false, default: null }),
|
|
39
|
+
__metadata("design:type", Object)
|
|
40
|
+
], Comment.prototype, "authorProfileUrl", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, mongoose_1.Prop)({ type: String, required: false, default: null }),
|
|
43
|
+
__metadata("design:type", Object)
|
|
44
|
+
], Comment.prototype, "authorThumbnailUrl", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, mongoose_1.Prop)({ type: String, required: true }),
|
|
47
|
+
__metadata("design:type", String)
|
|
48
|
+
], Comment.prototype, "text", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
(0, mongoose_1.Prop)({ type: String, required: false, default: null }),
|
|
51
|
+
__metadata("design:type", Object)
|
|
52
|
+
], Comment.prototype, "url", void 0);
|
|
53
|
+
__decorate([
|
|
54
|
+
(0, mongoose_1.Prop)({ type: Date, required: true }),
|
|
55
|
+
__metadata("design:type", Date)
|
|
56
|
+
], Comment.prototype, "postedAt", void 0);
|
|
57
|
+
__decorate([
|
|
58
|
+
(0, mongoose_1.Prop)({ type: Number, required: false, default: 0 }),
|
|
59
|
+
__metadata("design:type", Number)
|
|
60
|
+
], Comment.prototype, "likeCount", void 0);
|
|
61
|
+
__decorate([
|
|
62
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, ref: 'Comment', required: false, default: null }),
|
|
63
|
+
__metadata("design:type", Object)
|
|
64
|
+
], Comment.prototype, "parent", void 0);
|
|
65
|
+
__decorate([
|
|
66
|
+
(0, mongoose_1.Prop)({
|
|
67
|
+
type: [String],
|
|
68
|
+
enum: ['brand', 'influencer', 'content', 'emoji', 'spam'],
|
|
69
|
+
required: false,
|
|
70
|
+
default: [],
|
|
71
|
+
}),
|
|
72
|
+
__metadata("design:type", Array)
|
|
73
|
+
], Comment.prototype, "target", void 0);
|
|
74
|
+
__decorate([
|
|
75
|
+
(0, mongoose_1.Prop)({
|
|
76
|
+
type: String,
|
|
77
|
+
enum: ['positive', 'negative', 'neutral'],
|
|
78
|
+
required: false,
|
|
79
|
+
default: null,
|
|
80
|
+
}),
|
|
81
|
+
__metadata("design:type", Object)
|
|
82
|
+
], Comment.prototype, "polarity", void 0);
|
|
83
|
+
__decorate([
|
|
84
|
+
(0, mongoose_1.Prop)({
|
|
85
|
+
type: String,
|
|
86
|
+
enum: ['awareness', 'consideration', 'conversion'],
|
|
87
|
+
required: false,
|
|
88
|
+
default: null,
|
|
89
|
+
}),
|
|
90
|
+
__metadata("design:type", Object)
|
|
91
|
+
], Comment.prototype, "funnel", void 0);
|
|
92
|
+
__decorate([
|
|
93
|
+
(0, mongoose_1.Prop)({ type: Boolean, required: false, default: false }),
|
|
94
|
+
__metadata("design:type", Boolean)
|
|
95
|
+
], Comment.prototype, "isEmojiOnly", void 0);
|
|
96
|
+
__decorate([
|
|
97
|
+
(0, mongoose_1.Prop)({ type: Boolean, required: false, default: false }),
|
|
98
|
+
__metadata("design:type", Boolean)
|
|
99
|
+
], Comment.prototype, "isSpam", void 0);
|
|
100
|
+
__decorate([
|
|
101
|
+
(0, mongoose_1.Prop)({ default: Date.now, required: false }),
|
|
102
|
+
__metadata("design:type", Date)
|
|
103
|
+
], Comment.prototype, "createdAt", void 0);
|
|
104
|
+
__decorate([
|
|
105
|
+
(0, mongoose_1.Prop)({ default: Date.now, required: false }),
|
|
106
|
+
__metadata("design:type", Date)
|
|
107
|
+
], Comment.prototype, "updatedAt", void 0);
|
|
108
|
+
Comment = __decorate([
|
|
109
|
+
(0, mongoose_1.Schema)({ timestamps: true })
|
|
110
|
+
], Comment);
|
|
111
|
+
exports.Comment = Comment;
|
|
112
|
+
exports.CommentSchema = mongoose_1.SchemaFactory.createForClass(Comment);
|
|
113
|
+
exports.CommentSchema.index({ content: 1, externalId: 1 }, { unique: true });
|
|
114
|
+
exports.CommentSchema.index({ action: 1, funnel: 1 });
|
|
115
|
+
exports.CommentSchema.index({ action: 1, target: 1 });
|
|
116
|
+
exports.CommentSchema.index({ content: 1, parent: 1 });
|
|
117
|
+
exports.CommentModel = (0, mongoose_2.model)('Comment', exports.CommentSchema);
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './schemas/action.schema';
|
|
2
2
|
export * from './schemas/client.schema';
|
|
3
3
|
export * from './schemas/content.schema';
|
|
4
|
+
export * from './schemas/comment.schema';
|
|
4
5
|
export * from './schemas/influencer.schema';
|
|
5
6
|
export * from './schemas/supplier.schema';
|
|
6
7
|
export * from './schemas/campaign.schema';
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
|
|
2
|
+
import {
|
|
3
|
+
HydratedDocument,
|
|
4
|
+
Schema as MongooseSchema,
|
|
5
|
+
Types,
|
|
6
|
+
model as MongooseModel,
|
|
7
|
+
} from 'mongoose';
|
|
8
|
+
import { Content } from './content.schema';
|
|
9
|
+
import { Action } from './action.schema';
|
|
10
|
+
|
|
11
|
+
export type CommentDocument = HydratedDocument<Comment>;
|
|
12
|
+
|
|
13
|
+
@Schema({ timestamps: true })
|
|
14
|
+
export class Comment {
|
|
15
|
+
@Prop({ type: MongooseSchema.Types.ObjectId, auto: true, required: false })
|
|
16
|
+
_id?: Types.ObjectId;
|
|
17
|
+
|
|
18
|
+
@Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Content', required: true })
|
|
19
|
+
content: Types.ObjectId | Content;
|
|
20
|
+
|
|
21
|
+
@Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Action', required: true })
|
|
22
|
+
action: Types.ObjectId | Action;
|
|
23
|
+
|
|
24
|
+
@Prop({ type: String, required: true })
|
|
25
|
+
externalId: string;
|
|
26
|
+
|
|
27
|
+
@Prop({ type: String, required: true })
|
|
28
|
+
author: string;
|
|
29
|
+
|
|
30
|
+
@Prop({ type: String, required: false, default: null })
|
|
31
|
+
authorProfileUrl?: string | null;
|
|
32
|
+
|
|
33
|
+
@Prop({ type: String, required: false, default: null })
|
|
34
|
+
authorThumbnailUrl?: string | null;
|
|
35
|
+
|
|
36
|
+
@Prop({ type: String, required: true })
|
|
37
|
+
text: string;
|
|
38
|
+
|
|
39
|
+
@Prop({ type: String, required: false, default: null })
|
|
40
|
+
url?: string | null;
|
|
41
|
+
|
|
42
|
+
@Prop({ type: Date, required: true })
|
|
43
|
+
postedAt: Date;
|
|
44
|
+
|
|
45
|
+
@Prop({ type: Number, required: false, default: 0 })
|
|
46
|
+
likeCount?: number;
|
|
47
|
+
|
|
48
|
+
@Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Comment', required: false, default: null })
|
|
49
|
+
parent?: Types.ObjectId | Comment | null;
|
|
50
|
+
|
|
51
|
+
@Prop({
|
|
52
|
+
type: [String],
|
|
53
|
+
enum: ['brand', 'influencer', 'content', 'emoji', 'spam'],
|
|
54
|
+
required: false,
|
|
55
|
+
default: [],
|
|
56
|
+
})
|
|
57
|
+
target?: ('brand' | 'influencer' | 'content' | 'emoji' | 'spam')[];
|
|
58
|
+
|
|
59
|
+
@Prop({
|
|
60
|
+
type: String,
|
|
61
|
+
enum: ['positive', 'negative', 'neutral'],
|
|
62
|
+
required: false,
|
|
63
|
+
default: null,
|
|
64
|
+
})
|
|
65
|
+
polarity?: 'positive' | 'negative' | 'neutral' | null;
|
|
66
|
+
|
|
67
|
+
@Prop({
|
|
68
|
+
type: String,
|
|
69
|
+
enum: ['awareness', 'consideration', 'conversion'],
|
|
70
|
+
required: false,
|
|
71
|
+
default: null,
|
|
72
|
+
})
|
|
73
|
+
funnel?: 'awareness' | 'consideration' | 'conversion' | null;
|
|
74
|
+
|
|
75
|
+
@Prop({ type: Boolean, required: false, default: false })
|
|
76
|
+
isEmojiOnly?: boolean;
|
|
77
|
+
|
|
78
|
+
@Prop({ type: Boolean, required: false, default: false })
|
|
79
|
+
isSpam?: boolean;
|
|
80
|
+
|
|
81
|
+
@Prop({ default: Date.now, required: false })
|
|
82
|
+
createdAt?: Date;
|
|
83
|
+
|
|
84
|
+
@Prop({ default: Date.now, required: false })
|
|
85
|
+
updatedAt?: Date;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export const CommentSchema = SchemaFactory.createForClass(Comment);
|
|
89
|
+
|
|
90
|
+
CommentSchema.index({ content: 1, externalId: 1 }, { unique: true });
|
|
91
|
+
CommentSchema.index({ action: 1, funnel: 1 });
|
|
92
|
+
CommentSchema.index({ action: 1, target: 1 });
|
|
93
|
+
CommentSchema.index({ content: 1, parent: 1 });
|
|
94
|
+
|
|
95
|
+
export const CommentModel = MongooseModel('Comment', CommentSchema);
|