@glissandoo/lib 1.1.1 → 1.1.3
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/helpers/collections.d.ts +1 -0
- package/helpers/collections.js +1 -0
- package/models/Communication/Comment/index.d.ts +1 -0
- package/models/Communication/Comment/index.js +3 -0
- package/models/Communication/index.d.ts +2 -0
- package/models/Communication/index.js +4 -0
- package/models/Communication/types.d.ts +2 -0
- package/package.json +1 -1
package/helpers/collections.d.ts
CHANGED
package/helpers/collections.js
CHANGED
|
@@ -4,6 +4,7 @@ exports.CollectionNames = void 0;
|
|
|
4
4
|
var CollectionNames;
|
|
5
5
|
(function (CollectionNames) {
|
|
6
6
|
CollectionNames["Communication"] = "communication";
|
|
7
|
+
CollectionNames["CommunicationComments"] = "comments";
|
|
7
8
|
CollectionNames["Notification"] = "notification";
|
|
8
9
|
CollectionNames["User"] = "user";
|
|
9
10
|
CollectionNames["UserGroups"] = "groups";
|
|
@@ -5,6 +5,7 @@ export default class CommunicationCommment extends Model<CommunicationCommentDat
|
|
|
5
5
|
constructor(doc: firestore.DocumentSnapshot);
|
|
6
6
|
get communicationId(): string;
|
|
7
7
|
private get userInfo();
|
|
8
|
+
get text(): string;
|
|
8
9
|
get name(): string;
|
|
9
10
|
get photoURL(): string;
|
|
10
11
|
private get createdBy();
|
|
@@ -42,7 +42,9 @@ export default class Communication extends Model<CommunicationData> {
|
|
|
42
42
|
alt: string;
|
|
43
43
|
};
|
|
44
44
|
get editedAt(): FirebaseFirestore.Timestamp | null;
|
|
45
|
+
/** @deprecated use reactions */
|
|
45
46
|
get totalClaps(): number;
|
|
47
|
+
get reactions(): Record<string, number>;
|
|
46
48
|
get totalViews(): number;
|
|
47
49
|
get isServer(): boolean;
|
|
48
50
|
getRecipient: (userId: string) => import("./types").CommunicationRecipientData | null;
|
|
@@ -127,11 +127,15 @@ class Communication extends Model_1.default {
|
|
|
127
127
|
get editedAt() {
|
|
128
128
|
return this.data.editedAt || null;
|
|
129
129
|
}
|
|
130
|
+
/** @deprecated use reactions */
|
|
130
131
|
get totalClaps() {
|
|
131
132
|
return this.listRecipients
|
|
132
133
|
.map((recipient) => recipient.claps || 0)
|
|
133
134
|
.reduce((acc, current) => acc + current, 0);
|
|
134
135
|
}
|
|
136
|
+
get reactions() {
|
|
137
|
+
return this.listRecipients.reduce((acc, current) => (Object.assign(Object.assign({}, acc), (current.reaction && { [current.reaction]: (acc[current.reaction] || 0) + 1 }))), {});
|
|
138
|
+
}
|
|
135
139
|
get totalViews() {
|
|
136
140
|
return this.listRecipients
|
|
137
141
|
.map((recipient) => recipient.countViews || 0)
|
|
@@ -23,10 +23,12 @@ export interface RichText {
|
|
|
23
23
|
}
|
|
24
24
|
export interface CommunicationRecipientData {
|
|
25
25
|
sendedAt: Timestamp;
|
|
26
|
+
/** @deprecated use reaction */
|
|
26
27
|
claps: number;
|
|
27
28
|
viewedAt: Timestamp | null;
|
|
28
29
|
lastViewedAt: Timestamp | null;
|
|
29
30
|
countViews: number;
|
|
31
|
+
reaction: string | null;
|
|
30
32
|
}
|
|
31
33
|
export interface CommunicationData {
|
|
32
34
|
title: string;
|