@jobsearch-works/firestore-models 1.0.14 → 1.0.15
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 +17 -4
- package/dist/index.d.mts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.js +5 -4
- package/dist/index.mjs +5 -4
- package/package.json +1 -1
package/README.md
CHANGED
@@ -272,19 +272,32 @@ namespace VacancySuggestion {
|
|
272
272
|
}
|
273
273
|
```
|
274
274
|
|
275
|
+
## Services
|
276
|
+
|
277
|
+
For data access, use the provided services instead of directly accessing Firestore. Services provide a consistent interface for data operations and handle error cases.
|
278
|
+
|
279
|
+
### ClientDataService
|
280
|
+
|
281
|
+
```typescript
|
282
|
+
import { ClientDataService } from "@jobsearch-works/services";
|
283
|
+
|
284
|
+
// Get client data
|
285
|
+
const clientData = await ClientDataService.getData(userId);
|
286
|
+
```
|
287
|
+
|
275
288
|
## Usage
|
276
289
|
|
277
|
-
Import the models and
|
290
|
+
Import the models and services in your application:
|
278
291
|
|
279
292
|
```typescript
|
280
293
|
import { Client } from "@jsw/firestore-models";
|
294
|
+
import { ClientDataService } from "@jobsearch-works/services";
|
281
295
|
|
282
296
|
// Create a new client
|
283
297
|
const newClient = Client.createNew("John Doe", "john@example.com");
|
284
298
|
|
285
|
-
// Use
|
286
|
-
const
|
287
|
-
const clientCollectionPath = Client.collection(); // returns 'clients'
|
299
|
+
// Use services for data access
|
300
|
+
const clientData = await ClientDataService.getData("123");
|
288
301
|
|
289
302
|
// Use the utility functions
|
290
303
|
const formattedClient = Client.formatClient(newClient);
|
package/dist/index.d.mts
CHANGED
@@ -99,8 +99,8 @@ declare namespace ClientData {
|
|
99
99
|
interface Model extends BaseModel {
|
100
100
|
firstName: string;
|
101
101
|
lastName: string;
|
102
|
-
middleName
|
103
|
-
preferredName
|
102
|
+
middleName?: string;
|
103
|
+
preferredName?: string;
|
104
104
|
email: string;
|
105
105
|
phone: string;
|
106
106
|
address: string;
|
@@ -111,11 +111,13 @@ declare namespace ClientData {
|
|
111
111
|
country: string;
|
112
112
|
linkedIn?: string;
|
113
113
|
countryPhoneCode: string;
|
114
|
+
nationality: string;
|
115
|
+
dateOfBirth?: Date | string;
|
114
116
|
}
|
115
117
|
const collection: () => string;
|
116
118
|
const document: (clientDataId: string) => string;
|
117
119
|
const formatClientData: (clientData: ClientData.Model) => string;
|
118
|
-
const createNew: (firstName: string, lastName: string, email: string, phone: string, address: string, city: string, state: string, zip: string, country: string, countryPhoneCode: string, suburb: string) => ClientData.Model;
|
120
|
+
const createNew: (firstName: string, lastName: string, email: string, phone: string, address: string, city: string, state: string, zip: string, country: string, countryPhoneCode: string, suburb: string, nationality: string, dateOfBirth?: Date | string, middleName?: string, preferredName?: string) => ClientData.Model;
|
119
121
|
}
|
120
122
|
|
121
123
|
declare namespace ClientLogin {
|
package/dist/index.d.ts
CHANGED
@@ -99,8 +99,8 @@ declare namespace ClientData {
|
|
99
99
|
interface Model extends BaseModel {
|
100
100
|
firstName: string;
|
101
101
|
lastName: string;
|
102
|
-
middleName
|
103
|
-
preferredName
|
102
|
+
middleName?: string;
|
103
|
+
preferredName?: string;
|
104
104
|
email: string;
|
105
105
|
phone: string;
|
106
106
|
address: string;
|
@@ -111,11 +111,13 @@ declare namespace ClientData {
|
|
111
111
|
country: string;
|
112
112
|
linkedIn?: string;
|
113
113
|
countryPhoneCode: string;
|
114
|
+
nationality: string;
|
115
|
+
dateOfBirth?: Date | string;
|
114
116
|
}
|
115
117
|
const collection: () => string;
|
116
118
|
const document: (clientDataId: string) => string;
|
117
119
|
const formatClientData: (clientData: ClientData.Model) => string;
|
118
|
-
const createNew: (firstName: string, lastName: string, email: string, phone: string, address: string, city: string, state: string, zip: string, country: string, countryPhoneCode: string, suburb: string) => ClientData.Model;
|
120
|
+
const createNew: (firstName: string, lastName: string, email: string, phone: string, address: string, city: string, state: string, zip: string, country: string, countryPhoneCode: string, suburb: string, nationality: string, dateOfBirth?: Date | string, middleName?: string, preferredName?: string) => ClientData.Model;
|
119
121
|
}
|
120
122
|
|
121
123
|
declare namespace ClientLogin {
|
package/dist/index.js
CHANGED
@@ -180,12 +180,12 @@ var ClientData;
|
|
180
180
|
ClientData2.formatClientData = (clientData) => {
|
181
181
|
return `${clientData.firstName} ${clientData.lastName} (${clientData.email})`;
|
182
182
|
};
|
183
|
-
ClientData2.createNew = (firstName, lastName, email, phone, address, city, state, zip, country, countryPhoneCode, suburb) => {
|
183
|
+
ClientData2.createNew = (firstName, lastName, email, phone, address, city, state, zip, country, countryPhoneCode, suburb, nationality, dateOfBirth, middleName, preferredName) => {
|
184
184
|
return {
|
185
185
|
firstName,
|
186
186
|
lastName,
|
187
|
-
middleName
|
188
|
-
preferredName
|
187
|
+
middleName,
|
188
|
+
preferredName,
|
189
189
|
email,
|
190
190
|
phone,
|
191
191
|
address,
|
@@ -195,7 +195,8 @@ var ClientData;
|
|
195
195
|
zip,
|
196
196
|
country,
|
197
197
|
countryPhoneCode,
|
198
|
-
|
198
|
+
nationality,
|
199
|
+
dateOfBirth
|
199
200
|
};
|
200
201
|
};
|
201
202
|
})(ClientData || (ClientData = {}));
|
package/dist/index.mjs
CHANGED
@@ -146,12 +146,12 @@ var ClientData;
|
|
146
146
|
ClientData2.formatClientData = (clientData) => {
|
147
147
|
return `${clientData.firstName} ${clientData.lastName} (${clientData.email})`;
|
148
148
|
};
|
149
|
-
ClientData2.createNew = (firstName, lastName, email, phone, address, city, state, zip, country, countryPhoneCode, suburb) => {
|
149
|
+
ClientData2.createNew = (firstName, lastName, email, phone, address, city, state, zip, country, countryPhoneCode, suburb, nationality, dateOfBirth, middleName, preferredName) => {
|
150
150
|
return {
|
151
151
|
firstName,
|
152
152
|
lastName,
|
153
|
-
middleName
|
154
|
-
preferredName
|
153
|
+
middleName,
|
154
|
+
preferredName,
|
155
155
|
email,
|
156
156
|
phone,
|
157
157
|
address,
|
@@ -161,7 +161,8 @@ var ClientData;
|
|
161
161
|
zip,
|
162
162
|
country,
|
163
163
|
countryPhoneCode,
|
164
|
-
|
164
|
+
nationality,
|
165
|
+
dateOfBirth
|
165
166
|
};
|
166
167
|
};
|
167
168
|
})(ClientData || (ClientData = {}));
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@jobsearch-works/firestore-models",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.15",
|
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",
|