@jobsearch-works/firestore-models 1.1.8 → 1.1.9

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/README.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # firestore-models
2
2
 
3
+ [![npm version](https://img.shields.io/npm/v/@jobsearch-works/firestore-models.svg?style=flat-square)](https://www.npmjs.com/package/@jobsearch-works/firestore-models)
4
+ [![license](https://img.shields.io/npm/l/@jobsearch-works/firestore-models.svg?style=flat-square)](./LICENSE)
5
+
3
6
  A shared library for standardizing Firestore document schemas and paths across multiple projects.
4
7
 
5
8
  This library provides:
@@ -50,32 +53,392 @@ firestore-models/
50
53
 
51
54
  ---
52
55
 
56
+ ## 🔗 Entity Relationships
57
+
58
+ The following diagram and table illustrate how the main Firestore models relate to each other, both by reference (IDs) and by Firestore subcollections/paths:
59
+
60
+ ```
61
+ Client
62
+ ├── applications (Application)
63
+ │ └── questions (ApplicationQuestion)
64
+ ├── questions (ClientQuestion)
65
+ ├── preferences/targetPreferences (TargetPreferences)
66
+ ├── vacancySuggestions (VacancySuggestion)
67
+ └── clientEmails/{clientId}/messages (GmailMessage)
68
+
69
+ Vacancy
70
+ └── Referenced by Application and VacancySuggestion
71
+
72
+ Agent
73
+ └── Root collection
74
+
75
+ User
76
+ └── Root collection
77
+
78
+ ClientData
79
+ └── Root collection
80
+
81
+ ClientLogin
82
+ └── clientLogins/{userId}/logins/{domain}
83
+ ```
84
+
85
+ | Entity | References / Path | Description |
86
+ | ------------------- | ---------------------------------------------------- | -------------------------------------------------------------------- |
87
+ | Client | Root collection | Main user entity |
88
+ | Application | clients/{clientId}/applications/{applicationId} | References `clientId`, `vacancyId` |
89
+ | ApplicationQuestion | .../applications/{applicationId}/questions/{qId} | Subcollection of Application |
90
+ | ClientQuestion | clients/{clientId}/questions/{questionId} | Subcollection of Client |
91
+ | Vacancy | Root collection | Referenced by Application, VacancySuggestion |
92
+ | VacancySuggestion | clients/{clientId}/vacancySuggestions/{suggestionId} | References `clientId`, `vacancyId` |
93
+ | TargetPreferences | clients/{clientId}/preferences/targetPreferences | References `clientId`, contains `TargetJob[]` and `TargetLocation[]` |
94
+ | TargetJob | Embedded in TargetPreferences | Contains `category` (VacancyCategory) |
95
+ | TargetLocation | Embedded in TargetPreferences | List of preferred locations |
96
+ | Agent | Root collection | Standalone entity |
97
+ | AuthUser | Root collection | Standalone entity |
98
+ | ClientData | Root collection | Standalone entity |
99
+ | ClientLogin | clientLogins/{userId}/logins/{domain} | References `userId` |
100
+ | GmailMessage | clientEmails/{clientId}/messages/{messageId} | References `clientId` |
101
+
102
+ **Notes:**
103
+
104
+ - Most subcollections are nested under `Client` (e.g., applications, questions, vacancySuggestions).
105
+ - `Application` and `VacancySuggestion` reference both `clientId` (parent) and `vacancyId` (target job).
106
+ - `TargetPreferences` embeds arrays of `TargetJob` and `TargetLocation`.
107
+ - All relationships are enforced by Firestore path structure and cross-referenced IDs.
108
+
109
+ ---
110
+
53
111
  ## ✅ Usage
54
112
 
55
113
  ### Importing Models and Paths
56
114
 
57
115
  ```ts
58
116
  import { Client } from "@jobsearch-works/firestore-models/types/Client";
59
- import { pathStrings } from "@jobsearch-works/firestore-models/paths/pathStrings";
117
+ import { firestorePaths } from "@jobsearch-works/firestore-models/paths/firestorePaths";
60
118
 
61
- const clientPath = pathStrings.client("abc123"); // → "clients/abc123"
119
+ const clientDocPath = firestorePaths.clients.doc("abc123"); // → "clients/abc123"
62
120
  ```
63
121
 
64
122
  ---
65
123
 
66
- ## 🔒 Type Definition Example
124
+ ## 📄 Firestore Models (Types)
125
+
126
+ All Firestore document schemas are defined as TypeScript interfaces in `src/types`. These are pure data types (SDK-free) and can be reused across apps, functions, and tests.
127
+
128
+ > **Why does every model include `id?: string`?**
129
+ > Firestore's `.data()` does **not** include the document ID. This library's types include `id` as an optional property, which is added manually when fetching data. This makes it easier to use models in UI, caching, and linking between entities.
130
+
131
+ ### Main Types (alphabetical)
132
+
133
+ - **Agent**
134
+
135
+ ```ts
136
+ export interface Agent {
137
+ id?: string;
138
+ name: string;
139
+ email: string;
140
+ status: "active" | "inactive";
141
+ profilePicture?: string;
142
+ createdAt?: Date | string;
143
+ updatedAt?: Date | string;
144
+ }
145
+ ```
146
+
147
+ - **Application**
148
+
149
+ ```ts
150
+ export interface Application {
151
+ id?: string;
152
+ vacancyId: string;
153
+ clientId: string;
154
+ status: ApplicationStatus;
155
+ assignedTo?: string;
156
+ coverLetter?: string;
157
+ resume?: string;
158
+ // Status timestamps
159
+ submittedAt?: Date | string;
160
+ interviewingAt?: Date | string;
161
+ acceptedAt?: Date | string;
162
+ rejectedAt?: Date | string;
163
+ withdrawnAt?: Date | string;
164
+ applyingAt?: Date | string;
165
+ suggestedAt?: Date | string;
166
+ approvedAt?: Date | string;
167
+ // Denormalized/snapshot fields from Vacancy
168
+ company?: string;
169
+ position?: string;
170
+ location?: string;
171
+ jobId?: string;
172
+ advertisingUrl?: string;
173
+ applicationUrl?: string;
174
+ applicationDomain?: string;
175
+ advertisingDomain?: string;
176
+ description?: string;
177
+ fullPageText?: string;
178
+ createdAt?: Date | string;
179
+ updatedAt?: Date | string;
180
+ }
181
+ ```
182
+
183
+ - `ApplicationStatus` values: new, submitted, interviewing, accepted, rejected, withdrawn, applying, suggested, approved
184
+
185
+ - **ApplicationQuestion**
186
+
187
+ ```ts
188
+ export interface ApplicationQuestion {
189
+ id?: string;
190
+ questionText: string;
191
+ answerText?: string;
192
+ type: "text" | "select";
193
+ createdAt?: Date | string;
194
+ updatedAt?: Date | string;
195
+ }
196
+ ```
197
+
198
+ - **AuthUser**
199
+
200
+ ```ts
201
+ export interface AuthUser {
202
+ id?: string;
203
+ email: string;
204
+ displayName?: string;
205
+ photoURL?: string;
206
+ lastSignIn?: string; // ISO string
207
+ emailVerified?: boolean;
208
+ createdAt?: Date | string;
209
+ updatedAt?: Date | string;
210
+ }
211
+ ```
212
+
213
+ - **Client**
214
+
215
+ ```ts
216
+ export interface Client {
217
+ id?: string;
218
+ name: string;
219
+ email: string;
220
+ status: "active" | "inactive";
221
+ resume?: string;
222
+ createdAt?: Date | string;
223
+ }
224
+ ```
225
+
226
+ - **ClientData**
227
+
228
+ ```ts
229
+ export interface ClientData {
230
+ id?: string;
231
+ firstName: string;
232
+ lastName: string;
233
+ middleName?: string;
234
+ preferredName?: string;
235
+ email: string;
236
+ phone: string;
237
+ address: string;
238
+ city: string;
239
+ suburb: string;
240
+ state: string;
241
+ zip: string;
242
+ country: string;
243
+ linkedIn?: string;
244
+ countryPhoneCode: string;
245
+ nationality: string;
246
+ dateOfBirth?: Date | string;
247
+ createdAt?: Date | string;
248
+ updatedAt?: Date | string;
249
+ }
250
+ ```
251
+
252
+ - **ClientLogin**
253
+
254
+ ```ts
255
+ export interface ClientLogin {
256
+ id?: string;
257
+ userId: string;
258
+ url: string;
259
+ domain: string;
260
+ username?: string;
261
+ password: string;
262
+ email?: string;
263
+ createdAt?: Date | string;
264
+ updatedAt?: Date | string;
265
+ }
266
+ ```
267
+
268
+ - **ClientQuestion**
269
+
270
+ ```ts
271
+ export interface ClientQuestion {
272
+ id?: string;
273
+ questionText: string;
274
+ answerText?: string;
275
+ type: "text" | "select";
276
+ options?: string[];
277
+ createdAt?: Date | string;
278
+ updatedAt?: Date | string;
279
+ }
280
+ ```
281
+
282
+ - **GmailMessage**
283
+
284
+ ```ts
285
+ export interface GmailMessage {
286
+ id?: string;
287
+ messageId: string;
288
+ threadId?: string;
289
+ labelIds?: string[];
290
+ snippet?: string;
291
+ internalDate?: string;
292
+ payload?: object;
293
+ createdAt?: Date | string;
294
+ updatedAt?: Date | string;
295
+ }
296
+ ```
297
+
298
+ - **TargetJob**
299
+
300
+ ```ts
301
+ export interface TargetJob {
302
+ id?: string;
303
+ category: VacancyCategory;
304
+ position: string;
305
+ notes?: string;
306
+ }
307
+ ```
308
+
309
+ - **TargetLocation**
310
+
311
+ ```ts
312
+ export interface TargetLocation {
313
+ id?: string;
314
+ country: string;
315
+ cities: {
316
+ name: string;
317
+ areas: string[];
318
+ }[];
319
+ }
320
+ ```
321
+
322
+ - **TargetPreferences**
323
+
324
+ ```ts
325
+ export interface TargetPreferences {
326
+ id?: string;
327
+ clientId: string;
328
+ locations: TargetLocation[];
329
+ jobs: TargetJob[];
330
+ createdAt?: Date | string;
331
+ updatedAt?: Date | string;
332
+ }
333
+ ```
334
+
335
+ - **Vacancy**
336
+
337
+ ```ts
338
+ export interface Vacancy {
339
+ id?: string;
340
+ company: string;
341
+ position: string;
342
+ location: string;
343
+ description: string;
344
+ advertisingUrl: string;
345
+ applicationUrl: string;
346
+ applicationDomain: string;
347
+ advertisingDomain: string;
348
+ fullPageText: string;
349
+ jobId: string;
350
+ category: VacancyCategory;
351
+ suggestedTo?: string[];
352
+ createdAt?: Date | string;
353
+ updatedAt?: Date | string;
354
+ }
355
+ ```
356
+
357
+ - `VacancyCategory` includes: Accounting, IT, Healthcare, Sales, etc.
358
+
359
+ - **VacancySuggestion**
360
+ ```ts
361
+ export interface VacancySuggestion {
362
+ id?: string;
363
+ clientId: string;
364
+ vacancyId: string;
365
+ status: string;
366
+ createdAt?: Date | string;
367
+ }
368
+ ```
369
+
370
+ ---
371
+
372
+ ## 🗂️ Firestore Path Utilities
373
+
374
+ All Firestore collection/document path builders are centralized in `src/paths/firestorePaths.ts` as pure string helpers. **Every helper returns a Firestore path string, not a Firestore SDK reference.** This keeps the library SDK-free and fully portable for use in any environment (Node.js, browser, SSR, CLI, etc). No Firestore SDK is required or included.
375
+
376
+ ### Example Usage
67
377
 
68
378
  ```ts
69
- // types/Client.ts
70
- export interface Client {
71
- id?: string;
72
- name: string;
73
- email: string;
74
- status: "active" | "inactive";
75
- createdAt?: Date | string;
379
+ import { firestorePaths } from "@jobsearch-works/firestore-models/paths/firestorePaths";
380
+
381
+ const clientDoc = firestorePaths.clients.doc("clientId"); // "clients/clientId"
382
+ const appDoc = firestorePaths.clients.applications.doc(
383
+ "clientId",
384
+ "applicationId"
385
+ ); // "clients/clientId/applications/applicationId"
386
+ const vacancyDoc = firestorePaths.vacancies.doc("vacancyId"); // "vacancies/vacancyId"
387
+ ```
388
+
389
+ #### Fetching a Firestore Document and Including Its ID
390
+
391
+ ```ts
392
+ import { doc, getDoc } from "firebase/firestore";
393
+ import { firestore } from "../firebaseConfig";
394
+ import { firestorePaths } from "@jobsearch-works/firestore-models";
395
+
396
+ const ref = doc(firestore, firestorePaths.vacancies.doc("vac123"));
397
+ const snap = await getDoc(ref);
398
+ const vacancy = { id: snap.id, ...snap.data() };
399
+ ```
400
+
401
+ **Reusable withId Utility:**
402
+
403
+ ```ts
404
+ export function withId<T>(snap: DocumentSnapshot): T & { id: string } {
405
+ return { id: snap.id, ...snap.data() } as T & { id: string };
76
406
  }
77
407
  ```
78
408
 
409
+ #### Main Path Helpers
410
+
411
+ - `firestorePaths.clients.collection()` → "clients"
412
+ - `firestorePaths.clients.doc(clientId)` → "clients/{clientId}"
413
+ - `firestorePaths.clients.applications.collection(clientId)` → "clients/{clientId}/applications"
414
+ - `firestorePaths.clients.applications.doc(clientId, applicationId)` → "clients/{clientId}/applications/{applicationId}"
415
+ - `firestorePaths.clients.questions.collection(clientId)` → "clients/{clientId}/questions"
416
+ - `firestorePaths.clients.questions.doc(clientId, questionId)` → "clients/{clientId}/questions/{questionId}"
417
+ - `firestorePaths.clients.preferences.target(clientId)` → "clients/{clientId}/preferences/targetPreferences"
418
+ - `firestorePaths.clients.vacancySuggestions.collection(clientId)` → "clients/{clientId}/vacancySuggestions"
419
+ - `firestorePaths.clients.vacancySuggestions.doc(clientId, suggestionId)` → "clients/{clientId}/vacancySuggestions/{suggestionId}"
420
+ - `firestorePaths.users.collection()` → "users"
421
+ - `firestorePaths.users.doc(userId)` → "users/{userId}"
422
+ - `firestorePaths.vacancies.collection()` → "vacancies"
423
+ - `firestorePaths.vacancies.doc(vacancyId)` → "vacancies/{vacancyId}"
424
+ - `firestorePaths.agents.collection()` → "agents"
425
+ - `firestorePaths.agents.doc(agentId)` → "agents/{agentId}"
426
+ - `firestorePaths.clientData.collection()` → "clientData"
427
+ - `firestorePaths.clientData.doc(clientDataId)` → "clientData/{clientDataId}"
428
+ - `firestorePaths.clientLogins.collection(userId)` → "clientLogins/{userId}"
429
+ - `firestorePaths.clientLogins.doc(userId, domain)` → "clientLogins/{userId}/logins/{domain}"
430
+ - `firestorePaths.gmailMessages.collection(clientId)` → "clientEmails/{clientId}/messages"
431
+ - `firestorePaths.gmailMessages.doc(clientId, messageId)` → "clientEmails/{clientId}/messages/{messageId}"
432
+
433
+ ---
434
+
435
+ ## 🛡️ Notes
436
+
437
+ - All types and paths are SDK-independent and safe to use in any TypeScript/Node/React project.
438
+ - This package does not include any Firestore SDK or database logic—just models and helpers.
439
+ - For Firestore access, use your own service layer or SDK wrapper.
440
+ - This library follows semantic versioning and is safe for production use.
441
+
79
442
  ---
80
443
 
81
444
  ## 🔗 Path Builder Example
@@ -98,9 +461,3 @@ When adding a new model:
98
461
  2. Add its path builder in `src/paths/pathStrings.ts`
99
462
  3. Update the documentation if needed
100
463
  4. Maintain backward compatibility
101
-
102
- ---
103
-
104
- ## 📄 License
105
-
106
- MIT
package/dist/index.d.mts CHANGED
@@ -179,6 +179,7 @@ interface ApplicationQuestion {
179
179
  }
180
180
 
181
181
  interface VacancySuggestion {
182
+ id?: string;
182
183
  clientId: string;
183
184
  vacancyId: string;
184
185
  status: string;
@@ -212,6 +213,7 @@ interface GmailMessage {
212
213
  }
213
214
 
214
215
  interface TargetLocation {
216
+ id?: string;
215
217
  country: string;
216
218
  cities: {
217
219
  name: string;
@@ -220,13 +222,14 @@ interface TargetLocation {
220
222
  }
221
223
 
222
224
  interface TargetJob {
225
+ id?: string;
223
226
  category: VacancyCategory;
224
227
  position: string;
225
228
  notes?: string;
226
229
  }
227
230
 
228
231
  interface TargetPreferences {
229
- id: string;
232
+ id?: string;
230
233
  clientId: string;
231
234
  locations: TargetLocation[];
232
235
  jobs: TargetJob[];
@@ -234,30 +237,54 @@ interface TargetPreferences {
234
237
  updatedAt: Date;
235
238
  }
236
239
 
237
- declare const pathStrings: {
238
- readonly clients: () => string;
239
- readonly client: (clientId: string) => string;
240
- readonly applications: (clientId: string) => string;
241
- readonly application: (clientId: string, applicationId: string) => string;
242
- readonly users: () => string;
243
- readonly user: (userId: string) => string;
244
- readonly vacancies: () => string;
245
- readonly vacancy: (vacancyId: string) => string;
246
- readonly agents: () => string;
247
- readonly agent: (agentId: string) => string;
248
- readonly clientQuestions: (clientId: string) => string;
249
- readonly clientQuestion: (clientId: string, questionId: string) => string;
250
- readonly clientData: () => string;
251
- readonly clientDataItem: (clientDataId: string) => string;
252
- readonly clientLogins: (userId: string) => string;
253
- readonly clientLogin: (userId: string, domain: string) => string;
254
- readonly applicationQuestions: (clientId: string, applicationId: string) => string;
255
- readonly applicationQuestion: (clientId: string, applicationId: string, questionId: string) => string;
256
- readonly vacancySuggestions: (clientId: string) => string;
257
- readonly vacancySuggestion: (clientId: string, suggestionId: string) => string;
258
- readonly gmailMessages: (clientId: string) => string;
259
- readonly gmailMessage: (clientId: string, messageId: string) => string;
260
- readonly targetPreferences: (clientId: string) => string;
240
+ declare const firestorePaths: {
241
+ readonly clients: {
242
+ readonly collection: () => string;
243
+ readonly doc: (clientId: string) => string;
244
+ readonly applications: {
245
+ readonly collection: (clientId: string) => string;
246
+ readonly doc: (clientId: string, applicationId: string) => string;
247
+ readonly questions: {
248
+ readonly collection: (clientId: string, applicationId: string) => string;
249
+ readonly doc: (clientId: string, applicationId: string, questionId: string) => string;
250
+ };
251
+ };
252
+ readonly questions: {
253
+ readonly collection: (clientId: string) => string;
254
+ readonly doc: (clientId: string, questionId: string) => string;
255
+ };
256
+ readonly preferences: {
257
+ readonly target: (clientId: string) => string;
258
+ };
259
+ readonly vacancySuggestions: {
260
+ readonly collection: (clientId: string) => string;
261
+ readonly doc: (clientId: string, suggestionId: string) => string;
262
+ };
263
+ };
264
+ readonly users: {
265
+ readonly collection: () => string;
266
+ readonly doc: (userId: string) => string;
267
+ };
268
+ readonly vacancies: {
269
+ readonly collection: () => string;
270
+ readonly doc: (vacancyId: string) => string;
271
+ };
272
+ readonly agents: {
273
+ readonly collection: () => string;
274
+ readonly doc: (agentId: string) => string;
275
+ };
276
+ readonly clientData: {
277
+ readonly collection: () => string;
278
+ readonly doc: (clientDataId: string) => string;
279
+ };
280
+ readonly clientLogins: {
281
+ readonly collection: (userId: string) => string;
282
+ readonly doc: (userId: string, domain: string) => string;
283
+ };
284
+ readonly gmailMessages: {
285
+ readonly collection: (clientId: string) => string;
286
+ readonly doc: (clientId: string, messageId: string) => string;
287
+ };
261
288
  };
262
289
 
263
- export { Agent, Application, ApplicationQuestion, ApplicationQuestionType, ApplicationQuestionTypeOptions, ApplicationStatus, AuthUser, Client, ClientData, ClientLogin, ClientQuestion, ClientQuestionType, ClientQuestionTypeOptions, GmailMessage, TargetJob, TargetLocation, TargetPreferences, Vacancy, VacancyCategory, VacancySuggestion, pathStrings };
290
+ export { Agent, Application, ApplicationQuestion, ApplicationQuestionType, ApplicationQuestionTypeOptions, ApplicationStatus, AuthUser, Client, ClientData, ClientLogin, ClientQuestion, ClientQuestionType, ClientQuestionTypeOptions, GmailMessage, TargetJob, TargetLocation, TargetPreferences, Vacancy, VacancyCategory, VacancySuggestion, firestorePaths };
package/dist/index.d.ts CHANGED
@@ -179,6 +179,7 @@ interface ApplicationQuestion {
179
179
  }
180
180
 
181
181
  interface VacancySuggestion {
182
+ id?: string;
182
183
  clientId: string;
183
184
  vacancyId: string;
184
185
  status: string;
@@ -212,6 +213,7 @@ interface GmailMessage {
212
213
  }
213
214
 
214
215
  interface TargetLocation {
216
+ id?: string;
215
217
  country: string;
216
218
  cities: {
217
219
  name: string;
@@ -220,13 +222,14 @@ interface TargetLocation {
220
222
  }
221
223
 
222
224
  interface TargetJob {
225
+ id?: string;
223
226
  category: VacancyCategory;
224
227
  position: string;
225
228
  notes?: string;
226
229
  }
227
230
 
228
231
  interface TargetPreferences {
229
- id: string;
232
+ id?: string;
230
233
  clientId: string;
231
234
  locations: TargetLocation[];
232
235
  jobs: TargetJob[];
@@ -234,30 +237,54 @@ interface TargetPreferences {
234
237
  updatedAt: Date;
235
238
  }
236
239
 
237
- declare const pathStrings: {
238
- readonly clients: () => string;
239
- readonly client: (clientId: string) => string;
240
- readonly applications: (clientId: string) => string;
241
- readonly application: (clientId: string, applicationId: string) => string;
242
- readonly users: () => string;
243
- readonly user: (userId: string) => string;
244
- readonly vacancies: () => string;
245
- readonly vacancy: (vacancyId: string) => string;
246
- readonly agents: () => string;
247
- readonly agent: (agentId: string) => string;
248
- readonly clientQuestions: (clientId: string) => string;
249
- readonly clientQuestion: (clientId: string, questionId: string) => string;
250
- readonly clientData: () => string;
251
- readonly clientDataItem: (clientDataId: string) => string;
252
- readonly clientLogins: (userId: string) => string;
253
- readonly clientLogin: (userId: string, domain: string) => string;
254
- readonly applicationQuestions: (clientId: string, applicationId: string) => string;
255
- readonly applicationQuestion: (clientId: string, applicationId: string, questionId: string) => string;
256
- readonly vacancySuggestions: (clientId: string) => string;
257
- readonly vacancySuggestion: (clientId: string, suggestionId: string) => string;
258
- readonly gmailMessages: (clientId: string) => string;
259
- readonly gmailMessage: (clientId: string, messageId: string) => string;
260
- readonly targetPreferences: (clientId: string) => string;
240
+ declare const firestorePaths: {
241
+ readonly clients: {
242
+ readonly collection: () => string;
243
+ readonly doc: (clientId: string) => string;
244
+ readonly applications: {
245
+ readonly collection: (clientId: string) => string;
246
+ readonly doc: (clientId: string, applicationId: string) => string;
247
+ readonly questions: {
248
+ readonly collection: (clientId: string, applicationId: string) => string;
249
+ readonly doc: (clientId: string, applicationId: string, questionId: string) => string;
250
+ };
251
+ };
252
+ readonly questions: {
253
+ readonly collection: (clientId: string) => string;
254
+ readonly doc: (clientId: string, questionId: string) => string;
255
+ };
256
+ readonly preferences: {
257
+ readonly target: (clientId: string) => string;
258
+ };
259
+ readonly vacancySuggestions: {
260
+ readonly collection: (clientId: string) => string;
261
+ readonly doc: (clientId: string, suggestionId: string) => string;
262
+ };
263
+ };
264
+ readonly users: {
265
+ readonly collection: () => string;
266
+ readonly doc: (userId: string) => string;
267
+ };
268
+ readonly vacancies: {
269
+ readonly collection: () => string;
270
+ readonly doc: (vacancyId: string) => string;
271
+ };
272
+ readonly agents: {
273
+ readonly collection: () => string;
274
+ readonly doc: (agentId: string) => string;
275
+ };
276
+ readonly clientData: {
277
+ readonly collection: () => string;
278
+ readonly doc: (clientDataId: string) => string;
279
+ };
280
+ readonly clientLogins: {
281
+ readonly collection: (userId: string) => string;
282
+ readonly doc: (userId: string, domain: string) => string;
283
+ };
284
+ readonly gmailMessages: {
285
+ readonly collection: (clientId: string) => string;
286
+ readonly doc: (clientId: string, messageId: string) => string;
287
+ };
261
288
  };
262
289
 
263
- export { Agent, Application, ApplicationQuestion, ApplicationQuestionType, ApplicationQuestionTypeOptions, ApplicationStatus, AuthUser, Client, ClientData, ClientLogin, ClientQuestion, ClientQuestionType, ClientQuestionTypeOptions, GmailMessage, TargetJob, TargetLocation, TargetPreferences, Vacancy, VacancyCategory, VacancySuggestion, pathStrings };
290
+ export { Agent, Application, ApplicationQuestion, ApplicationQuestionType, ApplicationQuestionTypeOptions, ApplicationStatus, AuthUser, Client, ClientData, ClientLogin, ClientQuestion, ClientQuestionType, ClientQuestionTypeOptions, GmailMessage, TargetJob, TargetLocation, TargetPreferences, Vacancy, VacancyCategory, VacancySuggestion, firestorePaths };
package/dist/index.js CHANGED
@@ -24,7 +24,7 @@ __export(src_exports, {
24
24
  ApplicationStatus: () => ApplicationStatus,
25
25
  ClientQuestionTypeOptions: () => ClientQuestionTypeOptions,
26
26
  VacancyCategory: () => VacancyCategory,
27
- pathStrings: () => pathStrings
27
+ firestorePaths: () => firestorePaths
28
28
  });
29
29
  module.exports = __toCommonJS(src_exports);
30
30
 
@@ -84,42 +84,55 @@ var ClientQuestionTypeOptions = [
84
84
  // src/types/ApplicationQuestion.ts
85
85
  var ApplicationQuestionTypeOptions = ["text", "select"];
86
86
 
87
- // src/paths/pathStrings.ts
88
- var pathStrings = {
89
- clients: () => "clients",
90
- client: (clientId) => `clients/${clientId}`,
91
- // Application paths
92
- applications: (clientId) => `clients/${clientId}/applications`,
93
- application: (clientId, applicationId) => `clients/${clientId}/applications/${applicationId}`,
94
- // AuthUser paths
95
- users: () => "users",
96
- user: (userId) => `users/${userId}`,
97
- // Vacancy paths
98
- vacancies: () => "vacancies",
99
- vacancy: (vacancyId) => `vacancies/${vacancyId}`,
100
- // Agent paths
101
- agents: () => "agents",
102
- agent: (agentId) => `agents/${agentId}`,
103
- // ClientQuestion paths
104
- clientQuestions: (clientId) => `clients/${clientId}/questions`,
105
- clientQuestion: (clientId, questionId) => `clients/${clientId}/questions/${questionId}`,
106
- // ClientData paths
107
- clientData: () => "clientData",
108
- clientDataItem: (clientDataId) => `clientData/${clientDataId}`,
109
- // ClientLogin paths
110
- clientLogins: (userId) => `clientLogins/${userId}`,
111
- clientLogin: (userId, domain) => `clientLogins/${userId}/logins/${domain}`,
112
- // ApplicationQuestion paths
113
- applicationQuestions: (clientId, applicationId) => `clients/${clientId}/applications/${applicationId}/questions`,
114
- applicationQuestion: (clientId, applicationId, questionId) => `clients/${clientId}/applications/${applicationId}/questions/${questionId}`,
115
- // VacancySuggestion paths
116
- vacancySuggestions: (clientId) => `clients/${clientId}/vacancySuggestions`,
117
- vacancySuggestion: (clientId, suggestionId) => `clients/${clientId}/vacancySuggestions/${suggestionId}`,
118
- // GmailMessage paths
119
- gmailMessages: (clientId) => `clientEmails/${clientId}/messages`,
120
- gmailMessage: (clientId, messageId) => `clientEmails/${clientId}/messages/${messageId}`,
121
- // TargetPreferences paths
122
- targetPreferences: (clientId) => `clients/${clientId}/preferences/targetPreferences`
87
+ // src/paths/firestorePaths.ts
88
+ var firestorePaths = {
89
+ clients: {
90
+ collection: () => "clients",
91
+ doc: (clientId) => `clients/${clientId}`,
92
+ applications: {
93
+ collection: (clientId) => `clients/${clientId}/applications`,
94
+ doc: (clientId, applicationId) => `clients/${clientId}/applications/${applicationId}`,
95
+ questions: {
96
+ collection: (clientId, applicationId) => `clients/${clientId}/applications/${applicationId}/questions`,
97
+ doc: (clientId, applicationId, questionId) => `clients/${clientId}/applications/${applicationId}/questions/${questionId}`
98
+ }
99
+ },
100
+ questions: {
101
+ collection: (clientId) => `clients/${clientId}/questions`,
102
+ doc: (clientId, questionId) => `clients/${clientId}/questions/${questionId}`
103
+ },
104
+ preferences: {
105
+ target: (clientId) => `clients/${clientId}/preferences/targetPreferences`
106
+ },
107
+ vacancySuggestions: {
108
+ collection: (clientId) => `clients/${clientId}/vacancySuggestions`,
109
+ doc: (clientId, suggestionId) => `clients/${clientId}/vacancySuggestions/${suggestionId}`
110
+ }
111
+ },
112
+ users: {
113
+ collection: () => "users",
114
+ doc: (userId) => `users/${userId}`
115
+ },
116
+ vacancies: {
117
+ collection: () => "vacancies",
118
+ doc: (vacancyId) => `vacancies/${vacancyId}`
119
+ },
120
+ agents: {
121
+ collection: () => "agents",
122
+ doc: (agentId) => `agents/${agentId}`
123
+ },
124
+ clientData: {
125
+ collection: () => "clientData",
126
+ doc: (clientDataId) => `clientData/${clientDataId}`
127
+ },
128
+ clientLogins: {
129
+ collection: (userId) => `clientLogins/${userId}`,
130
+ doc: (userId, domain) => `clientLogins/${userId}/logins/${domain}`
131
+ },
132
+ gmailMessages: {
133
+ collection: (clientId) => `clientEmails/${clientId}/messages`,
134
+ doc: (clientId, messageId) => `clientEmails/${clientId}/messages/${messageId}`
135
+ }
123
136
  };
124
137
  // Annotate the CommonJS export names for ESM import in node:
125
138
  0 && (module.exports = {
@@ -127,5 +140,5 @@ var pathStrings = {
127
140
  ApplicationStatus,
128
141
  ClientQuestionTypeOptions,
129
142
  VacancyCategory,
130
- pathStrings
143
+ firestorePaths
131
144
  });
package/dist/index.mjs CHANGED
@@ -54,47 +54,60 @@ var ClientQuestionTypeOptions = [
54
54
  // src/types/ApplicationQuestion.ts
55
55
  var ApplicationQuestionTypeOptions = ["text", "select"];
56
56
 
57
- // src/paths/pathStrings.ts
58
- var pathStrings = {
59
- clients: () => "clients",
60
- client: (clientId) => `clients/${clientId}`,
61
- // Application paths
62
- applications: (clientId) => `clients/${clientId}/applications`,
63
- application: (clientId, applicationId) => `clients/${clientId}/applications/${applicationId}`,
64
- // AuthUser paths
65
- users: () => "users",
66
- user: (userId) => `users/${userId}`,
67
- // Vacancy paths
68
- vacancies: () => "vacancies",
69
- vacancy: (vacancyId) => `vacancies/${vacancyId}`,
70
- // Agent paths
71
- agents: () => "agents",
72
- agent: (agentId) => `agents/${agentId}`,
73
- // ClientQuestion paths
74
- clientQuestions: (clientId) => `clients/${clientId}/questions`,
75
- clientQuestion: (clientId, questionId) => `clients/${clientId}/questions/${questionId}`,
76
- // ClientData paths
77
- clientData: () => "clientData",
78
- clientDataItem: (clientDataId) => `clientData/${clientDataId}`,
79
- // ClientLogin paths
80
- clientLogins: (userId) => `clientLogins/${userId}`,
81
- clientLogin: (userId, domain) => `clientLogins/${userId}/logins/${domain}`,
82
- // ApplicationQuestion paths
83
- applicationQuestions: (clientId, applicationId) => `clients/${clientId}/applications/${applicationId}/questions`,
84
- applicationQuestion: (clientId, applicationId, questionId) => `clients/${clientId}/applications/${applicationId}/questions/${questionId}`,
85
- // VacancySuggestion paths
86
- vacancySuggestions: (clientId) => `clients/${clientId}/vacancySuggestions`,
87
- vacancySuggestion: (clientId, suggestionId) => `clients/${clientId}/vacancySuggestions/${suggestionId}`,
88
- // GmailMessage paths
89
- gmailMessages: (clientId) => `clientEmails/${clientId}/messages`,
90
- gmailMessage: (clientId, messageId) => `clientEmails/${clientId}/messages/${messageId}`,
91
- // TargetPreferences paths
92
- targetPreferences: (clientId) => `clients/${clientId}/preferences/targetPreferences`
57
+ // src/paths/firestorePaths.ts
58
+ var firestorePaths = {
59
+ clients: {
60
+ collection: () => "clients",
61
+ doc: (clientId) => `clients/${clientId}`,
62
+ applications: {
63
+ collection: (clientId) => `clients/${clientId}/applications`,
64
+ doc: (clientId, applicationId) => `clients/${clientId}/applications/${applicationId}`,
65
+ questions: {
66
+ collection: (clientId, applicationId) => `clients/${clientId}/applications/${applicationId}/questions`,
67
+ doc: (clientId, applicationId, questionId) => `clients/${clientId}/applications/${applicationId}/questions/${questionId}`
68
+ }
69
+ },
70
+ questions: {
71
+ collection: (clientId) => `clients/${clientId}/questions`,
72
+ doc: (clientId, questionId) => `clients/${clientId}/questions/${questionId}`
73
+ },
74
+ preferences: {
75
+ target: (clientId) => `clients/${clientId}/preferences/targetPreferences`
76
+ },
77
+ vacancySuggestions: {
78
+ collection: (clientId) => `clients/${clientId}/vacancySuggestions`,
79
+ doc: (clientId, suggestionId) => `clients/${clientId}/vacancySuggestions/${suggestionId}`
80
+ }
81
+ },
82
+ users: {
83
+ collection: () => "users",
84
+ doc: (userId) => `users/${userId}`
85
+ },
86
+ vacancies: {
87
+ collection: () => "vacancies",
88
+ doc: (vacancyId) => `vacancies/${vacancyId}`
89
+ },
90
+ agents: {
91
+ collection: () => "agents",
92
+ doc: (agentId) => `agents/${agentId}`
93
+ },
94
+ clientData: {
95
+ collection: () => "clientData",
96
+ doc: (clientDataId) => `clientData/${clientDataId}`
97
+ },
98
+ clientLogins: {
99
+ collection: (userId) => `clientLogins/${userId}`,
100
+ doc: (userId, domain) => `clientLogins/${userId}/logins/${domain}`
101
+ },
102
+ gmailMessages: {
103
+ collection: (clientId) => `clientEmails/${clientId}/messages`,
104
+ doc: (clientId, messageId) => `clientEmails/${clientId}/messages/${messageId}`
105
+ }
93
106
  };
94
107
  export {
95
108
  ApplicationQuestionTypeOptions,
96
109
  ApplicationStatus,
97
110
  ClientQuestionTypeOptions,
98
111
  VacancyCategory,
99
- pathStrings
112
+ firestorePaths
100
113
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jobsearch-works/firestore-models",
3
- "version": "1.1.8",
3
+ "version": "1.1.9",
4
4
  "description": "A shared library for standardizing Firestore document schemas and paths across multiple projects",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",