@glissandoo/lib 1.10.4 → 1.11.0

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,4 +1,6 @@
1
1
  import { EventPromoterData } from '../models/Evento/types';
2
+ import Federation from '../models/Federation';
3
+ import FederationPartnership from '../models/Federation/Partnership';
2
4
  import { FederationData } from '../models/Federation/types';
3
5
  export declare namespace FederationFbFunctionsTypes {
4
6
  type CreateParams = Pick<FederationData, 'displayName' | 'photoURL' | 'email' | 'phone' | 'web' | 'address'> & {
@@ -42,4 +44,13 @@ export declare namespace FederationFbFunctionsTypes {
42
44
  federationId: string;
43
45
  }
44
46
  type ConfirmAdminResult = void;
47
+ interface GetConfederationParams {
48
+ federationIds: string[];
49
+ }
50
+ type ConfederationPartnershipType = Pick<FederationPartnership, 'id' | 'displayName' | 'email' | 'hasSchool' | 'leaderCount' | 'photoURL' | 'phone' | 'address' | 'CIF' | 'partnerCount' | 'memberCount' | 'connectedAt' | 'teacherCount' | 'studentCount' | 'updatedAt'>;
51
+ type FederationConfederationType = Pick<Federation, 'id' | 'displayName' | 'email' | 'photoURL' | 'phone' | 'web' | 'address' | 'partnershipIds'>;
52
+ interface GetConfederationResult {
53
+ federations: FederationConfederationType[];
54
+ partnerships: ConfederationPartnershipType[];
55
+ }
45
56
  }
@@ -41,8 +41,6 @@ export declare namespace FederationPartnershipFbFunctionsTypes {
41
41
  federationId: string;
42
42
  partnershipId: string;
43
43
  formData: {
44
- memberCount: number;
45
- partnerCount: number;
46
44
  displayName: string;
47
45
  photoURL: string;
48
46
  email: string;
@@ -61,8 +59,6 @@ export declare namespace FederationPartnershipFbFunctionsTypes {
61
59
  federationId: string;
62
60
  partnershipId: string;
63
61
  formData: {
64
- memberCount: number;
65
- partnerCount: number;
66
62
  displayName: string;
67
63
  photoURL: string;
68
64
  email: string;
@@ -72,4 +68,17 @@ export declare namespace FederationPartnershipFbFunctionsTypes {
72
68
  };
73
69
  }
74
70
  type EditManualResult = void;
71
+ interface EditCountManualParams {
72
+ federationId: string;
73
+ partnershipId: string;
74
+ formData: {
75
+ leaderCount: number;
76
+ memberCount: number;
77
+ partnerCount: number;
78
+ hasSchool: boolean;
79
+ teacherCount: number | null;
80
+ studentCount: number | null;
81
+ };
82
+ }
83
+ type EditCountManualResult = void;
75
84
  }
@@ -1,5 +1,6 @@
1
1
  export declare enum FbFunctionName {
2
2
  Auth = "auth",
3
+ FederationGetConfederation = "federation-getConfederation",
3
4
  CommunicationCommentPublish = "communicationComment-publish",
4
5
  CommunicationEdit = "communication-edit",
5
6
  CommunicationPublish = "communication-publish",
@@ -27,6 +28,7 @@ export declare enum FbFunctionName {
27
28
  FederationPartnershipAddManual = "federationPartnership-addManual",
28
29
  FederationPartnershipConnect = "federationPartnership-connect",
29
30
  FederationPartnershipEditManual = "federationPartnership-editManual",
31
+ FederationPartnershipEditCountManual = "federationPartnership-editCountManual",
30
32
  FederationPartnershipGetByToken = "federationPartnership-getByToken",
31
33
  FederationPartnershipRemove = "federationPartnership-remove",
32
34
  FederationPartnershipRemoveManual = "federationPartnership-removeManual",
@@ -4,6 +4,7 @@ exports.FbFunctionName = void 0;
4
4
  var FbFunctionName;
5
5
  (function (FbFunctionName) {
6
6
  FbFunctionName["Auth"] = "auth";
7
+ FbFunctionName["FederationGetConfederation"] = "federation-getConfederation";
7
8
  FbFunctionName["CommunicationCommentPublish"] = "communicationComment-publish";
8
9
  FbFunctionName["CommunicationEdit"] = "communication-edit";
9
10
  FbFunctionName["CommunicationPublish"] = "communication-publish";
@@ -31,6 +32,7 @@ var FbFunctionName;
31
32
  FbFunctionName["FederationPartnershipAddManual"] = "federationPartnership-addManual";
32
33
  FbFunctionName["FederationPartnershipConnect"] = "federationPartnership-connect";
33
34
  FbFunctionName["FederationPartnershipEditManual"] = "federationPartnership-editManual";
35
+ FbFunctionName["FederationPartnershipEditCountManual"] = "federationPartnership-editCountManual";
34
36
  FbFunctionName["FederationPartnershipGetByToken"] = "federationPartnership-getByToken";
35
37
  FbFunctionName["FederationPartnershipRemove"] = "federationPartnership-remove";
36
38
  FbFunctionName["FederationPartnershipRemoveManual"] = "federationPartnership-removeManual";
@@ -11,7 +11,7 @@ export declare namespace MiscFbFunctionsTypes {
11
11
  name?: string;
12
12
  lastname?: string;
13
13
  downloadEbook?: boolean;
14
- groupId?: string;
14
+ groupId?: number;
15
15
  }
16
16
  type MiscAddSubscriberResult = void;
17
17
  }
@@ -71,9 +71,11 @@ const regionByFunctions = {
71
71
  [index_1.FbFunctionName.FederationPartnershipRemove]: GCloudRegions.EuropeWest6,
72
72
  [index_1.FbFunctionName.FederationPartnershipRemoveManual]: GCloudRegions.EuropeWest6,
73
73
  [index_1.FbFunctionName.FederationPartnershipEditManual]: GCloudRegions.EuropeWest6,
74
+ [index_1.FbFunctionName.FederationPartnershipEditCountManual]: GCloudRegions.EuropeWest6,
74
75
  [index_1.FbFunctionName.FederationPartnershipGetByToken]: GCloudRegions.EuropeWest6,
75
76
  [index_1.FbFunctionName.FederationPartnershipConnect]: GCloudRegions.EuropeWest6,
76
77
  [index_1.FbFunctionName.FederationPartnershipSendInvitationToJoinEmail]: GCloudRegions.EuropeWest6,
78
+ [index_1.FbFunctionName.FederationGetConfederation]: GCloudRegions.EuropeWest6,
77
79
  [index_1.FbFunctionName.MiscValidateUsername]: GCloudRegions.UsCentral1,
78
80
  [index_1.FbFunctionName.NotificationMarkAllAsReaded]: GCloudRegions.UsCentral1,
79
81
  [index_1.FbFunctionName.PartnerAdd]: GCloudRegions.EuropeWest6,
package/helpers/auth.d.ts CHANGED
@@ -6,6 +6,7 @@ export interface AuthUserClaims {
6
6
  federation?: string;
7
7
  partnership?: string;
8
8
  superAdmin?: boolean;
9
+ besm?: boolean;
9
10
  }
10
11
  export declare enum AuthErrors {
11
12
  NoSuperAdmin = "error.auth.notSuperadmin",
@@ -9,4 +9,9 @@ export default class FederationPartnership extends PartnershipBasic<FederationPa
9
9
  get memberCount(): number;
10
10
  get partnerCount(): number;
11
11
  get token(): string | null;
12
+ get leaderCount(): number;
13
+ get hasSchool(): boolean;
14
+ get teacherCount(): number;
15
+ get studentCount(): number;
16
+ get updatedAt(): FirebaseFirestore.Timestamp | null;
12
17
  }
@@ -27,5 +27,20 @@ class FederationPartnership extends basic_1.default {
27
27
  get token() {
28
28
  return this.data.token || null;
29
29
  }
30
+ get leaderCount() {
31
+ return this.data.leaderCount || 0;
32
+ }
33
+ get hasSchool() {
34
+ return this.data.hasSchool || false;
35
+ }
36
+ get teacherCount() {
37
+ return this.data.teacherCount || 0;
38
+ }
39
+ get studentCount() {
40
+ return this.data.studentCount || 0;
41
+ }
42
+ get updatedAt() {
43
+ return this.data.updatedAt || null;
44
+ }
30
45
  }
31
46
  exports.default = FederationPartnership;
@@ -2,7 +2,10 @@ import { Timestamp } from '@google-cloud/firestore';
2
2
  import { PartnershipBasicData } from '../../Partnership/types';
3
3
  export interface FederationPartnershipData extends PartnershipBasicData {
4
4
  connectedAt: Timestamp | null;
5
- memberCount: number;
6
- partnerCount: number;
5
+ leaderCount: number;
6
+ hasSchool: boolean;
7
+ teacherCount: number | null;
8
+ studentCount: number | null;
9
+ updatedAt: FirebaseFirestore.Timestamp | null;
7
10
  token: string | null;
8
11
  }
@@ -15,6 +15,7 @@ export default class Federation extends Model<FederationData> {
15
15
  get phone(): string | null;
16
16
  get web(): string | null;
17
17
  get address(): import("../Partner/types").BasicAddressData | null;
18
+ get displayAddress(): string;
18
19
  get partnershipConnectedIds(): string[];
19
20
  get createdAt(): FirebaseFirestore.Timestamp;
20
21
  get createdBy(): FirebaseFirestore.DocumentReference<FirebaseFirestore.DocumentData>;
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ const lodash_1 = require("lodash");
6
7
  const Model_1 = __importDefault(require("../Model"));
7
8
  class Federation extends Model_1.default {
8
9
  constructor(doc) {
@@ -41,6 +42,11 @@ class Federation extends Model_1.default {
41
42
  get address() {
42
43
  return this.data.address || null;
43
44
  }
45
+ get displayAddress() {
46
+ const { street, city, postalCode, province, country } = this.address || {};
47
+ const fields = [street, postalCode, city, province, country];
48
+ return fields.filter((field) => lodash_1.isString(field) && field.trim() !== '').join(', ');
49
+ }
44
50
  get partnershipConnectedIds() {
45
51
  return this.data.partnershipConnectedIds || [];
46
52
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glissandoo/lib",
3
- "version": "1.10.4",
3
+ "version": "1.11.0",
4
4
  "description": "Glissandoo library js",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",