@intelact/bright 0.9.76 → 0.9.78
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/dtos/boost.dto.d.ts +0 -12
- package/lib/dtos/boost.dto.js +1 -50
- package/lib/dtos/boost.dto.js.map +1 -1
- package/lib/dtos/brand.dto.d.ts +0 -15
- package/lib/dtos/brand.dto.js +1 -46
- package/lib/dtos/brand.dto.js.map +1 -1
- package/lib/dtos/feedback.dto.d.ts +0 -9
- package/lib/dtos/feedback.dto.js +1 -28
- package/lib/dtos/feedback.dto.js.map +1 -1
- package/lib/dtos/general.dto.d.ts +3 -0
- package/lib/dtos/general.dto.js +10 -1
- package/lib/dtos/general.dto.js.map +1 -1
- package/lib/dtos/index.d.ts +0 -4
- package/lib/dtos/index.js +0 -4
- package/lib/dtos/index.js.map +1 -1
- package/lib/dtos/post.dto.d.ts +0 -22
- package/lib/dtos/post.dto.js +1 -65
- package/lib/dtos/post.dto.js.map +1 -1
- package/lib/dtos/promotion.dto.d.ts +0 -8
- package/lib/dtos/promotion.dto.js +1 -37
- package/lib/dtos/promotion.dto.js.map +1 -1
- package/lib/dtos/question.dto.d.ts +0 -19
- package/lib/dtos/question.dto.js +1 -62
- package/lib/dtos/question.dto.js.map +1 -1
- package/lib/dtos/search.dto.d.ts +12 -0
- package/lib/dtos/search.dto.js +72 -0
- package/lib/dtos/search.dto.js.map +1 -0
- package/lib/dtos/survey.dto.d.ts +0 -24
- package/lib/dtos/survey.dto.js +1 -90
- package/lib/dtos/survey.dto.js.map +1 -1
- package/lib/dtos/user.dto.d.ts +0 -3
- package/lib/dtos/user.dto.js +1 -10
- package/lib/dtos/user.dto.js.map +1 -1
- package/lib/enums/asset.enum.js.map +1 -1
- package/lib/enums/index.d.ts +0 -1
- package/lib/enums/index.js +0 -1
- package/lib/enums/index.js.map +1 -1
- package/lib/enums/module.enum.d.ts +0 -19
- package/lib/enums/module.enum.js +1 -21
- package/lib/enums/module.enum.js.map +1 -1
- package/lib/enums/setting.enum.d.ts +2 -2
- package/lib/enums/setting.enum.js +2 -2
- package/lib/enums/tracks.enum.d.ts +13 -2
- package/lib/enums/tracks.enum.js +23 -11
- package/lib/enums/tracks.enum.js.map +1 -1
- package/lib/helpers/index.d.ts +2 -0
- package/lib/helpers/index.js +19 -0
- package/lib/helpers/index.js.map +1 -0
- package/lib/helpers/popularity.helper.d.ts +2 -0
- package/lib/helpers/popularity.helper.js +58 -0
- package/lib/helpers/popularity.helper.js.map +1 -0
- package/lib/helpers/post.helper.d.ts +2 -0
- package/lib/helpers/post.helper.js +22 -0
- package/lib/helpers/post.helper.js.map +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/models/author.d.ts +6 -4
- package/lib/models/author.js +22 -18
- package/lib/models/author.js.map +1 -1
- package/lib/models/boost.d.ts +6 -7
- package/lib/models/boost.js +22 -29
- package/lib/models/boost.js.map +1 -1
- package/lib/models/brand.d.ts +6 -4
- package/lib/models/brand.js +38 -18
- package/lib/models/brand.js.map +1 -1
- package/lib/models/category.d.ts +2 -1
- package/lib/models/category.js +6 -5
- package/lib/models/category.js.map +1 -1
- package/lib/models/collection.d.ts +5 -5
- package/lib/models/collection.js +20 -20
- package/lib/models/collection.js.map +1 -1
- package/lib/models/feedback.d.ts +8 -5
- package/lib/models/feedback.js +37 -54
- package/lib/models/feedback.js.map +1 -1
- package/lib/models/index.d.ts +2 -1
- package/lib/models/index.js +2 -1
- package/lib/models/index.js.map +1 -1
- package/lib/models/log.d.ts +11 -0
- package/lib/models/log.js +16 -0
- package/lib/models/log.js.map +1 -0
- package/lib/models/metric.d.ts +20 -0
- package/lib/models/metric.js +186 -0
- package/lib/models/metric.js.map +1 -0
- package/lib/models/post.d.ts +26 -36
- package/lib/models/post.js +238 -358
- package/lib/models/post.js.map +1 -1
- package/lib/models/promotion.d.ts +9 -3
- package/lib/models/promotion.js +40 -8
- package/lib/models/promotion.js.map +1 -1
- package/lib/models/publisher.d.ts +8 -3
- package/lib/models/publisher.js +34 -14
- package/lib/models/publisher.js.map +1 -1
- package/lib/models/question.d.ts +21 -27
- package/lib/models/question.js +95 -162
- package/lib/models/question.js.map +1 -1
- package/lib/models/quote.d.ts +0 -1
- package/lib/models/quote.js +0 -6
- package/lib/models/quote.js.map +1 -1
- package/lib/models/survey.d.ts +15 -9
- package/lib/models/survey.js +70 -54
- package/lib/models/survey.js.map +1 -1
- package/lib/models/topic.d.ts +5 -1
- package/lib/models/topic.js +21 -55
- package/lib/models/topic.js.map +1 -1
- package/lib/models/user.d.ts +4 -4
- package/lib/models/user.js +100 -22
- package/lib/models/user.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
package/lib/models/post.js
CHANGED
@@ -18,16 +18,11 @@ const enums_1 = require("../enums");
|
|
18
18
|
const gallery_1 = require("./gallery");
|
19
19
|
const feedback_1 = require("./feedback");
|
20
20
|
const item_1 = require("./item");
|
21
|
-
const
|
21
|
+
const metric_1 = require("./metric");
|
22
|
+
const log_1 = require("./log");
|
23
|
+
const helpers_1 = require("../helpers");
|
22
24
|
class Post {
|
23
25
|
id;
|
24
|
-
publisher;
|
25
|
-
author;
|
26
|
-
topics;
|
27
|
-
feedback;
|
28
|
-
collection;
|
29
|
-
gallery;
|
30
|
-
postType;
|
31
26
|
slug;
|
32
27
|
title;
|
33
28
|
description;
|
@@ -36,96 +31,204 @@ class Post {
|
|
36
31
|
duration;
|
37
32
|
icon;
|
38
33
|
svgIcon;
|
39
|
-
tags;
|
40
34
|
pdfUrl;
|
41
35
|
imageUrl;
|
42
36
|
feedUrl;
|
43
37
|
mediaUrl;
|
44
38
|
externUrl;
|
45
39
|
status;
|
40
|
+
postType;
|
46
41
|
weight;
|
47
42
|
popularity;
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
updatedBy;
|
68
|
-
statusChangeDate;
|
69
|
-
statusChangeBy;
|
70
|
-
publishedDate;
|
71
|
-
publishedBy;
|
43
|
+
totalSeen;
|
44
|
+
metricOpens;
|
45
|
+
metricLikes;
|
46
|
+
metricShares;
|
47
|
+
metricBookmarks;
|
48
|
+
metricDownloads;
|
49
|
+
metricFeedbacks;
|
50
|
+
statusChanged;
|
51
|
+
published;
|
52
|
+
blocked;
|
53
|
+
created;
|
54
|
+
updated;
|
55
|
+
deleted;
|
56
|
+
publisher;
|
57
|
+
author;
|
58
|
+
topics;
|
59
|
+
feedback;
|
60
|
+
collection;
|
61
|
+
gallery;
|
72
62
|
constructor(props) {
|
73
63
|
Object.assign(this, props);
|
74
64
|
}
|
75
65
|
get type() {
|
76
66
|
return this.postType;
|
77
67
|
}
|
68
|
+
getStatusAuthorizations() {
|
69
|
+
switch (this.status) {
|
70
|
+
case enums_1.StatusType.Draft:
|
71
|
+
return {
|
72
|
+
draft: false,
|
73
|
+
approve: true,
|
74
|
+
publish: true,
|
75
|
+
unpublish: false,
|
76
|
+
archive: true,
|
77
|
+
unarchive: false,
|
78
|
+
block: true,
|
79
|
+
unblock: false
|
80
|
+
};
|
81
|
+
case enums_1.StatusType.ReadyForPublish:
|
82
|
+
return {
|
83
|
+
draft: true,
|
84
|
+
approve: false,
|
85
|
+
publish: true,
|
86
|
+
unpublish: false,
|
87
|
+
archive: false,
|
88
|
+
unarchive: false,
|
89
|
+
block: true,
|
90
|
+
unblock: false
|
91
|
+
};
|
92
|
+
case enums_1.StatusType.Published:
|
93
|
+
return {
|
94
|
+
draft: false,
|
95
|
+
approve: false,
|
96
|
+
publish: false,
|
97
|
+
unpublish: true,
|
98
|
+
archive: true,
|
99
|
+
unarchive: false,
|
100
|
+
block: true,
|
101
|
+
unblock: false
|
102
|
+
};
|
103
|
+
case enums_1.StatusType.Archived:
|
104
|
+
return {
|
105
|
+
draft: false,
|
106
|
+
approve: false,
|
107
|
+
publish: false,
|
108
|
+
unpublish: false,
|
109
|
+
archive: false,
|
110
|
+
unarchive: true,
|
111
|
+
block: false,
|
112
|
+
unblock: false
|
113
|
+
};
|
114
|
+
case enums_1.StatusType.Blocked:
|
115
|
+
return {
|
116
|
+
draft: false,
|
117
|
+
approve: false,
|
118
|
+
publish: false,
|
119
|
+
unpublish: false,
|
120
|
+
archive: false,
|
121
|
+
unarchive: false,
|
122
|
+
block: false,
|
123
|
+
unblock: true
|
124
|
+
};
|
125
|
+
default:
|
126
|
+
return {
|
127
|
+
draft: false,
|
128
|
+
approve: false,
|
129
|
+
publish: false,
|
130
|
+
unpublish: false,
|
131
|
+
archive: false,
|
132
|
+
unarchive: false,
|
133
|
+
block: false,
|
134
|
+
unblock: false
|
135
|
+
};
|
136
|
+
}
|
137
|
+
}
|
78
138
|
getPublishValidators() {
|
79
139
|
const postType = this.postType;
|
80
140
|
const validators = [];
|
81
|
-
validators.push(new item_1.Item({
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
141
|
+
validators.push(new item_1.Item({
|
142
|
+
name: 'author',
|
143
|
+
title: 'author',
|
144
|
+
icon: 'user'
|
145
|
+
}));
|
146
|
+
validators.push(new item_1.Item({
|
147
|
+
name: 'title',
|
148
|
+
title: 'title',
|
149
|
+
icon: 't'
|
150
|
+
}));
|
151
|
+
validators.push(new item_1.Item({
|
152
|
+
name: 'description',
|
153
|
+
title: 'daysescription',
|
154
|
+
icon: 'align-left'
|
155
|
+
}));
|
156
|
+
validators.push(new item_1.Item({
|
157
|
+
name: 'image',
|
158
|
+
title: 'image',
|
159
|
+
icon: 'image'
|
160
|
+
}));
|
161
|
+
validators.push(new item_1.Item({
|
162
|
+
name: 'feed',
|
163
|
+
title: 'postFeed',
|
164
|
+
icon: 'mobile-screen'
|
165
|
+
}));
|
86
166
|
if ([enums_1.PostType.Article, enums_1.PostType.Event, enums_1.PostType.News].includes(postType)) {
|
87
|
-
validators.push(new item_1.Item({
|
167
|
+
validators.push(new item_1.Item({
|
168
|
+
name: 'content',
|
169
|
+
title: 'content',
|
170
|
+
icon: 'align-justify'
|
171
|
+
}));
|
88
172
|
}
|
89
173
|
if (postType === enums_1.PostType.Book) {
|
90
|
-
validators.push(new item_1.Item({
|
174
|
+
validators.push(new item_1.Item({
|
175
|
+
name: 'pdf',
|
176
|
+
title: 'pdf',
|
177
|
+
icon: 'file-pdf'
|
178
|
+
}));
|
91
179
|
}
|
92
180
|
if (postType === enums_1.PostType.Audio) {
|
93
|
-
validators.push(new item_1.Item({
|
181
|
+
validators.push(new item_1.Item({
|
182
|
+
name: 'audio',
|
183
|
+
title: 'audio',
|
184
|
+
icon: 'microphone'
|
185
|
+
}));
|
94
186
|
}
|
95
187
|
if (postType === enums_1.PostType.Video) {
|
96
|
-
validators.push(new item_1.Item({
|
188
|
+
validators.push(new item_1.Item({
|
189
|
+
name: 'video',
|
190
|
+
title: 'video',
|
191
|
+
icon: 'file-video'
|
192
|
+
}));
|
97
193
|
}
|
98
194
|
if (postType === enums_1.PostType.Event) {
|
99
|
-
validators.push(new item_1.Item({
|
195
|
+
validators.push(new item_1.Item({
|
196
|
+
name: 'schedule',
|
197
|
+
title: 'eventSchedule',
|
198
|
+
icon: 'calendar-days'
|
199
|
+
}));
|
100
200
|
}
|
101
201
|
return validators;
|
102
202
|
}
|
103
203
|
validateForPublish() {
|
104
|
-
const postType = this.postType;
|
105
204
|
if (!this.status)
|
106
205
|
return false;
|
107
|
-
if (!this.author
|
206
|
+
if (!this.author) {
|
108
207
|
return false;
|
109
|
-
|
208
|
+
}
|
209
|
+
if (this.description?.trim()?.length === 0) {
|
110
210
|
return false;
|
111
|
-
|
211
|
+
}
|
212
|
+
if (this.imageUrl?.trim()?.length === 0) {
|
112
213
|
return false;
|
113
|
-
|
214
|
+
}
|
215
|
+
if (this.feedUrl?.trim()?.length) {
|
114
216
|
return false;
|
217
|
+
}
|
115
218
|
const contentMandatory = [enums_1.PostType.Article, enums_1.PostType.Event, enums_1.PostType.News];
|
116
|
-
if (contentMandatory.includes(
|
219
|
+
if (contentMandatory.includes(this.type) && !this.content?.trim()) {
|
117
220
|
return false;
|
118
221
|
}
|
119
|
-
if (
|
222
|
+
if (this.type === enums_1.PostType.Book && !this.pdfUrl?.trim()) {
|
120
223
|
return false;
|
121
224
|
}
|
122
|
-
if (
|
225
|
+
if (this.type === enums_1.PostType.Audio && !this.mediaUrl?.trim()) {
|
123
226
|
return false;
|
124
227
|
}
|
125
|
-
if (
|
228
|
+
if (this.type === enums_1.PostType.Video && !this.mediaUrl?.trim()) {
|
126
229
|
return false;
|
127
230
|
}
|
128
|
-
if (
|
231
|
+
if (this.type === enums_1.PostType.Event && !this.info?.events || this.info.events?.length === 0) {
|
129
232
|
return false;
|
130
233
|
}
|
131
234
|
return true;
|
@@ -152,39 +255,6 @@ __decorate([
|
|
152
255
|
(0, class_transformer_1.Type)(() => Number),
|
153
256
|
__metadata("design:type", Number)
|
154
257
|
], Post.prototype, "id", void 0);
|
155
|
-
__decorate([
|
156
|
-
(0, class_transformer_1.Expose)(),
|
157
|
-
(0, class_transformer_1.Type)(() => publisher_1.Publisher),
|
158
|
-
__metadata("design:type", publisher_1.Publisher)
|
159
|
-
], Post.prototype, "publisher", void 0);
|
160
|
-
__decorate([
|
161
|
-
(0, class_transformer_1.Expose)(),
|
162
|
-
(0, class_transformer_1.Type)(() => author_1.Author),
|
163
|
-
__metadata("design:type", author_1.Author)
|
164
|
-
], Post.prototype, "author", void 0);
|
165
|
-
__decorate([
|
166
|
-
(0, class_transformer_1.Type)(() => topic_1.Topic),
|
167
|
-
__metadata("design:type", Array)
|
168
|
-
], Post.prototype, "topics", void 0);
|
169
|
-
__decorate([
|
170
|
-
(0, class_transformer_1.Expose)(),
|
171
|
-
(0, class_transformer_1.Type)(() => feedback_1.Feedback),
|
172
|
-
__metadata("design:type", feedback_1.Feedback)
|
173
|
-
], Post.prototype, "feedback", void 0);
|
174
|
-
__decorate([
|
175
|
-
(0, class_transformer_1.Expose)(),
|
176
|
-
(0, class_transformer_1.Type)(() => Post),
|
177
|
-
__metadata("design:type", Array)
|
178
|
-
], Post.prototype, "collection", void 0);
|
179
|
-
__decorate([
|
180
|
-
(0, class_transformer_1.Expose)(),
|
181
|
-
(0, class_transformer_1.Type)(() => gallery_1.GalleryItem),
|
182
|
-
__metadata("design:type", Array)
|
183
|
-
], Post.prototype, "gallery", void 0);
|
184
|
-
__decorate([
|
185
|
-
(0, class_transformer_1.Expose)(),
|
186
|
-
__metadata("design:type", String)
|
187
|
-
], Post.prototype, "postType", void 0);
|
188
258
|
__decorate([
|
189
259
|
(0, class_transformer_1.Expose)(),
|
190
260
|
__metadata("design:type", String)
|
@@ -221,49 +291,14 @@ __decorate([
|
|
221
291
|
], Post.prototype, "duration", void 0);
|
222
292
|
__decorate([
|
223
293
|
(0, class_transformer_1.Expose)(),
|
224
|
-
(0, class_transformer_1.Transform)(({ obj }) =>
|
225
|
-
switch (obj.postType) {
|
226
|
-
case enums_1.PostType.Article:
|
227
|
-
return 'file-lines';
|
228
|
-
case enums_1.PostType.Book:
|
229
|
-
return 'book-open';
|
230
|
-
case enums_1.PostType.Audio:
|
231
|
-
return 'headphones';
|
232
|
-
case enums_1.PostType.Video:
|
233
|
-
return 'circle-play';
|
234
|
-
case enums_1.PostType.News:
|
235
|
-
return 'newspaper';
|
236
|
-
case enums_1.PostType.Event:
|
237
|
-
return 'microphone';
|
238
|
-
}
|
239
|
-
}),
|
294
|
+
(0, class_transformer_1.Transform)(({ obj }) => (0, helpers_1.getPostIcon)(obj?.postType)),
|
240
295
|
__metadata("design:type", Object)
|
241
296
|
], Post.prototype, "icon", void 0);
|
242
297
|
__decorate([
|
243
298
|
(0, class_transformer_1.Expose)(),
|
244
|
-
(0, class_transformer_1.Transform)(({ obj }) =>
|
245
|
-
switch (obj.postType) {
|
246
|
-
case enums_1.PostType.Article:
|
247
|
-
return '/assets/icons/content-type-article.svg';
|
248
|
-
case enums_1.PostType.Book:
|
249
|
-
return '/assets/icons/content-type-book.svg';
|
250
|
-
case enums_1.PostType.Audio:
|
251
|
-
return '/assets/icons/content-type-audio.svg';
|
252
|
-
case enums_1.PostType.Video:
|
253
|
-
return '/assets/icons/content-type-video.svg';
|
254
|
-
case enums_1.PostType.News:
|
255
|
-
return '/assets/icons/content-type-news.svg';
|
256
|
-
case enums_1.PostType.Event:
|
257
|
-
return '/assets/icons/content-type-event.svg';
|
258
|
-
}
|
259
|
-
}),
|
299
|
+
(0, class_transformer_1.Transform)(({ obj }) => (0, helpers_1.getPostIcon)(obj?.postType, true)),
|
260
300
|
__metadata("design:type", String)
|
261
301
|
], Post.prototype, "svgIcon", void 0);
|
262
|
-
__decorate([
|
263
|
-
(0, class_transformer_1.Expose)(),
|
264
|
-
(0, class_transformer_1.Transform)(({ obj }) => (obj?.topics?.map((i) => i.hash) || [])),
|
265
|
-
__metadata("design:type", Array)
|
266
|
-
], Post.prototype, "tags", void 0);
|
267
302
|
__decorate([
|
268
303
|
(0, class_transformer_1.Expose)(),
|
269
304
|
__metadata("design:type", String)
|
@@ -288,6 +323,10 @@ __decorate([
|
|
288
323
|
(0, class_transformer_1.Expose)({ groups: ['admin'] }),
|
289
324
|
__metadata("design:type", String)
|
290
325
|
], Post.prototype, "status", void 0);
|
326
|
+
__decorate([
|
327
|
+
(0, class_transformer_1.Expose)(),
|
328
|
+
__metadata("design:type", String)
|
329
|
+
], Post.prototype, "postType", void 0);
|
291
330
|
__decorate([
|
292
331
|
(0, class_transformer_1.Expose)({ groups: ['admin'] }),
|
293
332
|
(0, class_transformer_1.Type)(() => Number),
|
@@ -296,275 +335,116 @@ __decorate([
|
|
296
335
|
__decorate([
|
297
336
|
(0, class_transformer_1.Expose)(),
|
298
337
|
(0, class_transformer_1.Type)(() => item_1.Item),
|
299
|
-
(0, class_transformer_1.Transform)(({ obj }) =>
|
300
|
-
if (obj.weight < 1.9999) {
|
301
|
-
return new item_1.Item({
|
302
|
-
title: enums_1.Popularity.Poor,
|
303
|
-
value: obj.weight,
|
304
|
-
context: enums_1.Context.Secondary
|
305
|
-
});
|
306
|
-
}
|
307
|
-
if (obj.weight >= 2 && obj.weight < 3.9999) {
|
308
|
-
return new item_1.Item({
|
309
|
-
title: enums_1.Popularity.Week,
|
310
|
-
value: obj.weight,
|
311
|
-
context: enums_1.Context.Dark
|
312
|
-
});
|
313
|
-
}
|
314
|
-
if (obj.weight >= 4 && obj.weight < 5.9999) {
|
315
|
-
return new item_1.Item({
|
316
|
-
title: enums_1.Popularity.Fair,
|
317
|
-
value: obj.weight,
|
318
|
-
context: enums_1.Context.Primary
|
319
|
-
});
|
320
|
-
}
|
321
|
-
if (obj.weight >= 6 && obj.weight < 7.9999) {
|
322
|
-
return new item_1.Item({
|
323
|
-
title: enums_1.Popularity.Great,
|
324
|
-
value: obj.weight,
|
325
|
-
context: enums_1.Context.Info
|
326
|
-
});
|
327
|
-
}
|
328
|
-
if (obj.weight >= 8 && obj.weight < 8.9999) {
|
329
|
-
return new item_1.Item({
|
330
|
-
title: enums_1.Popularity.Excellent,
|
331
|
-
value: obj.weight,
|
332
|
-
context: enums_1.Context.Success
|
333
|
-
});
|
334
|
-
}
|
335
|
-
if (obj.weight >= 9 && obj.weight <= 10) {
|
336
|
-
return new item_1.Item({
|
337
|
-
title: enums_1.Popularity.Exceptional,
|
338
|
-
value: obj.weight,
|
339
|
-
context: enums_1.Context.Danger
|
340
|
-
});
|
341
|
-
}
|
342
|
-
return new item_1.Item({
|
343
|
-
title: 'n/A',
|
344
|
-
value: 0,
|
345
|
-
context: enums_1.Context.Light
|
346
|
-
});
|
347
|
-
}),
|
338
|
+
(0, class_transformer_1.Transform)(({ obj }) => (0, helpers_1.getPopularityByWeight)(obj.weight)),
|
348
339
|
__metadata("design:type", item_1.Item)
|
349
340
|
], Post.prototype, "popularity", void 0);
|
350
|
-
__decorate([
|
351
|
-
(0, class_transformer_1.Expose)({ groups: ['admin'] }),
|
352
|
-
(0, class_transformer_1.Transform)(({ obj }) => {
|
353
|
-
switch (obj.status) {
|
354
|
-
case enums_1.StatusType.Draft:
|
355
|
-
return {
|
356
|
-
draft: false,
|
357
|
-
approve: true,
|
358
|
-
publish: true,
|
359
|
-
unpublish: false,
|
360
|
-
archive: true,
|
361
|
-
unarchive: false,
|
362
|
-
block: true,
|
363
|
-
unblock: false
|
364
|
-
};
|
365
|
-
case enums_1.StatusType.ReadyForPublish:
|
366
|
-
return {
|
367
|
-
draft: true,
|
368
|
-
approve: false,
|
369
|
-
publish: true,
|
370
|
-
unpublish: false,
|
371
|
-
archive: false,
|
372
|
-
unarchive: false,
|
373
|
-
block: true,
|
374
|
-
unblock: false
|
375
|
-
};
|
376
|
-
case enums_1.StatusType.Published:
|
377
|
-
return {
|
378
|
-
draft: false,
|
379
|
-
approve: false,
|
380
|
-
publish: false,
|
381
|
-
unpublish: true,
|
382
|
-
archive: true,
|
383
|
-
unarchive: false,
|
384
|
-
block: true,
|
385
|
-
unblock: false
|
386
|
-
};
|
387
|
-
case enums_1.StatusType.Archived:
|
388
|
-
return {
|
389
|
-
draft: false,
|
390
|
-
approve: false,
|
391
|
-
publish: false,
|
392
|
-
unpublish: false,
|
393
|
-
archive: false,
|
394
|
-
unarchive: true,
|
395
|
-
block: false,
|
396
|
-
unblock: false
|
397
|
-
};
|
398
|
-
case enums_1.StatusType.Blocked:
|
399
|
-
return {
|
400
|
-
draft: false,
|
401
|
-
approve: false,
|
402
|
-
publish: false,
|
403
|
-
unpublish: false,
|
404
|
-
archive: false,
|
405
|
-
unarchive: false,
|
406
|
-
block: false,
|
407
|
-
unblock: true
|
408
|
-
};
|
409
|
-
default:
|
410
|
-
return {
|
411
|
-
draft: false,
|
412
|
-
approve: false,
|
413
|
-
publish: false,
|
414
|
-
unpublish: false,
|
415
|
-
archive: false,
|
416
|
-
unarchive: false,
|
417
|
-
block: false,
|
418
|
-
unblock: false
|
419
|
-
};
|
420
|
-
}
|
421
|
-
}),
|
422
|
-
__metadata("design:type", Object)
|
423
|
-
], Post.prototype, "authorizedStatus", void 0);
|
424
341
|
__decorate([
|
425
342
|
(0, class_transformer_1.Expose)(),
|
426
|
-
(0, class_transformer_1.Type)(() =>
|
427
|
-
|
428
|
-
|
343
|
+
(0, class_transformer_1.Type)(() => metric_1.Metric),
|
344
|
+
(0, class_transformer_1.Transform)(({ obj }) => metric_1.Metric.seen(obj?.totalSeen, obj?.hasSeen)),
|
345
|
+
__metadata("design:type", metric_1.Metric)
|
346
|
+
], Post.prototype, "totalSeen", void 0);
|
429
347
|
__decorate([
|
430
348
|
(0, class_transformer_1.Expose)(),
|
431
|
-
(0, class_transformer_1.Type)(() =>
|
432
|
-
|
433
|
-
|
349
|
+
(0, class_transformer_1.Type)(() => item_1.Item),
|
350
|
+
(0, class_transformer_1.Transform)(({ obj }) => metric_1.Metric.open(obj?.totalOpens, obj?.hasOpen)),
|
351
|
+
__metadata("design:type", metric_1.Metric)
|
352
|
+
], Post.prototype, "metricOpens", void 0);
|
434
353
|
__decorate([
|
435
354
|
(0, class_transformer_1.Expose)(),
|
436
|
-
(0, class_transformer_1.Type)(() =>
|
437
|
-
|
438
|
-
|
355
|
+
(0, class_transformer_1.Type)(() => metric_1.Metric),
|
356
|
+
(0, class_transformer_1.Transform)(({ obj }) => metric_1.Metric.like(obj?.totalLikes, obj?.hasLike)),
|
357
|
+
__metadata("design:type", metric_1.Metric)
|
358
|
+
], Post.prototype, "metricLikes", void 0);
|
439
359
|
__decorate([
|
440
360
|
(0, class_transformer_1.Expose)(),
|
441
|
-
(0, class_transformer_1.Type)(() =>
|
442
|
-
|
443
|
-
|
361
|
+
(0, class_transformer_1.Type)(() => metric_1.Metric),
|
362
|
+
(0, class_transformer_1.Transform)(({ obj }) => metric_1.Metric.share(obj?.totalShares, obj?.hasShare)),
|
363
|
+
__metadata("design:type", metric_1.Metric)
|
364
|
+
], Post.prototype, "metricShares", void 0);
|
444
365
|
__decorate([
|
445
366
|
(0, class_transformer_1.Expose)(),
|
446
|
-
(0, class_transformer_1.Type)(() =>
|
447
|
-
|
448
|
-
|
367
|
+
(0, class_transformer_1.Type)(() => metric_1.Metric),
|
368
|
+
(0, class_transformer_1.Transform)(({ obj }) => metric_1.Metric.bookmark(obj?.totalBookmarks, obj?.hasBookmark)),
|
369
|
+
__metadata("design:type", metric_1.Metric)
|
370
|
+
], Post.prototype, "metricBookmarks", void 0);
|
449
371
|
__decorate([
|
450
372
|
(0, class_transformer_1.Expose)(),
|
451
|
-
(0, class_transformer_1.Type)(() =>
|
452
|
-
|
453
|
-
|
373
|
+
(0, class_transformer_1.Type)(() => metric_1.Metric),
|
374
|
+
(0, class_transformer_1.Transform)(({ obj }) => metric_1.Metric.download(obj?.totalDownloads, obj?.hasDownload)),
|
375
|
+
__metadata("design:type", metric_1.Metric)
|
376
|
+
], Post.prototype, "metricDownloads", void 0);
|
454
377
|
__decorate([
|
455
378
|
(0, class_transformer_1.Expose)(),
|
456
|
-
(0, class_transformer_1.Type)(() =>
|
457
|
-
|
458
|
-
|
379
|
+
(0, class_transformer_1.Type)(() => metric_1.Metric),
|
380
|
+
(0, class_transformer_1.Transform)(({ obj }) => metric_1.Metric.feedback(obj?.totalFeedbacks, obj?.hasFeedback)),
|
381
|
+
__metadata("design:type", metric_1.Metric)
|
382
|
+
], Post.prototype, "metricFeedbacks", void 0);
|
459
383
|
__decorate([
|
460
|
-
(0, class_transformer_1.Expose)(),
|
461
|
-
(0, class_transformer_1.Type)(() =>
|
462
|
-
__metadata("design:type",
|
463
|
-
], Post.prototype, "
|
384
|
+
(0, class_transformer_1.Expose)({ groups: ['admin'] }),
|
385
|
+
(0, class_transformer_1.Type)(() => log_1.Log),
|
386
|
+
__metadata("design:type", log_1.Log)
|
387
|
+
], Post.prototype, "statusChanged", void 0);
|
464
388
|
__decorate([
|
465
389
|
(0, class_transformer_1.Expose)(),
|
466
|
-
(0, class_transformer_1.Type)(() =>
|
467
|
-
__metadata("design:type",
|
468
|
-
], Post.prototype, "
|
390
|
+
(0, class_transformer_1.Type)(() => log_1.Log),
|
391
|
+
__metadata("design:type", log_1.Log)
|
392
|
+
], Post.prototype, "published", void 0);
|
469
393
|
__decorate([
|
470
|
-
(0, class_transformer_1.Expose)(),
|
471
|
-
(0, class_transformer_1.Type)(() =>
|
472
|
-
(
|
473
|
-
|
474
|
-
active: obj.isBookmarked,
|
475
|
-
icon: ['far', 'bookmark'],
|
476
|
-
iconSelected: ['fas', 'bookmark'],
|
477
|
-
})),
|
478
|
-
__metadata("design:type", item_1.Item)
|
479
|
-
], Post.prototype, "bookmark", void 0);
|
394
|
+
(0, class_transformer_1.Expose)({ groups: ['admin'] }),
|
395
|
+
(0, class_transformer_1.Type)(() => log_1.Log),
|
396
|
+
__metadata("design:type", log_1.Log)
|
397
|
+
], Post.prototype, "blocked", void 0);
|
480
398
|
__decorate([
|
481
|
-
(0, class_transformer_1.Expose)(),
|
482
|
-
(0, class_transformer_1.Type)(() =>
|
483
|
-
(
|
484
|
-
|
485
|
-
active: obj.isLiked,
|
486
|
-
icon: ['far', 'heart'],
|
487
|
-
iconSelected: ['fas', 'heart'],
|
488
|
-
})),
|
489
|
-
__metadata("design:type", item_1.Item)
|
490
|
-
], Post.prototype, "like", void 0);
|
399
|
+
(0, class_transformer_1.Expose)({ groups: ['admin'] }),
|
400
|
+
(0, class_transformer_1.Type)(() => log_1.Log),
|
401
|
+
__metadata("design:type", log_1.Log)
|
402
|
+
], Post.prototype, "created", void 0);
|
491
403
|
__decorate([
|
492
|
-
(0, class_transformer_1.Expose)(),
|
493
|
-
(0, class_transformer_1.Type)(() =>
|
494
|
-
(
|
495
|
-
|
496
|
-
active: obj.isShared,
|
497
|
-
icon: ['far', 'share-from-square'],
|
498
|
-
iconSelected: ['fas', 'share-from-square'],
|
499
|
-
})),
|
500
|
-
__metadata("design:type", item_1.Item)
|
501
|
-
], Post.prototype, "share", void 0);
|
404
|
+
(0, class_transformer_1.Expose)({ groups: ['admin'] }),
|
405
|
+
(0, class_transformer_1.Type)(() => log_1.Log),
|
406
|
+
__metadata("design:type", log_1.Log)
|
407
|
+
], Post.prototype, "updated", void 0);
|
502
408
|
__decorate([
|
503
|
-
(0, class_transformer_1.Expose)(),
|
504
|
-
(0, class_transformer_1.Type)(() =>
|
505
|
-
(
|
506
|
-
|
507
|
-
icon: ['fas', 'eye'],
|
508
|
-
iconSelected: ['fas', 'eye'],
|
509
|
-
})),
|
510
|
-
__metadata("design:type", item_1.Item)
|
511
|
-
], Post.prototype, "hit", void 0);
|
409
|
+
(0, class_transformer_1.Expose)({ groups: ['console'] }),
|
410
|
+
(0, class_transformer_1.Type)(() => log_1.Log),
|
411
|
+
__metadata("design:type", log_1.Log)
|
412
|
+
], Post.prototype, "deleted", void 0);
|
512
413
|
__decorate([
|
513
414
|
(0, class_transformer_1.Expose)(),
|
514
|
-
(0, class_transformer_1.Type)(() =>
|
515
|
-
(
|
516
|
-
|
517
|
-
active: obj.isDownloaded,
|
518
|
-
icon: ['fas', 'download'],
|
519
|
-
iconSelected: ['fas', 'download'],
|
520
|
-
})),
|
521
|
-
__metadata("design:type", item_1.Item)
|
522
|
-
], Post.prototype, "download", void 0);
|
415
|
+
(0, class_transformer_1.Type)(() => publisher_1.Publisher),
|
416
|
+
__metadata("design:type", publisher_1.Publisher)
|
417
|
+
], Post.prototype, "publisher", void 0);
|
523
418
|
__decorate([
|
524
419
|
(0, class_transformer_1.Expose)(),
|
525
|
-
(0, class_transformer_1.Type)(() =>
|
526
|
-
__metadata("design:type",
|
527
|
-
], Post.prototype, "
|
528
|
-
__decorate([
|
529
|
-
(0, class_transformer_1.Expose)({ groups: ['admin'] }),
|
530
|
-
(0, class_transformer_1.Type)(() => Date),
|
531
|
-
__metadata("design:type", Date)
|
532
|
-
], Post.prototype, "createdOn", void 0);
|
533
|
-
__decorate([
|
534
|
-
(0, class_transformer_1.Expose)({ groups: ['admin'] }),
|
535
|
-
(0, class_transformer_1.Type)(() => user_1.User),
|
536
|
-
__metadata("design:type", user_1.User)
|
537
|
-
], Post.prototype, "createdBy", void 0);
|
538
|
-
__decorate([
|
539
|
-
(0, class_transformer_1.Expose)({ groups: ['admin'] }),
|
540
|
-
(0, class_transformer_1.Type)(() => Date),
|
541
|
-
__metadata("design:type", Date)
|
542
|
-
], Post.prototype, "updatedOn", void 0);
|
420
|
+
(0, class_transformer_1.Type)(() => author_1.Author),
|
421
|
+
__metadata("design:type", author_1.Author)
|
422
|
+
], Post.prototype, "author", void 0);
|
543
423
|
__decorate([
|
544
|
-
(0, class_transformer_1.
|
545
|
-
(
|
546
|
-
|
547
|
-
], Post.prototype, "updatedBy", void 0);
|
424
|
+
(0, class_transformer_1.Type)(() => topic_1.Topic),
|
425
|
+
__metadata("design:type", Array)
|
426
|
+
], Post.prototype, "topics", void 0);
|
548
427
|
__decorate([
|
549
|
-
(0, class_transformer_1.Expose)(
|
550
|
-
(0, class_transformer_1.Type)(() =>
|
551
|
-
__metadata("design:type",
|
552
|
-
], Post.prototype, "
|
428
|
+
(0, class_transformer_1.Expose)(),
|
429
|
+
(0, class_transformer_1.Type)(() => feedback_1.Feedback),
|
430
|
+
__metadata("design:type", feedback_1.Feedback)
|
431
|
+
], Post.prototype, "feedback", void 0);
|
553
432
|
__decorate([
|
554
|
-
(0, class_transformer_1.Expose)(
|
555
|
-
(0, class_transformer_1.Type)(() =>
|
556
|
-
__metadata("design:type",
|
557
|
-
], Post.prototype, "
|
433
|
+
(0, class_transformer_1.Expose)(),
|
434
|
+
(0, class_transformer_1.Type)(() => Post),
|
435
|
+
__metadata("design:type", Array)
|
436
|
+
], Post.prototype, "collection", void 0);
|
558
437
|
__decorate([
|
559
438
|
(0, class_transformer_1.Expose)(),
|
560
|
-
(0, class_transformer_1.Type)(() =>
|
561
|
-
__metadata("design:type",
|
562
|
-
], Post.prototype, "
|
439
|
+
(0, class_transformer_1.Type)(() => gallery_1.GalleryItem),
|
440
|
+
__metadata("design:type", Array)
|
441
|
+
], Post.prototype, "gallery", void 0);
|
563
442
|
__decorate([
|
564
443
|
(0, class_transformer_1.Expose)({ groups: ['admin'] }),
|
565
|
-
(
|
566
|
-
__metadata("design:
|
567
|
-
|
444
|
+
__metadata("design:type", Function),
|
445
|
+
__metadata("design:paramtypes", []),
|
446
|
+
__metadata("design:returntype", Object)
|
447
|
+
], Post.prototype, "getStatusAuthorizations", null);
|
568
448
|
__decorate([
|
569
449
|
(0, class_transformer_1.Expose)({ groups: ['admin'] }),
|
570
450
|
__metadata("design:type", Function),
|