@stevenkellner/team-conduct-api 1.0.35 → 1.0.36
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.
|
@@ -27,10 +27,11 @@ export declare namespace InvitationGetInvitationFunction {
|
|
|
27
27
|
}
|
|
28
28
|
class ReturnType implements Flattable<ReturnType.Flatten> {
|
|
29
29
|
teamId: Team.Id;
|
|
30
|
+
teamName: string;
|
|
30
31
|
private personIdOrPersons;
|
|
31
32
|
private constructor();
|
|
32
|
-
static from(teamId: Team.Id, personId: Person.Id): ReturnType;
|
|
33
|
-
static from(teamId: Team.Id, persons: {
|
|
33
|
+
static from(teamId: Team.Id, teamName: string, personId: Person.Id): ReturnType;
|
|
34
|
+
static from(teamId: Team.Id, teamName: string, persons: {
|
|
34
35
|
id: Person.Id;
|
|
35
36
|
properties: PersonPrivateProperties;
|
|
36
37
|
}[]): ReturnType;
|
|
@@ -44,6 +45,7 @@ export declare namespace InvitationGetInvitationFunction {
|
|
|
44
45
|
namespace ReturnType {
|
|
45
46
|
type Flatten = {
|
|
46
47
|
teamId: Team.Id.Flatten;
|
|
48
|
+
teamName: string;
|
|
47
49
|
} & InvitationGetInvitationFunction.PersonIdOrPersons.Flatten;
|
|
48
50
|
class TypeBuilder implements ITypeBuilder<Flatten, ReturnType> {
|
|
49
51
|
build(value: Flatten): ReturnType;
|
|
@@ -15,8 +15,12 @@ class InvitationGetInvitationFunction extends firebase_function_1.FirebaseFuncti
|
|
|
15
15
|
if (!invitationSnapshot.exists)
|
|
16
16
|
throw new firebase_function_1.FunctionsError('not-found', 'Invitation not found');
|
|
17
17
|
const invitation = types_1.Invitation.builder.build(invitationSnapshot.data);
|
|
18
|
+
const teamSnapshot = await Firestore_1.Firestore.shared.team(invitation.teamId).snapshot();
|
|
19
|
+
if (!teamSnapshot.exists)
|
|
20
|
+
throw new firebase_function_1.FunctionsError('not-found', 'Team not found');
|
|
21
|
+
const team = types_1.Team.builder.build(teamSnapshot.data);
|
|
18
22
|
if (invitation.personId !== null)
|
|
19
|
-
return InvitationGetInvitationFunction.ReturnType.from(invitation.teamId, invitation.personId);
|
|
23
|
+
return InvitationGetInvitationFunction.ReturnType.from(invitation.teamId, team.name, invitation.personId);
|
|
20
24
|
const personSnapshots = await Firestore_1.Firestore.shared.persons(invitation.teamId).documentSnapshots();
|
|
21
25
|
const persons = (0, typescript_common_functionality_1.compactMap)(personSnapshots, personSnapshot => {
|
|
22
26
|
if (!personSnapshot.exists)
|
|
@@ -29,25 +33,27 @@ class InvitationGetInvitationFunction extends firebase_function_1.FirebaseFuncti
|
|
|
29
33
|
properties: person.properties
|
|
30
34
|
};
|
|
31
35
|
});
|
|
32
|
-
return InvitationGetInvitationFunction.ReturnType.from(invitation.teamId, persons);
|
|
36
|
+
return InvitationGetInvitationFunction.ReturnType.from(invitation.teamId, team.name, persons);
|
|
33
37
|
}
|
|
34
38
|
}
|
|
35
39
|
exports.InvitationGetInvitationFunction = InvitationGetInvitationFunction;
|
|
36
40
|
(function (InvitationGetInvitationFunction) {
|
|
37
41
|
class ReturnType {
|
|
38
42
|
teamId;
|
|
43
|
+
teamName;
|
|
39
44
|
personIdOrPersons;
|
|
40
|
-
constructor(teamId, personIdOrPersons) {
|
|
45
|
+
constructor(teamId, teamName, personIdOrPersons) {
|
|
41
46
|
this.teamId = teamId;
|
|
47
|
+
this.teamName = teamName;
|
|
42
48
|
this.personIdOrPersons = personIdOrPersons;
|
|
43
49
|
}
|
|
44
|
-
static from(teamId, personIdOrPersons) {
|
|
50
|
+
static from(teamId, teamName, personIdOrPersons) {
|
|
45
51
|
if (Array.isArray(personIdOrPersons)) {
|
|
46
|
-
return new ReturnType(teamId, {
|
|
52
|
+
return new ReturnType(teamId, teamName, {
|
|
47
53
|
persons: personIdOrPersons
|
|
48
54
|
});
|
|
49
55
|
}
|
|
50
|
-
return new ReturnType(teamId, {
|
|
56
|
+
return new ReturnType(teamId, teamName, {
|
|
51
57
|
personId: personIdOrPersons
|
|
52
58
|
});
|
|
53
59
|
}
|
|
@@ -65,11 +71,13 @@ exports.InvitationGetInvitationFunction = InvitationGetInvitationFunction;
|
|
|
65
71
|
if ('personId' in this.personIdOrPersons) {
|
|
66
72
|
return {
|
|
67
73
|
teamId: this.teamId.flatten,
|
|
74
|
+
teamName: this.teamName,
|
|
68
75
|
personId: this.personIdOrPersons.personId.flatten
|
|
69
76
|
};
|
|
70
77
|
}
|
|
71
78
|
return {
|
|
72
79
|
teamId: this.teamId.flatten,
|
|
80
|
+
teamName: this.teamName,
|
|
73
81
|
persons: this.personIdOrPersons.persons.map(person => ({
|
|
74
82
|
id: person.id.flatten,
|
|
75
83
|
properties: person.properties.flatten
|
|
@@ -82,9 +90,9 @@ exports.InvitationGetInvitationFunction = InvitationGetInvitationFunction;
|
|
|
82
90
|
class TypeBuilder {
|
|
83
91
|
build(value) {
|
|
84
92
|
if ('personId' in value) {
|
|
85
|
-
return ReturnType.from(types_1.Team.Id.builder.build(value.teamId), types_1.Person.Id.builder.build(value.personId));
|
|
93
|
+
return ReturnType.from(types_1.Team.Id.builder.build(value.teamId), value.teamName, types_1.Person.Id.builder.build(value.personId));
|
|
86
94
|
}
|
|
87
|
-
return ReturnType.from(types_1.Team.Id.builder.build(value.teamId), value.persons.map(person => ({
|
|
95
|
+
return ReturnType.from(types_1.Team.Id.builder.build(value.teamId), value.teamName, value.persons.map(person => ({
|
|
88
96
|
id: types_1.Person.Id.builder.build(person.id),
|
|
89
97
|
properties: types_1.PersonPrivateProperties.builder.build(person.properties)
|
|
90
98
|
})));
|
package/package.json
CHANGED
|
@@ -19,8 +19,13 @@ export class InvitationGetInvitationFunction extends FirebaseFunction<Invitation
|
|
|
19
19
|
throw new FunctionsError('not-found', 'Invitation not found');
|
|
20
20
|
const invitation = Invitation.builder.build(invitationSnapshot.data);
|
|
21
21
|
|
|
22
|
+
const teamSnapshot = await Firestore.shared.team(invitation.teamId).snapshot();
|
|
23
|
+
if (!teamSnapshot.exists)
|
|
24
|
+
throw new FunctionsError('not-found', 'Team not found');
|
|
25
|
+
const team = Team.builder.build(teamSnapshot.data);
|
|
26
|
+
|
|
22
27
|
if (invitation.personId !== null)
|
|
23
|
-
return InvitationGetInvitationFunction.ReturnType.from(invitation.teamId, invitation.personId);
|
|
28
|
+
return InvitationGetInvitationFunction.ReturnType.from(invitation.teamId, team.name, invitation.personId);
|
|
24
29
|
|
|
25
30
|
const personSnapshots = await Firestore.shared.persons(invitation.teamId).documentSnapshots();
|
|
26
31
|
const persons = compactMap(personSnapshots, personSnapshot => {
|
|
@@ -34,7 +39,7 @@ export class InvitationGetInvitationFunction extends FirebaseFunction<Invitation
|
|
|
34
39
|
properties: person.properties
|
|
35
40
|
};
|
|
36
41
|
});
|
|
37
|
-
return InvitationGetInvitationFunction.ReturnType.from(invitation.teamId, persons);
|
|
42
|
+
return InvitationGetInvitationFunction.ReturnType.from(invitation.teamId, team.name, persons);
|
|
38
43
|
}
|
|
39
44
|
}
|
|
40
45
|
|
|
@@ -65,18 +70,19 @@ export namespace InvitationGetInvitationFunction {
|
|
|
65
70
|
|
|
66
71
|
private constructor(
|
|
67
72
|
public teamId: Team.Id,
|
|
73
|
+
public teamName: string,
|
|
68
74
|
private personIdOrPersons: PersonIdOrPersons
|
|
69
75
|
) {}
|
|
70
76
|
|
|
71
|
-
public static from(teamId: Team.Id, personId: Person.Id): ReturnType;
|
|
72
|
-
public static from(teamId: Team.Id, persons: { id: Person.Id, properties: PersonPrivateProperties }[]): ReturnType;
|
|
73
|
-
public static from(teamId: Team.Id, personIdOrPersons: Person.Id | { id: Person.Id, properties: PersonPrivateProperties }[]): ReturnType {
|
|
77
|
+
public static from(teamId: Team.Id, teamName: string, personId: Person.Id): ReturnType;
|
|
78
|
+
public static from(teamId: Team.Id, teamName: string, persons: { id: Person.Id, properties: PersonPrivateProperties }[]): ReturnType;
|
|
79
|
+
public static from(teamId: Team.Id, teamName: string, personIdOrPersons: Person.Id | { id: Person.Id, properties: PersonPrivateProperties }[]): ReturnType {
|
|
74
80
|
if (Array.isArray(personIdOrPersons)) {
|
|
75
|
-
return new ReturnType(teamId, {
|
|
81
|
+
return new ReturnType(teamId, teamName, {
|
|
76
82
|
persons: personIdOrPersons
|
|
77
83
|
});
|
|
78
84
|
}
|
|
79
|
-
return new ReturnType(teamId, {
|
|
85
|
+
return new ReturnType(teamId, teamName, {
|
|
80
86
|
personId: personIdOrPersons
|
|
81
87
|
});
|
|
82
88
|
}
|
|
@@ -100,11 +106,13 @@ export namespace InvitationGetInvitationFunction {
|
|
|
100
106
|
if ('personId' in this.personIdOrPersons) {
|
|
101
107
|
return {
|
|
102
108
|
teamId: this.teamId.flatten,
|
|
109
|
+
teamName: this.teamName,
|
|
103
110
|
personId: this.personIdOrPersons.personId.flatten
|
|
104
111
|
};
|
|
105
112
|
}
|
|
106
113
|
return {
|
|
107
114
|
teamId: this.teamId.flatten,
|
|
115
|
+
teamName: this.teamName,
|
|
108
116
|
persons: this.personIdOrPersons.persons.map(person => ({
|
|
109
117
|
id: person.id.flatten,
|
|
110
118
|
properties: person.properties.flatten
|
|
@@ -116,7 +124,8 @@ export namespace InvitationGetInvitationFunction {
|
|
|
116
124
|
export namespace ReturnType {
|
|
117
125
|
|
|
118
126
|
export type Flatten = {
|
|
119
|
-
teamId: Team.Id.Flatten
|
|
127
|
+
teamId: Team.Id.Flatten,
|
|
128
|
+
teamName: string
|
|
120
129
|
} & InvitationGetInvitationFunction.PersonIdOrPersons.Flatten;
|
|
121
130
|
|
|
122
131
|
export class TypeBuilder implements ITypeBuilder<Flatten, ReturnType> {
|
|
@@ -125,11 +134,13 @@ export namespace InvitationGetInvitationFunction {
|
|
|
125
134
|
if ('personId' in value) {
|
|
126
135
|
return ReturnType.from(
|
|
127
136
|
Team.Id.builder.build(value.teamId),
|
|
137
|
+
value.teamName,
|
|
128
138
|
Person.Id.builder.build(value.personId)
|
|
129
139
|
);
|
|
130
140
|
}
|
|
131
141
|
return ReturnType.from(
|
|
132
142
|
Team.Id.builder.build(value.teamId),
|
|
143
|
+
value.teamName,
|
|
133
144
|
value.persons.map(person => ({
|
|
134
145
|
id: Person.Id.builder.build(person.id),
|
|
135
146
|
properties: PersonPrivateProperties.builder.build(person.properties)
|