@glissandoo/lib 1.1.6 → 1.1.8
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.
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as firestore from '@google-cloud/firestore';
|
|
2
|
-
import
|
|
2
|
+
import { LanguagesTypes } from '../../../lang';
|
|
3
|
+
import PlayerBasic from '../../Player/basic';
|
|
3
4
|
import { CommunicationCommentData } from './types';
|
|
4
|
-
export default class CommunicationCommment extends
|
|
5
|
-
constructor(doc: firestore.DocumentSnapshot);
|
|
5
|
+
export default class CommunicationCommment extends PlayerBasic<CommunicationCommentData> {
|
|
6
|
+
constructor(doc: firestore.DocumentSnapshot, lang: LanguagesTypes);
|
|
6
7
|
get communicationId(): string;
|
|
7
8
|
get text(): string;
|
|
8
9
|
private get createdBy();
|
|
@@ -4,10 +4,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const get_1 = __importDefault(require("lodash/get"));
|
|
7
|
-
const
|
|
8
|
-
class CommunicationCommment extends
|
|
9
|
-
constructor(doc) {
|
|
10
|
-
super(doc);
|
|
7
|
+
const basic_1 = __importDefault(require("../../Player/basic"));
|
|
8
|
+
class CommunicationCommment extends basic_1.default {
|
|
9
|
+
constructor(doc, lang) {
|
|
10
|
+
super(doc, lang);
|
|
11
11
|
}
|
|
12
12
|
get communicationId() {
|
|
13
13
|
return get_1.default(this.ref, 'parent.parent.id');
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { DocumentReference, Timestamp } from '@google-cloud/firestore';
|
|
2
|
-
|
|
2
|
+
import { PlayerBasicData } from '../../Player/types';
|
|
3
|
+
export interface CommunicationCommentData extends PlayerBasicData {
|
|
3
4
|
text: string;
|
|
4
5
|
editedAt: Timestamp | null;
|
|
5
6
|
readonly createdBy: DocumentReference;
|
|
@@ -44,7 +44,7 @@ export default class Communication extends Model<CommunicationData> {
|
|
|
44
44
|
get editedAt(): FirebaseFirestore.Timestamp | null;
|
|
45
45
|
/** @deprecated use reactions */
|
|
46
46
|
get totalClaps(): number;
|
|
47
|
-
get reactions(): Record<string,
|
|
47
|
+
get reactions(): Record<string, string[]>;
|
|
48
48
|
get totalViews(): number;
|
|
49
49
|
get isServer(): boolean;
|
|
50
50
|
getRecipient: (userId: string) => import("./types").CommunicationRecipientData | null;
|
|
@@ -134,7 +134,9 @@ class Communication extends Model_1.default {
|
|
|
134
134
|
.reduce((acc, current) => acc + current, 0);
|
|
135
135
|
}
|
|
136
136
|
get reactions() {
|
|
137
|
-
return this.listRecipients.reduce((acc,
|
|
137
|
+
return this.listRecipients.reduce((acc, { reaction, id }) => (Object.assign(Object.assign({}, acc), (reaction && {
|
|
138
|
+
[reaction]: reaction in acc ? [...acc[reaction], id] : [id],
|
|
139
|
+
}))), {});
|
|
138
140
|
}
|
|
139
141
|
get totalViews() {
|
|
140
142
|
return this.listRecipients
|