@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 Model from '../../Model';
2
+ import { LanguagesTypes } from '../../../lang';
3
+ import PlayerBasic from '../../Player/basic';
3
4
  import { CommunicationCommentData } from './types';
4
- export default class CommunicationCommment extends Model<CommunicationCommentData> {
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 Model_1 = __importDefault(require("../../Model"));
8
- class CommunicationCommment extends Model_1.default {
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
- export interface CommunicationCommentData {
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, number>;
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, current) => (Object.assign(Object.assign({}, acc), (current.reaction && { [current.reaction]: (acc[current.reaction] || 0) + 1 }))), {});
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glissandoo/lib",
3
- "version": "1.1.6",
3
+ "version": "1.1.8",
4
4
  "description": "Glissandoo library js",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",