@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/feedback.js
CHANGED
@@ -12,40 +12,24 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.FeedbackOption = exports.FeedbackItem = exports.Feedback = void 0;
|
13
13
|
const class_transformer_1 = require("class-transformer");
|
14
14
|
const enums_1 = require("../enums");
|
15
|
-
const
|
15
|
+
const metric_1 = require("./metric");
|
16
|
+
const log_1 = require("./log");
|
17
|
+
const helpers_1 = require("../helpers");
|
16
18
|
class Feedback {
|
17
19
|
id;
|
18
20
|
type;
|
19
21
|
title;
|
20
22
|
description;
|
21
|
-
items;
|
22
23
|
icon;
|
23
|
-
|
24
|
+
metricQuestions;
|
25
|
+
metricPosts;
|
26
|
+
metricUsers;
|
27
|
+
created;
|
28
|
+
updated;
|
29
|
+
items;
|
24
30
|
constructor(props) {
|
25
31
|
Object.assign(this, props);
|
26
32
|
}
|
27
|
-
updateMetrics() {
|
28
|
-
if (!this.metrics || this.metrics.length === 0) {
|
29
|
-
return;
|
30
|
-
}
|
31
|
-
let totalQuestion = 0;
|
32
|
-
let totalOptions = 0;
|
33
|
-
if (this.items?.length > 0) {
|
34
|
-
for (const question of this.items) {
|
35
|
-
totalQuestion++;
|
36
|
-
totalOptions += question?.options?.length;
|
37
|
-
}
|
38
|
-
}
|
39
|
-
this.metrics = this.metrics.map(item => {
|
40
|
-
if (item.name === 'items') {
|
41
|
-
item.value = totalQuestion;
|
42
|
-
}
|
43
|
-
if (item.name === 'options') {
|
44
|
-
item.value = totalOptions;
|
45
|
-
}
|
46
|
-
return item;
|
47
|
-
});
|
48
|
-
}
|
49
33
|
}
|
50
34
|
exports.Feedback = Feedback;
|
51
35
|
__decorate([
|
@@ -67,34 +51,39 @@ __decorate([
|
|
67
51
|
], Feedback.prototype, "description", void 0);
|
68
52
|
__decorate([
|
69
53
|
(0, class_transformer_1.Expose)(),
|
70
|
-
(0, class_transformer_1.
|
71
|
-
__metadata("design:type", Array)
|
72
|
-
], Feedback.prototype, "items", void 0);
|
73
|
-
__decorate([
|
74
|
-
(0, class_transformer_1.Expose)(),
|
75
|
-
(0, class_transformer_1.Transform)(({ obj }) => {
|
76
|
-
switch (obj.type) {
|
77
|
-
case enums_1.PostType.Article:
|
78
|
-
return '/assets/icons/content-type-article.svg';
|
79
|
-
case enums_1.PostType.Book:
|
80
|
-
return '/assets/icons/content-type-book.svg';
|
81
|
-
case enums_1.PostType.Audio:
|
82
|
-
return '/assets/icons/content-type-audio.svg';
|
83
|
-
case enums_1.PostType.Video:
|
84
|
-
return '/assets/icons/content-type-video.svg';
|
85
|
-
case enums_1.PostType.News:
|
86
|
-
return '/assets/icons/content-type-news.svg';
|
87
|
-
case enums_1.PostType.Event:
|
88
|
-
return '/assets/icons/content-type-event.svg';
|
89
|
-
}
|
90
|
-
}),
|
54
|
+
(0, class_transformer_1.Transform)(({ obj }) => (0, helpers_1.getPostIcon)(obj?.type, true)),
|
91
55
|
__metadata("design:type", String)
|
92
56
|
], Feedback.prototype, "icon", void 0);
|
57
|
+
__decorate([
|
58
|
+
(0, class_transformer_1.Expose)({ groups: ['admin'] }),
|
59
|
+
(0, class_transformer_1.Type)(() => metric_1.Metric),
|
60
|
+
__metadata("design:type", metric_1.Metric)
|
61
|
+
], Feedback.prototype, "metricQuestions", void 0);
|
62
|
+
__decorate([
|
63
|
+
(0, class_transformer_1.Expose)({ groups: ['admin'] }),
|
64
|
+
(0, class_transformer_1.Type)(() => metric_1.Metric),
|
65
|
+
__metadata("design:type", metric_1.Metric)
|
66
|
+
], Feedback.prototype, "metricPosts", void 0);
|
67
|
+
__decorate([
|
68
|
+
(0, class_transformer_1.Expose)({ groups: ['admin'] }),
|
69
|
+
(0, class_transformer_1.Type)(() => metric_1.Metric),
|
70
|
+
__metadata("design:type", metric_1.Metric)
|
71
|
+
], Feedback.prototype, "metricUsers", void 0);
|
72
|
+
__decorate([
|
73
|
+
(0, class_transformer_1.Expose)({ groups: ['admin'] }),
|
74
|
+
(0, class_transformer_1.Type)(() => log_1.Log),
|
75
|
+
__metadata("design:type", log_1.Log)
|
76
|
+
], Feedback.prototype, "created", void 0);
|
77
|
+
__decorate([
|
78
|
+
(0, class_transformer_1.Expose)({ groups: ['admin'] }),
|
79
|
+
(0, class_transformer_1.Type)(() => log_1.Log),
|
80
|
+
__metadata("design:type", log_1.Log)
|
81
|
+
], Feedback.prototype, "updated", void 0);
|
93
82
|
__decorate([
|
94
83
|
(0, class_transformer_1.Expose)(),
|
95
|
-
(0, class_transformer_1.Type)(() =>
|
84
|
+
(0, class_transformer_1.Type)(() => FeedbackItem),
|
96
85
|
__metadata("design:type", Array)
|
97
|
-
], Feedback.prototype, "
|
86
|
+
], Feedback.prototype, "items", void 0);
|
98
87
|
class FeedbackItem {
|
99
88
|
id;
|
100
89
|
question;
|
@@ -102,7 +91,6 @@ class FeedbackItem {
|
|
102
91
|
sort;
|
103
92
|
readonly;
|
104
93
|
options;
|
105
|
-
metrics;
|
106
94
|
constructor(props) {
|
107
95
|
Object.assign(this, props);
|
108
96
|
}
|
@@ -137,11 +125,6 @@ __decorate([
|
|
137
125
|
(0, class_transformer_1.Type)(() => FeedbackOption),
|
138
126
|
__metadata("design:type", Array)
|
139
127
|
], FeedbackItem.prototype, "options", void 0);
|
140
|
-
__decorate([
|
141
|
-
(0, class_transformer_1.Expose)(),
|
142
|
-
(0, class_transformer_1.Type)(() => item_1.Item),
|
143
|
-
__metadata("design:type", Array)
|
144
|
-
], FeedbackItem.prototype, "metrics", void 0);
|
145
128
|
class FeedbackOption {
|
146
129
|
id;
|
147
130
|
content;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"feedback.js","sourceRoot":"","sources":["../../src/models/feedback.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAA4D;AAC5D,oCAAoC;AACpC,
|
1
|
+
{"version":3,"file":"feedback.js","sourceRoot":"","sources":["../../src/models/feedback.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAA4D;AAC5D,oCAAoC;AACpC,qCAAkC;AAClC,+BAA4B;AAC5B,wCAAyC;AAEzC,MAAa,QAAQ;IAIpB,EAAE,CAAS;IAGX,IAAI,CAAW;IAKf,KAAK,CAAS;IAGd,WAAW,CAAQ;IAInB,IAAI,CAAS;IAMb,eAAe,CAAS;IAIxB,WAAW,CAAS;IAIpB,WAAW,CAAS;IAMpB,OAAO,CAAM;IAIb,OAAO,CAAM;IAMb,KAAK,CAAiB;IAEtB,YAAY,KAAyB;QACpC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC5B,CAAC;CACD;AAtDD,4BAsDC;AAlDA;IAFC,IAAA,0BAAM,EAAC,EAAE,MAAM,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;IAC7B,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,MAAM,CAAC;;oCACR;AAGX;IADC,IAAA,0BAAM,EAAC,EAAE,MAAM,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;;sCACf;AAKf;IADC,IAAA,0BAAM,GAAE;;uCACK;AAGd;IADC,IAAA,0BAAM,GAAE;;6CACU;AAInB;IAFC,IAAA,0BAAM,GAAE;IACR,IAAA,6BAAS,EAAC,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,IAAA,qBAAW,EAAC,GAAG,EAAE,IAAI,EAAE,IAA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-1,4 +1,3 @@
|
|
1
|
-
export * from './asset';
|
2
1
|
export * from './author';
|
3
2
|
export * from './boost';
|
4
3
|
export * from './brand';
|
@@ -8,6 +7,8 @@ export * from './feedback';
|
|
8
7
|
export * from './gallery';
|
9
8
|
export * from './item';
|
10
9
|
export * from './link';
|
10
|
+
export * from './log';
|
11
|
+
export * from './metric';
|
11
12
|
export * from './notification';
|
12
13
|
export * from './post';
|
13
14
|
export * from './promotion';
|
package/lib/models/index.js
CHANGED
@@ -14,7 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
15
|
};
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
-
__exportStar(require("./asset"), exports);
|
18
17
|
__exportStar(require("./author"), exports);
|
19
18
|
__exportStar(require("./boost"), exports);
|
20
19
|
__exportStar(require("./brand"), exports);
|
@@ -24,6 +23,8 @@ __exportStar(require("./feedback"), exports);
|
|
24
23
|
__exportStar(require("./gallery"), exports);
|
25
24
|
__exportStar(require("./item"), exports);
|
26
25
|
__exportStar(require("./link"), exports);
|
26
|
+
__exportStar(require("./log"), exports);
|
27
|
+
__exportStar(require("./metric"), exports);
|
27
28
|
__exportStar(require("./notification"), exports);
|
28
29
|
__exportStar(require("./post"), exports);
|
29
30
|
__exportStar(require("./promotion"), exports);
|
package/lib/models/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,0CAAwB;AACxB,0CAAwB;AACxB,6CAA2B;AAC3B,+CAA6B;AAC7B,6CAA2B;AAC3B,4CAA0B;AAC1B,yCAAuB;AACvB,yCAAuB;AACvB,wCAAsB;AACtB,2CAAyB;AACzB,iDAA+B;AAC/B,yCAAuB;AACvB,8CAA4B;AAC5B,8CAA4B;AAC5B,6CAA2B;AAC3B,0CAAwB;AACxB,6CAA2B;AAC3B,0CAAwB;AACxB,2CAAyB;AACzB,0CAAwB;AACxB,0CAAwB;AACxB,yCAAuB"}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.Log = void 0;
|
4
|
+
class Log {
|
5
|
+
type;
|
6
|
+
by;
|
7
|
+
on;
|
8
|
+
id;
|
9
|
+
status;
|
10
|
+
description;
|
11
|
+
constructor(props) {
|
12
|
+
Object.assign(this, props);
|
13
|
+
}
|
14
|
+
}
|
15
|
+
exports.Log = Log;
|
16
|
+
//# sourceMappingURL=log.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"log.js","sourceRoot":"","sources":["../../src/models/log.ts"],"names":[],"mappings":";;;AAIA,MAAa,GAAG;IAKf,IAAI,CAAW;IAKf,EAAE,CAAO;IAKT,EAAE,CAAO;IAKT,EAAE,CAAU;IAKZ,MAAM,CAAc;IAKpB,WAAW,CAAU;IAErB,YAAY,KAAoB;QAC/B,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC5B,CAAC;CACD;AAnCD,kBAmCC"}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import { IconProp } from "@fortawesome/fontawesome-svg-core";
|
2
|
+
import { MetricType } from "../enums";
|
3
|
+
export declare class Metric {
|
4
|
+
name?: string;
|
5
|
+
title?: string;
|
6
|
+
type: MetricType;
|
7
|
+
value: number;
|
8
|
+
active: boolean;
|
9
|
+
icon: IconProp;
|
10
|
+
iconActive: IconProp;
|
11
|
+
constructor(props?: Partial<Metric>);
|
12
|
+
static seen(val: number, active?: boolean): Metric;
|
13
|
+
static open(val: number, active?: boolean): Metric;
|
14
|
+
static like(val: number, active?: boolean): Metric;
|
15
|
+
static bookmark(val: number, active?: boolean): Metric;
|
16
|
+
static share(val: number, active?: boolean): Metric;
|
17
|
+
static download(val: number, active?: boolean): Metric;
|
18
|
+
static feedback(val: number, active?: boolean): Metric;
|
19
|
+
static total(title: string, val: number, icon?: IconProp, active?: boolean): Metric;
|
20
|
+
}
|
@@ -0,0 +1,186 @@
|
|
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.Metric = void 0;
|
13
|
+
const enums_1 = require("../enums");
|
14
|
+
const class_transformer_1 = require("class-transformer");
|
15
|
+
class Metric {
|
16
|
+
name;
|
17
|
+
title;
|
18
|
+
type;
|
19
|
+
value;
|
20
|
+
active;
|
21
|
+
icon;
|
22
|
+
iconActive;
|
23
|
+
constructor(props) {
|
24
|
+
Object.assign(this, props);
|
25
|
+
}
|
26
|
+
static seen(val, active) {
|
27
|
+
return new Metric({
|
28
|
+
title: 'seen',
|
29
|
+
type: enums_1.MetricType.Seen,
|
30
|
+
icon: ['fas', 'eye'],
|
31
|
+
iconActive: ['fas', 'eye'],
|
32
|
+
value: val || 0,
|
33
|
+
active: active
|
34
|
+
});
|
35
|
+
}
|
36
|
+
static open(val, active) {
|
37
|
+
return new Metric({
|
38
|
+
title: 'opens',
|
39
|
+
type: enums_1.MetricType.Open,
|
40
|
+
icon: ['fas', 'book-open'],
|
41
|
+
iconActive: ['fas', 'book-open-reader'],
|
42
|
+
value: val || 0,
|
43
|
+
active: active
|
44
|
+
});
|
45
|
+
}
|
46
|
+
static like(val, active) {
|
47
|
+
return new Metric({
|
48
|
+
title: 'likes',
|
49
|
+
type: enums_1.MetricType.Like,
|
50
|
+
icon: ['far', 'heart'],
|
51
|
+
iconActive: ['fas', 'heart'],
|
52
|
+
value: val || 0,
|
53
|
+
active: active
|
54
|
+
});
|
55
|
+
}
|
56
|
+
static bookmark(val, active) {
|
57
|
+
return new Metric({
|
58
|
+
title: 'bookmarks',
|
59
|
+
type: enums_1.MetricType.Bookmark,
|
60
|
+
icon: ['far', 'bookmark'],
|
61
|
+
iconActive: ['fas', 'bookmark'],
|
62
|
+
value: val || 0,
|
63
|
+
active: active
|
64
|
+
});
|
65
|
+
}
|
66
|
+
static share(val, active) {
|
67
|
+
return new Metric({
|
68
|
+
title: 'shares',
|
69
|
+
type: enums_1.MetricType.Share,
|
70
|
+
icon: ['far', 'share-from-square'],
|
71
|
+
iconActive: ['fas', 'share-from-square'],
|
72
|
+
value: val || 0,
|
73
|
+
active: active
|
74
|
+
});
|
75
|
+
}
|
76
|
+
static download(val, active) {
|
77
|
+
return new Metric({
|
78
|
+
title: 'downloads',
|
79
|
+
type: enums_1.MetricType.Download,
|
80
|
+
icon: ['fas', 'download'],
|
81
|
+
iconActive: ['fas', 'download'],
|
82
|
+
value: val || 0,
|
83
|
+
active: active
|
84
|
+
});
|
85
|
+
}
|
86
|
+
static feedback(val, active) {
|
87
|
+
return new Metric({
|
88
|
+
title: 'feedbacks',
|
89
|
+
type: enums_1.MetricType.Feedback,
|
90
|
+
icon: ['far', 'comments'],
|
91
|
+
iconActive: ['fas', 'comments'],
|
92
|
+
value: val || 0,
|
93
|
+
active: active
|
94
|
+
});
|
95
|
+
}
|
96
|
+
static total(title, val, icon, active) {
|
97
|
+
return new Metric({
|
98
|
+
title: title,
|
99
|
+
type: enums_1.MetricType.Total,
|
100
|
+
icon: icon || ['fas', 'gauge-high'],
|
101
|
+
iconActive: icon || ['fas', 'gauge-high'],
|
102
|
+
value: val || 0,
|
103
|
+
active: active
|
104
|
+
});
|
105
|
+
}
|
106
|
+
}
|
107
|
+
exports.Metric = Metric;
|
108
|
+
__decorate([
|
109
|
+
(0, class_transformer_1.Expose)(),
|
110
|
+
__metadata("design:type", String)
|
111
|
+
], Metric.prototype, "name", void 0);
|
112
|
+
__decorate([
|
113
|
+
(0, class_transformer_1.Expose)(),
|
114
|
+
__metadata("design:type", String)
|
115
|
+
], Metric.prototype, "title", void 0);
|
116
|
+
__decorate([
|
117
|
+
(0, class_transformer_1.Expose)(),
|
118
|
+
__metadata("design:type", String)
|
119
|
+
], Metric.prototype, "type", void 0);
|
120
|
+
__decorate([
|
121
|
+
(0, class_transformer_1.Expose)(),
|
122
|
+
(0, class_transformer_1.Transform)(({ obj }) => obj?.value || 0),
|
123
|
+
__metadata("design:type", Number)
|
124
|
+
], Metric.prototype, "value", void 0);
|
125
|
+
__decorate([
|
126
|
+
(0, class_transformer_1.Expose)(),
|
127
|
+
(0, class_transformer_1.Type)(() => Boolean),
|
128
|
+
__metadata("design:type", Boolean)
|
129
|
+
], Metric.prototype, "active", void 0);
|
130
|
+
__decorate([
|
131
|
+
(0, class_transformer_1.Expose)(),
|
132
|
+
(0, class_transformer_1.Transform)(({ obj }) => {
|
133
|
+
if (obj?.icon)
|
134
|
+
return obj.icon;
|
135
|
+
switch (obj?.type) {
|
136
|
+
case enums_1.MetricType.Seen:
|
137
|
+
return ['fas', 'eye'];
|
138
|
+
case enums_1.MetricType.Open:
|
139
|
+
return ['fas', 'book-open'];
|
140
|
+
case enums_1.MetricType.Like:
|
141
|
+
return ['far', 'heart'];
|
142
|
+
case enums_1.MetricType.Bookmark:
|
143
|
+
return ['far', 'bookmark'];
|
144
|
+
case enums_1.MetricType.Share:
|
145
|
+
return ['far', 'share-from-square'];
|
146
|
+
case enums_1.MetricType.Download:
|
147
|
+
return ['fas', 'download'];
|
148
|
+
case enums_1.MetricType.Feedback:
|
149
|
+
return ['far', 'comments'];
|
150
|
+
case enums_1.MetricType.Total:
|
151
|
+
return ['fas', 'gauge-high'];
|
152
|
+
default:
|
153
|
+
return ['fas', 'gauge'];
|
154
|
+
}
|
155
|
+
}),
|
156
|
+
__metadata("design:type", Object)
|
157
|
+
], Metric.prototype, "icon", void 0);
|
158
|
+
__decorate([
|
159
|
+
(0, class_transformer_1.Expose)(),
|
160
|
+
(0, class_transformer_1.Transform)(({ obj }) => {
|
161
|
+
if (obj?.icon)
|
162
|
+
return obj.icon;
|
163
|
+
switch (obj?.type) {
|
164
|
+
case enums_1.MetricType.Seen:
|
165
|
+
return ['fas', 'eye'];
|
166
|
+
case enums_1.MetricType.Open:
|
167
|
+
return ['fas', 'book-open-reader'];
|
168
|
+
case enums_1.MetricType.Like:
|
169
|
+
return ['fas', 'heart'];
|
170
|
+
case enums_1.MetricType.Bookmark:
|
171
|
+
return ['fas', 'bookmark'];
|
172
|
+
case enums_1.MetricType.Share:
|
173
|
+
return ['fas', 'share-from-square'];
|
174
|
+
case enums_1.MetricType.Download:
|
175
|
+
return ['fas', 'download'];
|
176
|
+
case enums_1.MetricType.Feedback:
|
177
|
+
return ['fas', 'comments'];
|
178
|
+
case enums_1.MetricType.Total:
|
179
|
+
return ['fas', 'gauge-high'];
|
180
|
+
default:
|
181
|
+
return ['fas', 'gauge-simple-high'];
|
182
|
+
}
|
183
|
+
}),
|
184
|
+
__metadata("design:type", Object)
|
185
|
+
], Metric.prototype, "iconActive", void 0);
|
186
|
+
//# sourceMappingURL=metric.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"metric.js","sourceRoot":"","sources":["../../src/models/metric.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,oCAAsC;AACtC,yDAA4D;AAG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B,KAAK,kBAAU,CAAC,QAAQ;gBACvB,OAAO,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;YAC5B,KAAK,kBAAU,CAAC,KAAK;gBACpB,OAAO,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;YAC9B;gBACC,OAAO,CAAC,KAAK,EAAE,mBAAmB,CAAC,CAAC;QACtC,CAAC;IACF,CAAC,CAAC;;0CACmB"}
|
package/lib/models/post.d.ts
CHANGED
@@ -2,20 +2,14 @@ import { IconProp } from '@fortawesome/fontawesome-svg-core';
|
|
2
2
|
import { Author } from './author';
|
3
3
|
import { Publisher } from './publisher';
|
4
4
|
import { Topic } from './topic';
|
5
|
-
import { Context,
|
5
|
+
import { Context, PostType, StatusType } from '../enums';
|
6
6
|
import { GalleryItem } from './gallery';
|
7
7
|
import { Feedback } from './feedback';
|
8
8
|
import { Item } from './item';
|
9
|
-
import {
|
9
|
+
import { Metric } from './metric';
|
10
|
+
import { Log } from './log';
|
10
11
|
export declare class Post {
|
11
12
|
id: number;
|
12
|
-
publisher: Publisher;
|
13
|
-
author: Author;
|
14
|
-
topics: Topic[];
|
15
|
-
feedback: Feedback;
|
16
|
-
collection: Post[];
|
17
|
-
gallery: GalleryItem[];
|
18
|
-
postType: PostType | FeedType;
|
19
13
|
slug: string;
|
20
14
|
title: string;
|
21
15
|
description: string;
|
@@ -24,16 +18,37 @@ export declare class Post {
|
|
24
18
|
duration: number;
|
25
19
|
icon: IconProp;
|
26
20
|
svgIcon: string;
|
27
|
-
tags: string[];
|
28
21
|
pdfUrl: string;
|
29
22
|
imageUrl: string;
|
30
23
|
feedUrl: string;
|
31
24
|
mediaUrl: string;
|
32
25
|
externUrl: string;
|
33
26
|
status: StatusType;
|
27
|
+
postType: PostType;
|
34
28
|
weight: number;
|
35
29
|
popularity: Item<number>;
|
36
|
-
|
30
|
+
totalSeen: Metric;
|
31
|
+
metricOpens: Metric;
|
32
|
+
metricLikes: Metric;
|
33
|
+
metricShares: Metric;
|
34
|
+
metricBookmarks: Metric;
|
35
|
+
metricDownloads: Metric;
|
36
|
+
metricFeedbacks: Metric;
|
37
|
+
statusChanged: Log;
|
38
|
+
published: Log;
|
39
|
+
blocked: Log;
|
40
|
+
created: Log;
|
41
|
+
updated: Log;
|
42
|
+
deleted: Log;
|
43
|
+
publisher: Publisher;
|
44
|
+
author: Author;
|
45
|
+
topics: Topic[];
|
46
|
+
feedback: Feedback;
|
47
|
+
collection: Post[];
|
48
|
+
gallery: GalleryItem[];
|
49
|
+
constructor(props?: Partial<Post>);
|
50
|
+
get type(): PostType;
|
51
|
+
getStatusAuthorizations(): {
|
37
52
|
draft: boolean;
|
38
53
|
approve: boolean;
|
39
54
|
publish: boolean;
|
@@ -43,31 +58,6 @@ export declare class Post {
|
|
43
58
|
block: boolean;
|
44
59
|
unblock: boolean;
|
45
60
|
};
|
46
|
-
totalHits: number;
|
47
|
-
totalLikes: number;
|
48
|
-
totalShares: number;
|
49
|
-
totalBookmarks: number;
|
50
|
-
totalDownloads: number;
|
51
|
-
isBookmarked: boolean;
|
52
|
-
isLiked: boolean;
|
53
|
-
isShared: boolean;
|
54
|
-
isDownloaded: boolean;
|
55
|
-
bookmark: Item<number>;
|
56
|
-
like: Item<number>;
|
57
|
-
share: Item<number>;
|
58
|
-
hit: Item<number>;
|
59
|
-
download: Item<number>;
|
60
|
-
metrics: Item[];
|
61
|
-
createdOn: Date;
|
62
|
-
createdBy: User;
|
63
|
-
updatedOn: Date;
|
64
|
-
updatedBy: User;
|
65
|
-
statusChangeDate: Date;
|
66
|
-
statusChangeBy: User;
|
67
|
-
publishedDate: Date;
|
68
|
-
publishedBy: User;
|
69
|
-
constructor(props?: Partial<Post>);
|
70
|
-
get type(): PostType;
|
71
61
|
getPublishValidators(): Item[];
|
72
62
|
validateForPublish(): boolean;
|
73
63
|
getStatusContext(): Context;
|