@glissandoo/lib 1.4.4 → 1.4.6
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/functions/group.d.ts +1 -0
- package/functions/index.d.ts +2 -0
- package/functions/index.js +2 -0
- package/functions/partnership.d.ts +10 -2
- package/functions/regions.js +2 -0
- package/helpers/plans.js +1 -1
- package/helpers/types.d.ts +11 -0
- package/helpers/types.js +8 -0
- package/models/Federation/index.d.ts +4 -3
- package/models/Federation/types.d.ts +1 -11
- package/models/Federation/types.js +0 -6
- package/models/Group/index.d.ts +1 -0
- package/models/Group/index.js +3 -0
- package/models/Group/types.d.ts +1 -0
- package/models/Partnership/Group/index.d.ts +2 -0
- package/models/Partnership/Group/index.js +6 -0
- package/models/Partnership/Group/types.d.ts +5 -1
- package/models/Partnership/index.d.ts +4 -1
- package/models/Partnership/index.js +9 -3
- package/models/Partnership/types.d.ts +2 -0
- package/package.json +1 -1
package/functions/group.d.ts
CHANGED
package/functions/index.d.ts
CHANGED
|
@@ -76,6 +76,8 @@ export declare enum FbFunctionName {
|
|
|
76
76
|
PartnershipEdit = "partnership-edit",
|
|
77
77
|
PartnershipGetBalance = "partnership-getBalance",
|
|
78
78
|
PartnershipOnUpdate = "partnership-onUpdate",
|
|
79
|
+
PartnershipAddConfirmedAdmin = "partnership-addConfirmedAdmin",
|
|
80
|
+
PartnershipRemoveAdmin = "partnership-removeAdmin",
|
|
79
81
|
PartnershipGetMandateRequest = "partnership-getMandateRequest",
|
|
80
82
|
PartnershipOnMandateCreated = "partnership-onMandateCreated",
|
|
81
83
|
PartnershipPlanAdd = "partnershipPlan-add",
|
package/functions/index.js
CHANGED
|
@@ -80,6 +80,8 @@ var FbFunctionName;
|
|
|
80
80
|
FbFunctionName["PartnershipEdit"] = "partnership-edit";
|
|
81
81
|
FbFunctionName["PartnershipGetBalance"] = "partnership-getBalance";
|
|
82
82
|
FbFunctionName["PartnershipOnUpdate"] = "partnership-onUpdate";
|
|
83
|
+
FbFunctionName["PartnershipAddConfirmedAdmin"] = "partnership-addConfirmedAdmin";
|
|
84
|
+
FbFunctionName["PartnershipRemoveAdmin"] = "partnership-removeAdmin";
|
|
83
85
|
FbFunctionName["PartnershipGetMandateRequest"] = "partnership-getMandateRequest";
|
|
84
86
|
FbFunctionName["PartnershipOnMandateCreated"] = "partnership-onMandateCreated";
|
|
85
87
|
FbFunctionName["PartnershipPlanAdd"] = "partnershipPlan-add";
|
|
@@ -8,14 +8,22 @@ export declare namespace PartnershipFbFunctionsTypes {
|
|
|
8
8
|
phone: string | null;
|
|
9
9
|
address: BasicAddressData;
|
|
10
10
|
legalContact: LegalContactData | null;
|
|
11
|
-
createLemonwayAccount: boolean;
|
|
12
|
-
administrators: string[];
|
|
13
11
|
partnershipId: string;
|
|
14
12
|
CIF: string | null;
|
|
15
13
|
}
|
|
16
14
|
type CreateResult = void;
|
|
17
15
|
type EditParams = CreateParams;
|
|
18
16
|
type EditResult = void;
|
|
17
|
+
interface AddConfirmedAdminParams {
|
|
18
|
+
partnershipId: string;
|
|
19
|
+
userId: string;
|
|
20
|
+
}
|
|
21
|
+
type AddConfirmedAdminResult = void;
|
|
22
|
+
interface RemoveAdminParams {
|
|
23
|
+
partnershipId: string;
|
|
24
|
+
email: string;
|
|
25
|
+
}
|
|
26
|
+
type RemoveAdminResult = void;
|
|
19
27
|
interface GetBalanceParams {
|
|
20
28
|
partnershipId: string;
|
|
21
29
|
}
|
package/functions/regions.js
CHANGED
|
@@ -86,6 +86,8 @@ const regionByFunctions = {
|
|
|
86
86
|
[index_1.FbFunctionName.PartnershipEdit]: GCloudRegions.EuropeWest6,
|
|
87
87
|
[index_1.FbFunctionName.PartnershipGetBalance]: GCloudRegions.EuropeWest6,
|
|
88
88
|
[index_1.FbFunctionName.PartnershipOnUpdate]: GCloudRegions.EuropeWest6,
|
|
89
|
+
[index_1.FbFunctionName.PartnershipAddConfirmedAdmin]: GCloudRegions.EuropeWest6,
|
|
90
|
+
[index_1.FbFunctionName.PartnershipRemoveAdmin]: GCloudRegions.EuropeWest6,
|
|
89
91
|
[index_1.FbFunctionName.PartnershipGetMandateRequest]: GCloudRegions.EuropeWest6,
|
|
90
92
|
[index_1.FbFunctionName.PartnershipOnMandateCreated]: GCloudRegions.EuropeWest6,
|
|
91
93
|
[index_1.FbFunctionName.PartnershipPlanAdd]: GCloudRegions.EuropeWest6,
|
package/helpers/plans.js
CHANGED
|
@@ -9,7 +9,7 @@ var PlansGroup;
|
|
|
9
9
|
PlansGroup["Tutti"] = "tutti";
|
|
10
10
|
})(PlansGroup = exports.PlansGroup || (exports.PlansGroup = {}));
|
|
11
11
|
exports.membersPerPlan = {
|
|
12
|
-
[PlansGroup.Piano]:
|
|
12
|
+
[PlansGroup.Piano]: 20,
|
|
13
13
|
[PlansGroup.Mezzo]: 30,
|
|
14
14
|
[PlansGroup.Forte]: 60,
|
|
15
15
|
[PlansGroup.Tutti]: 1000,
|
package/helpers/types.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AdminItemStatus = void 0;
|
|
4
|
+
var AdminItemStatus;
|
|
5
|
+
(function (AdminItemStatus) {
|
|
6
|
+
AdminItemStatus["Pending"] = "pending";
|
|
7
|
+
AdminItemStatus["Accepted"] = "accepted";
|
|
8
|
+
})(AdminItemStatus = exports.AdminItemStatus || (exports.AdminItemStatus = {}));
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { DocumentSnapshot } from '@google-cloud/firestore';
|
|
2
|
+
import { AdminItemStatus } from '../../helpers/types';
|
|
2
3
|
import Model from '../Model';
|
|
3
|
-
import {
|
|
4
|
+
import { FederationData } from './types';
|
|
4
5
|
export default class Federation extends Model<FederationData> {
|
|
5
6
|
constructor(doc: DocumentSnapshot);
|
|
6
7
|
get displayName(): string;
|
|
7
8
|
get email(): string | null;
|
|
8
9
|
get partnershipIds(): string[];
|
|
9
10
|
get adminIds(): string[];
|
|
10
|
-
get adminList(): import("
|
|
11
|
-
adminListByStatus(status: AdminItemStatus): import("
|
|
11
|
+
get adminList(): import("../../helpers/types").AdminItem[];
|
|
12
|
+
adminListByStatus(status: AdminItemStatus): import("../../helpers/types").AdminItem[];
|
|
12
13
|
isAdmin(userId: string): boolean;
|
|
13
14
|
get photoURL(): string;
|
|
14
15
|
get phone(): string | null;
|
|
@@ -1,16 +1,6 @@
|
|
|
1
1
|
import { DocumentReference, Timestamp } from '@google-cloud/firestore';
|
|
2
|
+
import { AdminItem } from '../../helpers/types';
|
|
2
3
|
import { BasicAddressData } from '../Partner/types';
|
|
3
|
-
export declare enum AdminItemStatus {
|
|
4
|
-
Pending = "pending",
|
|
5
|
-
Accepted = "accepted"
|
|
6
|
-
}
|
|
7
|
-
export interface AdminItem {
|
|
8
|
-
id: string | null;
|
|
9
|
-
email: string;
|
|
10
|
-
displayName: string | null;
|
|
11
|
-
photoURL: string | null;
|
|
12
|
-
status: AdminItemStatus;
|
|
13
|
-
}
|
|
14
4
|
export interface FederationData {
|
|
15
5
|
displayName: string;
|
|
16
6
|
photoURL: string;
|
|
@@ -1,8 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AdminItemStatus = void 0;
|
|
4
|
-
var AdminItemStatus;
|
|
5
|
-
(function (AdminItemStatus) {
|
|
6
|
-
AdminItemStatus["Pending"] = "pending";
|
|
7
|
-
AdminItemStatus["Accepted"] = "accepted";
|
|
8
|
-
})(AdminItemStatus = exports.AdminItemStatus || (exports.AdminItemStatus = {}));
|
package/models/Group/index.d.ts
CHANGED
|
@@ -44,6 +44,7 @@ export default class Group extends GroupBasic<GroupData> {
|
|
|
44
44
|
current: number;
|
|
45
45
|
last: number;
|
|
46
46
|
};
|
|
47
|
+
get metadata(): Record<string, string>;
|
|
47
48
|
getPlayer: (userId: string) => import("../Player/types").PlayerBasicData | null;
|
|
48
49
|
isAdmin: (userId: string) => boolean;
|
|
49
50
|
isPlayer: (userId: string) => boolean;
|
package/models/Group/index.js
CHANGED
|
@@ -134,6 +134,9 @@ class Group extends basic_1.default {
|
|
|
134
134
|
get satisfactionIndex() {
|
|
135
135
|
return this.data.satisfactionIndex || { current: 0, last: 0 };
|
|
136
136
|
}
|
|
137
|
+
get metadata() {
|
|
138
|
+
return this.data.metadata || {};
|
|
139
|
+
}
|
|
137
140
|
get isExpiredTrial() {
|
|
138
141
|
const isOutDateTrial = date_fns_1.isBefore(this.createdAt.toDate(), date_fns_1.subMonths(new Date(), 1));
|
|
139
142
|
const members = this.activePlayers.length;
|
package/models/Group/types.d.ts
CHANGED
|
@@ -4,5 +4,7 @@ import GroupBasic from '../../Group/basic';
|
|
|
4
4
|
import { PartnershipGroupData } from './types';
|
|
5
5
|
export default class PartnershipGroup extends GroupBasic<PartnershipGroupData> {
|
|
6
6
|
constructor(doc: DocumentSnapshot, lang?: LanguagesTypes);
|
|
7
|
+
get linkedAt(): FirebaseFirestore.Timestamp;
|
|
8
|
+
get linkedBy(): FirebaseFirestore.DocumentReference<FirebaseFirestore.DocumentData>;
|
|
7
9
|
get partnershipId(): string;
|
|
8
10
|
}
|
|
@@ -10,6 +10,12 @@ class PartnershipGroup extends basic_1.default {
|
|
|
10
10
|
constructor(doc, lang = lang_1.defaultLocale) {
|
|
11
11
|
super(doc, lang);
|
|
12
12
|
}
|
|
13
|
+
get linkedAt() {
|
|
14
|
+
return this.data.linkedAt;
|
|
15
|
+
}
|
|
16
|
+
get linkedBy() {
|
|
17
|
+
return this.data.linkedBy;
|
|
18
|
+
}
|
|
13
19
|
get partnershipId() {
|
|
14
20
|
return get_1.default(this.ref, 'parent.parent.id');
|
|
15
21
|
}
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
+
import { DocumentReference, Timestamp } from '@google-cloud/firestore';
|
|
1
2
|
import { GroupBasicData } from '../../Group/types';
|
|
2
|
-
export
|
|
3
|
+
export interface PartnershipGroupData extends GroupBasicData {
|
|
4
|
+
readonly linkedBy: DocumentReference;
|
|
5
|
+
readonly linkedAt: Timestamp;
|
|
6
|
+
}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { DocumentSnapshot } from '@google-cloud/firestore';
|
|
2
|
+
import { AdminItemStatus } from '../../helpers/types';
|
|
2
3
|
import PartnershipBasic from './basic';
|
|
3
4
|
import { PartnershipData, PartnershipStatus } from './types';
|
|
4
5
|
export default class Partnership extends PartnershipBasic<PartnershipData> {
|
|
5
6
|
constructor(doc: DocumentSnapshot);
|
|
6
7
|
get description(): string;
|
|
7
8
|
get admins(): string[];
|
|
9
|
+
get adminList(): import("../../helpers/types").AdminItem[];
|
|
10
|
+
adminListByStatus(status: AdminItemStatus): import("../../helpers/types").AdminItem[];
|
|
11
|
+
isAdmin(userId: string): boolean;
|
|
8
12
|
get status(): PartnershipStatus;
|
|
9
13
|
get legalContact(): import("./types").LegalContactData | null;
|
|
10
14
|
get createdAt(): FirebaseFirestore.Timestamp;
|
|
@@ -15,5 +19,4 @@ export default class Partnership extends PartnershipBasic<PartnershipData> {
|
|
|
15
19
|
get isActive(): boolean;
|
|
16
20
|
get federationIds(): string[];
|
|
17
21
|
get gocardlessCustomerId(): string | null;
|
|
18
|
-
isAdmin(userId: string): boolean;
|
|
19
22
|
}
|
|
@@ -15,6 +15,15 @@ class Partnership extends basic_1.default {
|
|
|
15
15
|
get admins() {
|
|
16
16
|
return this.data.administrators || [];
|
|
17
17
|
}
|
|
18
|
+
get adminList() {
|
|
19
|
+
return this.data.administratorsList || [];
|
|
20
|
+
}
|
|
21
|
+
adminListByStatus(status) {
|
|
22
|
+
return this.adminList.filter((item) => item.status === status);
|
|
23
|
+
}
|
|
24
|
+
isAdmin(userId) {
|
|
25
|
+
return this.admins.includes(userId);
|
|
26
|
+
}
|
|
18
27
|
get status() {
|
|
19
28
|
if (this.isDeleted) {
|
|
20
29
|
return types_1.PartnershipStatus.Deleted;
|
|
@@ -51,8 +60,5 @@ class Partnership extends basic_1.default {
|
|
|
51
60
|
get gocardlessCustomerId() {
|
|
52
61
|
return this.data.gocardlessCustomerId || null;
|
|
53
62
|
}
|
|
54
|
-
isAdmin(userId) {
|
|
55
|
-
return this.admins.includes(userId);
|
|
56
|
-
}
|
|
57
63
|
}
|
|
58
64
|
exports.default = Partnership;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Timestamp } from '@google-cloud/firestore';
|
|
2
|
+
import { AdminItem } from '../../helpers/types';
|
|
2
3
|
import { BasicAddressData } from '../Partner/types';
|
|
3
4
|
export declare enum PartnershipStatus {
|
|
4
5
|
Verified = "verified",
|
|
@@ -30,6 +31,7 @@ export interface PartnershipData extends PartnershipBasicData {
|
|
|
30
31
|
description: string;
|
|
31
32
|
legalContact: LegalContactData | null;
|
|
32
33
|
administrators: string[];
|
|
34
|
+
administratorsList: AdminItem[];
|
|
33
35
|
verifiedAt: Timestamp | null;
|
|
34
36
|
deletedAt: Timestamp | null;
|
|
35
37
|
federationIds: string[];
|