@jobsearch-works/firestore-models 1.1.9 → 1.1.10
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 +35 -0
- package/dist/index.d.mts +30 -14
- package/dist/index.d.ts +30 -14
- package/dist/index.js +5 -1
- package/dist/index.mjs +5 -1
- package/package.json +1 -1
package/README.md
CHANGED
@@ -37,6 +37,17 @@ This package acts as a single source of truth for Firestore schema and paths, en
|
|
37
37
|
- Consistent Firestore path generation (no hardcoded strings)
|
38
38
|
- Cross-environment compatibility (e.g., CLI, testing, rules)
|
39
39
|
|
40
|
+
This package provides no Firestore SDK bindings. Firestore `DocumentReference`s and `CollectionReference`s are constructed in your application using these path strings, typically in a `firestoreRefs.ts` file like:
|
41
|
+
|
42
|
+
```ts
|
43
|
+
import { doc, collection } from "firebase/firestore";
|
44
|
+
import { firestore } from "./firebaseConfig";
|
45
|
+
import { firestorePaths } from "@jobsearch-works/firestore-models";
|
46
|
+
|
47
|
+
export const userRef = (userId: string) =>
|
48
|
+
doc(firestore, firestorePaths.users.doc(userId));
|
49
|
+
```
|
50
|
+
|
40
51
|
---
|
41
52
|
|
42
53
|
## 🧱 Project Structure
|
@@ -98,6 +109,7 @@ ClientLogin
|
|
98
109
|
| ClientData | Root collection | Standalone entity |
|
99
110
|
| ClientLogin | clientLogins/{userId}/logins/{domain} | References `userId` |
|
100
111
|
| GmailMessage | clientEmails/{clientId}/messages/{messageId} | References `clientId` |
|
112
|
+
| ResumeLink | clients/{clientId}/resumeLinks/{linkId} | References `clientId`, stores PDF resume URLs |
|
101
113
|
|
102
114
|
**Notes:**
|
103
115
|
|
@@ -110,6 +122,8 @@ ClientLogin
|
|
110
122
|
|
111
123
|
## ✅ Usage
|
112
124
|
|
125
|
+
This library is intentionally SDK-free. All Firebase logic — including `Timestamp`, `doc()`, and `onSnapshot()` — is handled in your app’s service layer. This ensures portability across React apps, Firebase functions, and testing environments.
|
126
|
+
|
113
127
|
### Importing Models and Paths
|
114
128
|
|
115
129
|
```ts
|
@@ -279,6 +293,27 @@ All Firestore document schemas are defined as TypeScript interfaces in `src/type
|
|
279
293
|
}
|
280
294
|
```
|
281
295
|
|
296
|
+
- **GmailMessage**
|
297
|
+
|
298
|
+
```ts
|
299
|
+
export interface GmailMessage {
|
300
|
+
id?: string;
|
301
|
+
```
|
302
|
+
|
303
|
+
- **ResumeLink**
|
304
|
+
|
305
|
+
```ts
|
306
|
+
export interface ResumeLink {
|
307
|
+
id: string;
|
308
|
+
title: string;
|
309
|
+
url: string;
|
310
|
+
description: string;
|
311
|
+
createdAt: any; // Timestamp from firebase/firestore
|
312
|
+
createdBy: string;
|
313
|
+
clientId: string;
|
314
|
+
}
|
315
|
+
```
|
316
|
+
|
282
317
|
- **GmailMessage**
|
283
318
|
|
284
319
|
```ts
|
package/dist/index.d.mts
CHANGED
@@ -1,10 +1,11 @@
|
|
1
|
+
type ClientStatus = "active" | "inactive";
|
1
2
|
interface Client {
|
2
|
-
id?: string;
|
3
|
-
name: string;
|
4
|
-
email: string;
|
5
|
-
status:
|
6
|
-
resume?: string;
|
7
|
-
createdAt?: Date | string;
|
3
|
+
readonly id?: string;
|
4
|
+
readonly name: string;
|
5
|
+
readonly email: string;
|
6
|
+
readonly status: ClientStatus;
|
7
|
+
readonly resume?: string;
|
8
|
+
readonly createdAt?: Date | string;
|
8
9
|
}
|
9
10
|
|
10
11
|
declare const ApplicationStatus: {
|
@@ -111,14 +112,15 @@ interface Vacancy {
|
|
111
112
|
updatedAt?: Date | string;
|
112
113
|
}
|
113
114
|
|
115
|
+
type AgentStatus = "active" | "inactive";
|
114
116
|
interface Agent {
|
115
|
-
id?: string;
|
116
|
-
name: string;
|
117
|
-
email: string;
|
118
|
-
status:
|
119
|
-
profilePicture?: string;
|
120
|
-
createdAt?: Date | string;
|
121
|
-
updatedAt?: Date | string;
|
117
|
+
readonly id?: string;
|
118
|
+
readonly name: string;
|
119
|
+
readonly email: string;
|
120
|
+
readonly status: AgentStatus;
|
121
|
+
readonly profilePicture?: string;
|
122
|
+
readonly createdAt?: Date | string;
|
123
|
+
readonly updatedAt?: Date | string;
|
122
124
|
}
|
123
125
|
|
124
126
|
type ClientQuestionType = "text" | "select";
|
@@ -237,6 +239,16 @@ interface TargetPreferences {
|
|
237
239
|
updatedAt: Date;
|
238
240
|
}
|
239
241
|
|
242
|
+
interface ResumeLink {
|
243
|
+
id?: string;
|
244
|
+
title: string;
|
245
|
+
url: string;
|
246
|
+
description: string;
|
247
|
+
createdAt?: Date | string;
|
248
|
+
createdBy: string;
|
249
|
+
clientId: string;
|
250
|
+
}
|
251
|
+
|
240
252
|
declare const firestorePaths: {
|
241
253
|
readonly clients: {
|
242
254
|
readonly collection: () => string;
|
@@ -285,6 +297,10 @@ declare const firestorePaths: {
|
|
285
297
|
readonly collection: (clientId: string) => string;
|
286
298
|
readonly doc: (clientId: string, messageId: string) => string;
|
287
299
|
};
|
300
|
+
readonly resumeLinks: {
|
301
|
+
readonly collection: (clientId: string) => string;
|
302
|
+
readonly doc: (clientId: string, resumeLinkId: string) => string;
|
303
|
+
};
|
288
304
|
};
|
289
305
|
|
290
|
-
export { Agent, Application, ApplicationQuestion, ApplicationQuestionType, ApplicationQuestionTypeOptions, ApplicationStatus, AuthUser, Client, ClientData, ClientLogin, ClientQuestion, ClientQuestionType, ClientQuestionTypeOptions, GmailMessage, TargetJob, TargetLocation, TargetPreferences, Vacancy, VacancyCategory, VacancySuggestion, firestorePaths };
|
306
|
+
export { Agent, AgentStatus, Application, ApplicationQuestion, ApplicationQuestionType, ApplicationQuestionTypeOptions, ApplicationStatus, AuthUser, Client, ClientData, ClientLogin, ClientQuestion, ClientQuestionType, ClientQuestionTypeOptions, ClientStatus, GmailMessage, ResumeLink, TargetJob, TargetLocation, TargetPreferences, Vacancy, VacancyCategory, VacancySuggestion, firestorePaths };
|
package/dist/index.d.ts
CHANGED
@@ -1,10 +1,11 @@
|
|
1
|
+
type ClientStatus = "active" | "inactive";
|
1
2
|
interface Client {
|
2
|
-
id?: string;
|
3
|
-
name: string;
|
4
|
-
email: string;
|
5
|
-
status:
|
6
|
-
resume?: string;
|
7
|
-
createdAt?: Date | string;
|
3
|
+
readonly id?: string;
|
4
|
+
readonly name: string;
|
5
|
+
readonly email: string;
|
6
|
+
readonly status: ClientStatus;
|
7
|
+
readonly resume?: string;
|
8
|
+
readonly createdAt?: Date | string;
|
8
9
|
}
|
9
10
|
|
10
11
|
declare const ApplicationStatus: {
|
@@ -111,14 +112,15 @@ interface Vacancy {
|
|
111
112
|
updatedAt?: Date | string;
|
112
113
|
}
|
113
114
|
|
115
|
+
type AgentStatus = "active" | "inactive";
|
114
116
|
interface Agent {
|
115
|
-
id?: string;
|
116
|
-
name: string;
|
117
|
-
email: string;
|
118
|
-
status:
|
119
|
-
profilePicture?: string;
|
120
|
-
createdAt?: Date | string;
|
121
|
-
updatedAt?: Date | string;
|
117
|
+
readonly id?: string;
|
118
|
+
readonly name: string;
|
119
|
+
readonly email: string;
|
120
|
+
readonly status: AgentStatus;
|
121
|
+
readonly profilePicture?: string;
|
122
|
+
readonly createdAt?: Date | string;
|
123
|
+
readonly updatedAt?: Date | string;
|
122
124
|
}
|
123
125
|
|
124
126
|
type ClientQuestionType = "text" | "select";
|
@@ -237,6 +239,16 @@ interface TargetPreferences {
|
|
237
239
|
updatedAt: Date;
|
238
240
|
}
|
239
241
|
|
242
|
+
interface ResumeLink {
|
243
|
+
id?: string;
|
244
|
+
title: string;
|
245
|
+
url: string;
|
246
|
+
description: string;
|
247
|
+
createdAt?: Date | string;
|
248
|
+
createdBy: string;
|
249
|
+
clientId: string;
|
250
|
+
}
|
251
|
+
|
240
252
|
declare const firestorePaths: {
|
241
253
|
readonly clients: {
|
242
254
|
readonly collection: () => string;
|
@@ -285,6 +297,10 @@ declare const firestorePaths: {
|
|
285
297
|
readonly collection: (clientId: string) => string;
|
286
298
|
readonly doc: (clientId: string, messageId: string) => string;
|
287
299
|
};
|
300
|
+
readonly resumeLinks: {
|
301
|
+
readonly collection: (clientId: string) => string;
|
302
|
+
readonly doc: (clientId: string, resumeLinkId: string) => string;
|
303
|
+
};
|
288
304
|
};
|
289
305
|
|
290
|
-
export { Agent, Application, ApplicationQuestion, ApplicationQuestionType, ApplicationQuestionTypeOptions, ApplicationStatus, AuthUser, Client, ClientData, ClientLogin, ClientQuestion, ClientQuestionType, ClientQuestionTypeOptions, GmailMessage, TargetJob, TargetLocation, TargetPreferences, Vacancy, VacancyCategory, VacancySuggestion, firestorePaths };
|
306
|
+
export { Agent, AgentStatus, Application, ApplicationQuestion, ApplicationQuestionType, ApplicationQuestionTypeOptions, ApplicationStatus, AuthUser, Client, ClientData, ClientLogin, ClientQuestion, ClientQuestionType, ClientQuestionTypeOptions, ClientStatus, GmailMessage, ResumeLink, TargetJob, TargetLocation, TargetPreferences, Vacancy, VacancyCategory, VacancySuggestion, firestorePaths };
|
package/dist/index.js
CHANGED
@@ -126,12 +126,16 @@ var firestorePaths = {
|
|
126
126
|
doc: (clientDataId) => `clientData/${clientDataId}`
|
127
127
|
},
|
128
128
|
clientLogins: {
|
129
|
-
collection: (userId) => `clientLogins/${userId}`,
|
129
|
+
collection: (userId) => `clientLogins/${userId}/logins`,
|
130
130
|
doc: (userId, domain) => `clientLogins/${userId}/logins/${domain}`
|
131
131
|
},
|
132
132
|
gmailMessages: {
|
133
133
|
collection: (clientId) => `clientEmails/${clientId}/messages`,
|
134
134
|
doc: (clientId, messageId) => `clientEmails/${clientId}/messages/${messageId}`
|
135
|
+
},
|
136
|
+
resumeLinks: {
|
137
|
+
collection: (clientId) => `clients/${clientId}/resumeLinks`,
|
138
|
+
doc: (clientId, resumeLinkId) => `clients/${clientId}/resumeLinks/${resumeLinkId}`
|
135
139
|
}
|
136
140
|
};
|
137
141
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/index.mjs
CHANGED
@@ -96,12 +96,16 @@ var firestorePaths = {
|
|
96
96
|
doc: (clientDataId) => `clientData/${clientDataId}`
|
97
97
|
},
|
98
98
|
clientLogins: {
|
99
|
-
collection: (userId) => `clientLogins/${userId}`,
|
99
|
+
collection: (userId) => `clientLogins/${userId}/logins`,
|
100
100
|
doc: (userId, domain) => `clientLogins/${userId}/logins/${domain}`
|
101
101
|
},
|
102
102
|
gmailMessages: {
|
103
103
|
collection: (clientId) => `clientEmails/${clientId}/messages`,
|
104
104
|
doc: (clientId, messageId) => `clientEmails/${clientId}/messages/${messageId}`
|
105
|
+
},
|
106
|
+
resumeLinks: {
|
107
|
+
collection: (clientId) => `clients/${clientId}/resumeLinks`,
|
108
|
+
doc: (clientId, resumeLinkId) => `clients/${clientId}/resumeLinks/${resumeLinkId}`
|
105
109
|
}
|
106
110
|
};
|
107
111
|
export {
|
package/package.json
CHANGED