@stevenkellner/team-conduct-api 2.0.1 → 2.0.2
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,5 @@
|
|
|
1
1
|
import { FirestoreCollection, FirestoreDocument } from '@stevenkellner/firebase-function';
|
|
2
|
+
import { FirestoreScheme } from './FirestoreScheme';
|
|
2
3
|
import { Fine, FineTemplate, Invitation, Person, User, Team } from '../types';
|
|
3
4
|
/**
|
|
4
5
|
* Accessor class for Firestore documents and collections.
|
|
@@ -66,7 +67,7 @@ export declare class Firestore {
|
|
|
66
67
|
*
|
|
67
68
|
* @private
|
|
68
69
|
*/
|
|
69
|
-
|
|
70
|
+
protected get base(): FirestoreScheme;
|
|
70
71
|
/**
|
|
71
72
|
* Gets a reference to a team document.
|
|
72
73
|
*
|
package/package.json
CHANGED
|
@@ -5,26 +5,26 @@ import { FirebaseConfiguration } from '.';
|
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Accessor class for Firestore documents and collections.
|
|
8
|
-
*
|
|
8
|
+
*
|
|
9
9
|
* Provides type-safe access to Firestore database documents and collections
|
|
10
10
|
* following the schema defined in {@link FirestoreScheme}.
|
|
11
|
-
*
|
|
11
|
+
*
|
|
12
12
|
* Uses a singleton pattern to ensure consistent access to the Firestore instance.
|
|
13
13
|
* All methods return strongly-typed Firestore references that can be used for
|
|
14
14
|
* database operations.
|
|
15
|
-
*
|
|
15
|
+
*
|
|
16
16
|
* @example
|
|
17
17
|
* ```typescript
|
|
18
18
|
* // Access a team document
|
|
19
19
|
* const teamDoc = Firestore.shared.team(teamId);
|
|
20
|
-
*
|
|
20
|
+
*
|
|
21
21
|
* // Access a person in a team
|
|
22
22
|
* const personDoc = Firestore.shared.person(teamId, personId);
|
|
23
|
-
*
|
|
23
|
+
*
|
|
24
24
|
* // Access all fines in a team
|
|
25
25
|
* const finesCollection = Firestore.shared.fines(teamId);
|
|
26
26
|
* ```
|
|
27
|
-
*
|
|
27
|
+
*
|
|
28
28
|
* @remarks
|
|
29
29
|
* Requires {@link FirebaseConfiguration} to be configured before use.
|
|
30
30
|
* All document and collection references are lazy and don't perform any
|
|
@@ -40,19 +40,19 @@ export class Firestore {
|
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
42
|
* The singleton instance of the Firestore accessor.
|
|
43
|
-
*
|
|
43
|
+
*
|
|
44
44
|
* @private
|
|
45
45
|
*/
|
|
46
46
|
private static sharedInstance: Firestore | null = null;
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
49
|
* Gets the singleton instance of the Firestore accessor.
|
|
50
|
-
*
|
|
50
|
+
*
|
|
51
51
|
* Creates the instance on first access and returns the same instance
|
|
52
52
|
* on subsequent calls.
|
|
53
|
-
*
|
|
53
|
+
*
|
|
54
54
|
* @returns The singleton Firestore accessor instance
|
|
55
|
-
*
|
|
55
|
+
*
|
|
56
56
|
* @example
|
|
57
57
|
* ```typescript
|
|
58
58
|
* const firestore = Firestore.shared;
|
|
@@ -67,26 +67,26 @@ export class Firestore {
|
|
|
67
67
|
|
|
68
68
|
/**
|
|
69
69
|
* Gets the base Firestore schema from the configured Firebase instance.
|
|
70
|
-
*
|
|
70
|
+
*
|
|
71
71
|
* Accesses the global FirebaseConfiguration to retrieve the root document
|
|
72
72
|
* reference for all database operations.
|
|
73
|
-
*
|
|
73
|
+
*
|
|
74
74
|
* @returns The base Firestore schema with typed collections
|
|
75
|
-
*
|
|
75
|
+
*
|
|
76
76
|
* @throws {Error} If FirebaseConfiguration has not been configured
|
|
77
|
-
*
|
|
77
|
+
*
|
|
78
78
|
* @private
|
|
79
79
|
*/
|
|
80
|
-
|
|
80
|
+
protected get base(): FirestoreScheme {
|
|
81
81
|
return FirebaseConfiguration.shared.baseFirestoreDocument;
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
/**
|
|
85
85
|
* Gets a reference to a team document.
|
|
86
|
-
*
|
|
86
|
+
*
|
|
87
87
|
* @param id - The unique identifier of the team
|
|
88
88
|
* @returns A typed Firestore document reference for the team
|
|
89
|
-
*
|
|
89
|
+
*
|
|
90
90
|
* @example
|
|
91
91
|
* ```typescript
|
|
92
92
|
* const teamDoc = Firestore.shared.team(teamId);
|
|
@@ -101,10 +101,10 @@ export class Firestore {
|
|
|
101
101
|
|
|
102
102
|
/**
|
|
103
103
|
* Gets a reference to a user document.
|
|
104
|
-
*
|
|
104
|
+
*
|
|
105
105
|
* @param id - The unique identifier of the user
|
|
106
106
|
* @returns A typed Firestore document reference for the user
|
|
107
|
-
*
|
|
107
|
+
*
|
|
108
108
|
* @example
|
|
109
109
|
* ```typescript
|
|
110
110
|
* const userDoc = Firestore.shared.user(userId);
|
|
@@ -119,10 +119,10 @@ export class Firestore {
|
|
|
119
119
|
|
|
120
120
|
/**
|
|
121
121
|
* Gets a reference to an invitation document.
|
|
122
|
-
*
|
|
122
|
+
*
|
|
123
123
|
* @param id - The unique identifier of the invitation
|
|
124
124
|
* @returns A typed Firestore document reference for the invitation
|
|
125
|
-
*
|
|
125
|
+
*
|
|
126
126
|
* @example
|
|
127
127
|
* ```typescript
|
|
128
128
|
* const invitationDoc = Firestore.shared.invitation(invitationId);
|
|
@@ -137,10 +137,10 @@ export class Firestore {
|
|
|
137
137
|
|
|
138
138
|
/**
|
|
139
139
|
* Gets a reference to the persons collection within a team.
|
|
140
|
-
*
|
|
140
|
+
*
|
|
141
141
|
* @param teamId - The unique identifier of the team
|
|
142
142
|
* @returns A typed Firestore collection reference for persons in the team
|
|
143
|
-
*
|
|
143
|
+
*
|
|
144
144
|
* @example
|
|
145
145
|
* ```typescript
|
|
146
146
|
* const personsCollection = Firestore.shared.persons(teamId);
|
|
@@ -156,11 +156,11 @@ export class Firestore {
|
|
|
156
156
|
|
|
157
157
|
/**
|
|
158
158
|
* Gets a reference to a specific person document within a team.
|
|
159
|
-
*
|
|
159
|
+
*
|
|
160
160
|
* @param teamId - The unique identifier of the team
|
|
161
161
|
* @param id - The unique identifier of the person
|
|
162
162
|
* @returns A typed Firestore document reference for the person
|
|
163
|
-
*
|
|
163
|
+
*
|
|
164
164
|
* @example
|
|
165
165
|
* ```typescript
|
|
166
166
|
* const personDoc = Firestore.shared.person(teamId, personId);
|
|
@@ -174,10 +174,10 @@ export class Firestore {
|
|
|
174
174
|
|
|
175
175
|
/**
|
|
176
176
|
* Gets a reference to the fine templates collection within a team.
|
|
177
|
-
*
|
|
177
|
+
*
|
|
178
178
|
* @param teamId - The unique identifier of the team
|
|
179
179
|
* @returns A typed Firestore collection reference for fine templates in the team
|
|
180
|
-
*
|
|
180
|
+
*
|
|
181
181
|
* @example
|
|
182
182
|
* ```typescript
|
|
183
183
|
* const templatesCollection = Firestore.shared.fineTemplates(teamId);
|
|
@@ -193,11 +193,11 @@ export class Firestore {
|
|
|
193
193
|
|
|
194
194
|
/**
|
|
195
195
|
* Gets a reference to a specific fine template document within a team.
|
|
196
|
-
*
|
|
196
|
+
*
|
|
197
197
|
* @param teamId - The unique identifier of the team
|
|
198
198
|
* @param id - The unique identifier of the fine template
|
|
199
199
|
* @returns A typed Firestore document reference for the fine template
|
|
200
|
-
*
|
|
200
|
+
*
|
|
201
201
|
* @example
|
|
202
202
|
* ```typescript
|
|
203
203
|
* const templateDoc = Firestore.shared.fineTemplate(teamId, templateId);
|
|
@@ -211,10 +211,10 @@ export class Firestore {
|
|
|
211
211
|
|
|
212
212
|
/**
|
|
213
213
|
* Gets a reference to the fines collection within a team.
|
|
214
|
-
*
|
|
214
|
+
*
|
|
215
215
|
* @param teamId - The unique identifier of the team
|
|
216
216
|
* @returns A typed Firestore collection reference for fines in the team
|
|
217
|
-
*
|
|
217
|
+
*
|
|
218
218
|
* @example
|
|
219
219
|
* ```typescript
|
|
220
220
|
* const finesCollection = Firestore.shared.fines(teamId);
|
|
@@ -230,11 +230,11 @@ export class Firestore {
|
|
|
230
230
|
|
|
231
231
|
/**
|
|
232
232
|
* Gets a reference to a specific fine document within a team.
|
|
233
|
-
*
|
|
233
|
+
*
|
|
234
234
|
* @param teamId - The unique identifier of the team
|
|
235
235
|
* @param id - The unique identifier of the fine
|
|
236
236
|
* @returns A typed Firestore document reference for the fine
|
|
237
|
-
*
|
|
237
|
+
*
|
|
238
238
|
* @example
|
|
239
239
|
* ```typescript
|
|
240
240
|
* const fineDoc = Firestore.shared.fine(teamId, fineId);
|