@jobsearch-works/firestore-models 1.0.7 → 1.0.8

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/dist/index.js CHANGED
@@ -1,13 +1,308 @@
1
- // Re-export base model
2
- export * from "./BaseModel";
3
- // Re-export all models
4
- import * as Application from "./models/Application";
5
- import * as AuthUser from "./models/AuthUser";
6
- import * as Client from "./models/Client";
7
- import * as ClientData from "./models/ClientData";
8
- import * as ClientLogin from "./models/ClientLogin";
9
- import * as Question from "./models/Question";
10
- import * as UserQuestion from "./models/UserQuestion";
11
- import * as Vacancy from "./models/Vacancy";
12
- import * as VacancySuggestion from "./models/VacancySuggestion";
13
- export { Application, AuthUser, Client, ClientData, ClientLogin, Question, UserQuestion, Vacancy, VacancySuggestion, };
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var src_exports = {};
22
+ __export(src_exports, {
23
+ Application: () => Application_exports,
24
+ AuthUser: () => AuthUser_exports,
25
+ Client: () => Client_exports,
26
+ ClientData: () => ClientData_exports,
27
+ ClientLogin: () => ClientLogin_exports,
28
+ Question: () => Question_exports,
29
+ UserQuestion: () => UserQuestion_exports,
30
+ Vacancy: () => Vacancy_exports,
31
+ VacancySuggestion: () => VacancySuggestion_exports
32
+ });
33
+ module.exports = __toCommonJS(src_exports);
34
+
35
+ // src/models2/Application.ts
36
+ var Application_exports = {};
37
+ __export(Application_exports, {
38
+ Application: () => Application
39
+ });
40
+ var Application;
41
+ ((Application2) => {
42
+ Application2.collection = (clientId) => `clients/${clientId}/applications`;
43
+ Application2.document = (clientId, applicationId) => `clients/${clientId}/applications/${applicationId}`;
44
+ Application2.formatSummary = (application) => {
45
+ return `${application.position} at ${application.company} (${application.status})`;
46
+ };
47
+ Application2.formatDate = (date) => {
48
+ const dateObj = date instanceof Date ? date : new Date(date);
49
+ return dateObj.toLocaleDateString();
50
+ };
51
+ Application2.createNew = (clientId, vacancyId, vacancyData = {}) => {
52
+ return {
53
+ clientId,
54
+ vacancyId,
55
+ status: "new",
56
+ company: vacancyData.company,
57
+ position: vacancyData.position,
58
+ location: vacancyData.location,
59
+ jobId: vacancyData.jobId,
60
+ advertisingUrl: vacancyData.advertisingUrl,
61
+ applicationUrl: vacancyData.applicationUrl,
62
+ applicationDomain: vacancyData.applicationDomain,
63
+ advertisingDomain: vacancyData.advertisingDomain,
64
+ description: vacancyData.description,
65
+ fullPageText: vacancyData.fullPageText,
66
+ createdAt: (/* @__PURE__ */ new Date()).toISOString()
67
+ };
68
+ };
69
+ Application2.updateStatus = (application, newStatus) => {
70
+ return {
71
+ ...application,
72
+ status: newStatus,
73
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
74
+ };
75
+ };
76
+ })(Application || (Application = {}));
77
+
78
+ // src/models2/AuthUser.ts
79
+ var AuthUser_exports = {};
80
+ __export(AuthUser_exports, {
81
+ AuthUserCollectionPath: () => AuthUserCollectionPath,
82
+ AuthUserUtils: () => AuthUserUtils,
83
+ getAuthUserDocumentPath: () => getAuthUserDocumentPath
84
+ });
85
+ var AuthUserCollectionPath = "users";
86
+ var getAuthUserDocumentPath = (userId) => `users/${userId}`;
87
+ var AuthUserUtils = {
88
+ // Get timestamp fields for AuthUser
89
+ getTimestampFields: () => [],
90
+ // Check if value is a Firestore timestamp
91
+ isFirestoreTimestamp: (value) => {
92
+ return typeof value === "object" && value !== null && ("seconds" in value || "_firestore_timestamp" in value);
93
+ },
94
+ // Create from Firebase user object
95
+ fromFirebaseUser: (user) => {
96
+ return {
97
+ id: user.uid,
98
+ email: user.email,
99
+ displayName: user.displayName,
100
+ photoURL: user.photoURL,
101
+ emailVerified: user.emailVerified,
102
+ lastSignIn: (/* @__PURE__ */ new Date()).toISOString(),
103
+ // Current timestamp for new logins
104
+ createdAt: (/* @__PURE__ */ new Date()).toISOString()
105
+ };
106
+ },
107
+ // Convert dates to display format
108
+ formatDates: (user) => {
109
+ const formatDate = (dateValue) => {
110
+ if (!dateValue)
111
+ return "N/A";
112
+ const date = typeof dateValue === "string" ? new Date(dateValue) : dateValue;
113
+ return date.toLocaleString();
114
+ };
115
+ return {
116
+ lastSignIn: formatDate(user.lastSignIn),
117
+ createdAt: formatDate(user.createdAt),
118
+ updatedAt: user.updatedAt ? formatDate(user.updatedAt) : void 0
119
+ };
120
+ },
121
+ // Convert AuthUser to format for storage
122
+ toFirestore: (user) => {
123
+ const { id, ...data } = user;
124
+ if (data.lastSignIn && data.lastSignIn instanceof Date) {
125
+ data.lastSignIn = data.lastSignIn.toISOString();
126
+ }
127
+ if (data.createdAt && data.createdAt instanceof Date) {
128
+ data.createdAt = data.createdAt.toISOString();
129
+ }
130
+ if (data.updatedAt && data.updatedAt instanceof Date) {
131
+ data.updatedAt = data.updatedAt.toISOString();
132
+ } else {
133
+ data.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
134
+ }
135
+ return data;
136
+ },
137
+ // Convert from Firestore data to AuthUser
138
+ fromFirestore: (data) => {
139
+ const processedData = { ...data };
140
+ const timestampFields = [];
141
+ timestampFields.forEach((field) => {
142
+ if (data[field]) {
143
+ if (AuthUserUtils.isFirestoreTimestamp(data[field])) {
144
+ processedData[field] = new Date(
145
+ data[field].seconds * 1e3
146
+ ).toISOString();
147
+ } else if (typeof data[field] === "string") {
148
+ processedData[field] = data[field];
149
+ }
150
+ }
151
+ });
152
+ return processedData;
153
+ }
154
+ };
155
+
156
+ // src/models2/Client.ts
157
+ var Client_exports = {};
158
+ __export(Client_exports, {
159
+ Client: () => Client
160
+ });
161
+ var Client;
162
+ ((Client2) => {
163
+ Client2.collection = () => "clients";
164
+ Client2.document = (clientId) => `clients/${clientId}`;
165
+ Client2.formatClient = (client) => {
166
+ return `${client.name} (${client.email}) - ${client.status}`;
167
+ };
168
+ Client2.createNew = (name, email) => {
169
+ return {
170
+ name,
171
+ email,
172
+ status: "active",
173
+ createdAt: (/* @__PURE__ */ new Date()).toISOString()
174
+ };
175
+ };
176
+ })(Client || (Client = {}));
177
+
178
+ // src/models2/ClientData.ts
179
+ var ClientData_exports = {};
180
+ __export(ClientData_exports, {
181
+ ClientData: () => ClientData
182
+ });
183
+ var ClientData;
184
+ ((ClientData2) => {
185
+ ClientData2.collection = () => "clientData";
186
+ ClientData2.document = (clientDataId) => `clientData/${clientDataId}`;
187
+ ClientData2.formatClientData = (clientData) => {
188
+ return `${clientData.firstName} ${clientData.lastName} (${clientData.email})`;
189
+ };
190
+ ClientData2.createNew = (firstName, lastName, email, phone, address, city, state, zip, country, countryPhoneCode, suburb) => {
191
+ return {
192
+ firstName,
193
+ lastName,
194
+ middleName: "",
195
+ preferredName: "",
196
+ email,
197
+ phone,
198
+ address,
199
+ city,
200
+ suburb,
201
+ state,
202
+ zip,
203
+ country,
204
+ countryPhoneCode,
205
+ createdAt: (/* @__PURE__ */ new Date()).toISOString()
206
+ };
207
+ };
208
+ })(ClientData || (ClientData = {}));
209
+
210
+ // src/models2/ClientLogin.ts
211
+ var ClientLogin_exports = {};
212
+ __export(ClientLogin_exports, {
213
+ ClientLogin: () => ClientLogin
214
+ });
215
+ var ClientLogin;
216
+ ((ClientLogin2) => {
217
+ ClientLogin2.collection = (userId) => `clientLogins/${userId}`;
218
+ ClientLogin2.document = (userId, domain) => `clientLogins/${userId}/logins/${domain}`;
219
+ ClientLogin2.formatClientLogin = (clientLogin) => {
220
+ return `${clientLogin.domain} (${clientLogin.username || clientLogin.email || "no username"})`;
221
+ };
222
+ ClientLogin2.createNew = (userId, url, domain, password, username, email) => {
223
+ return {
224
+ userId,
225
+ url,
226
+ domain,
227
+ password,
228
+ username,
229
+ email,
230
+ createdAt: (/* @__PURE__ */ new Date()).toISOString()
231
+ };
232
+ };
233
+ })(ClientLogin || (ClientLogin = {}));
234
+
235
+ // src/models2/Question.ts
236
+ var Question_exports = {};
237
+
238
+ // src/models2/UserQuestion.ts
239
+ var UserQuestion_exports = {};
240
+
241
+ // src/models2/Vacancy.ts
242
+ var Vacancy_exports = {};
243
+ __export(Vacancy_exports, {
244
+ Vacancy: () => Vacancy
245
+ });
246
+ var Vacancy;
247
+ ((Vacancy2) => {
248
+ Vacancy2.collection = () => "vacancies";
249
+ Vacancy2.document = (vacancyId) => `vacancies/${vacancyId}`;
250
+ Vacancy2.formatSummary = (vacancy) => {
251
+ return `${vacancy.position} at ${vacancy.company} (${vacancy.location})`;
252
+ };
253
+ Vacancy2.formatDate = (date) => {
254
+ const dateObj = date instanceof Date ? date : new Date(date);
255
+ return dateObj.toLocaleDateString();
256
+ };
257
+ Vacancy2.createNew = (company, position, location, description, advertisingUrl, applicationUrl, applicationDomain, advertisingDomain, fullPageText, jobId) => {
258
+ return {
259
+ company,
260
+ position,
261
+ location,
262
+ description,
263
+ advertisingUrl,
264
+ applicationUrl,
265
+ applicationDomain,
266
+ advertisingDomain,
267
+ fullPageText,
268
+ jobId,
269
+ createdAt: (/* @__PURE__ */ new Date()).toISOString()
270
+ };
271
+ };
272
+ })(Vacancy || (Vacancy = {}));
273
+
274
+ // src/models2/VacancySuggestion.ts
275
+ var VacancySuggestion_exports = {};
276
+ __export(VacancySuggestion_exports, {
277
+ VacancySuggestion: () => VacancySuggestion
278
+ });
279
+ var VacancySuggestion;
280
+ ((VacancySuggestion2) => {
281
+ VacancySuggestion2.collection = (clientId) => `clients/${clientId}/vacancySuggestions`;
282
+ VacancySuggestion2.document = (clientId, suggestionId) => `clients/${clientId}/vacancySuggestions/${suggestionId}`;
283
+ VacancySuggestion2.formatSummary = (suggestion) => {
284
+ return `${suggestion.vacancyPosition} at ${suggestion.vacancyCompany} (${suggestion.status})`;
285
+ };
286
+ VacancySuggestion2.createNew = (clientId, vacancyId, vacancyCompany, vacancyPosition, status = "new") => {
287
+ return {
288
+ clientId,
289
+ vacancyId,
290
+ vacancyCompany,
291
+ vacancyPosition,
292
+ status,
293
+ createdAt: (/* @__PURE__ */ new Date()).toISOString()
294
+ };
295
+ };
296
+ })(VacancySuggestion || (VacancySuggestion = {}));
297
+ // Annotate the CommonJS export names for ESM import in node:
298
+ 0 && (module.exports = {
299
+ Application,
300
+ AuthUser,
301
+ Client,
302
+ ClientData,
303
+ ClientLogin,
304
+ Question,
305
+ UserQuestion,
306
+ Vacancy,
307
+ VacancySuggestion
308
+ });
package/dist/index.mjs ADDED
@@ -0,0 +1,279 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __export = (target, all) => {
3
+ for (var name in all)
4
+ __defProp(target, name, { get: all[name], enumerable: true });
5
+ };
6
+
7
+ // src/models2/Application.ts
8
+ var Application_exports = {};
9
+ __export(Application_exports, {
10
+ Application: () => Application
11
+ });
12
+ var Application;
13
+ ((Application2) => {
14
+ Application2.collection = (clientId) => `clients/${clientId}/applications`;
15
+ Application2.document = (clientId, applicationId) => `clients/${clientId}/applications/${applicationId}`;
16
+ Application2.formatSummary = (application) => {
17
+ return `${application.position} at ${application.company} (${application.status})`;
18
+ };
19
+ Application2.formatDate = (date) => {
20
+ const dateObj = date instanceof Date ? date : new Date(date);
21
+ return dateObj.toLocaleDateString();
22
+ };
23
+ Application2.createNew = (clientId, vacancyId, vacancyData = {}) => {
24
+ return {
25
+ clientId,
26
+ vacancyId,
27
+ status: "new",
28
+ company: vacancyData.company,
29
+ position: vacancyData.position,
30
+ location: vacancyData.location,
31
+ jobId: vacancyData.jobId,
32
+ advertisingUrl: vacancyData.advertisingUrl,
33
+ applicationUrl: vacancyData.applicationUrl,
34
+ applicationDomain: vacancyData.applicationDomain,
35
+ advertisingDomain: vacancyData.advertisingDomain,
36
+ description: vacancyData.description,
37
+ fullPageText: vacancyData.fullPageText,
38
+ createdAt: (/* @__PURE__ */ new Date()).toISOString()
39
+ };
40
+ };
41
+ Application2.updateStatus = (application, newStatus) => {
42
+ return {
43
+ ...application,
44
+ status: newStatus,
45
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
46
+ };
47
+ };
48
+ })(Application || (Application = {}));
49
+
50
+ // src/models2/AuthUser.ts
51
+ var AuthUser_exports = {};
52
+ __export(AuthUser_exports, {
53
+ AuthUserCollectionPath: () => AuthUserCollectionPath,
54
+ AuthUserUtils: () => AuthUserUtils,
55
+ getAuthUserDocumentPath: () => getAuthUserDocumentPath
56
+ });
57
+ var AuthUserCollectionPath = "users";
58
+ var getAuthUserDocumentPath = (userId) => `users/${userId}`;
59
+ var AuthUserUtils = {
60
+ // Get timestamp fields for AuthUser
61
+ getTimestampFields: () => [],
62
+ // Check if value is a Firestore timestamp
63
+ isFirestoreTimestamp: (value) => {
64
+ return typeof value === "object" && value !== null && ("seconds" in value || "_firestore_timestamp" in value);
65
+ },
66
+ // Create from Firebase user object
67
+ fromFirebaseUser: (user) => {
68
+ return {
69
+ id: user.uid,
70
+ email: user.email,
71
+ displayName: user.displayName,
72
+ photoURL: user.photoURL,
73
+ emailVerified: user.emailVerified,
74
+ lastSignIn: (/* @__PURE__ */ new Date()).toISOString(),
75
+ // Current timestamp for new logins
76
+ createdAt: (/* @__PURE__ */ new Date()).toISOString()
77
+ };
78
+ },
79
+ // Convert dates to display format
80
+ formatDates: (user) => {
81
+ const formatDate = (dateValue) => {
82
+ if (!dateValue)
83
+ return "N/A";
84
+ const date = typeof dateValue === "string" ? new Date(dateValue) : dateValue;
85
+ return date.toLocaleString();
86
+ };
87
+ return {
88
+ lastSignIn: formatDate(user.lastSignIn),
89
+ createdAt: formatDate(user.createdAt),
90
+ updatedAt: user.updatedAt ? formatDate(user.updatedAt) : void 0
91
+ };
92
+ },
93
+ // Convert AuthUser to format for storage
94
+ toFirestore: (user) => {
95
+ const { id, ...data } = user;
96
+ if (data.lastSignIn && data.lastSignIn instanceof Date) {
97
+ data.lastSignIn = data.lastSignIn.toISOString();
98
+ }
99
+ if (data.createdAt && data.createdAt instanceof Date) {
100
+ data.createdAt = data.createdAt.toISOString();
101
+ }
102
+ if (data.updatedAt && data.updatedAt instanceof Date) {
103
+ data.updatedAt = data.updatedAt.toISOString();
104
+ } else {
105
+ data.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
106
+ }
107
+ return data;
108
+ },
109
+ // Convert from Firestore data to AuthUser
110
+ fromFirestore: (data) => {
111
+ const processedData = { ...data };
112
+ const timestampFields = [];
113
+ timestampFields.forEach((field) => {
114
+ if (data[field]) {
115
+ if (AuthUserUtils.isFirestoreTimestamp(data[field])) {
116
+ processedData[field] = new Date(
117
+ data[field].seconds * 1e3
118
+ ).toISOString();
119
+ } else if (typeof data[field] === "string") {
120
+ processedData[field] = data[field];
121
+ }
122
+ }
123
+ });
124
+ return processedData;
125
+ }
126
+ };
127
+
128
+ // src/models2/Client.ts
129
+ var Client_exports = {};
130
+ __export(Client_exports, {
131
+ Client: () => Client
132
+ });
133
+ var Client;
134
+ ((Client2) => {
135
+ Client2.collection = () => "clients";
136
+ Client2.document = (clientId) => `clients/${clientId}`;
137
+ Client2.formatClient = (client) => {
138
+ return `${client.name} (${client.email}) - ${client.status}`;
139
+ };
140
+ Client2.createNew = (name, email) => {
141
+ return {
142
+ name,
143
+ email,
144
+ status: "active",
145
+ createdAt: (/* @__PURE__ */ new Date()).toISOString()
146
+ };
147
+ };
148
+ })(Client || (Client = {}));
149
+
150
+ // src/models2/ClientData.ts
151
+ var ClientData_exports = {};
152
+ __export(ClientData_exports, {
153
+ ClientData: () => ClientData
154
+ });
155
+ var ClientData;
156
+ ((ClientData2) => {
157
+ ClientData2.collection = () => "clientData";
158
+ ClientData2.document = (clientDataId) => `clientData/${clientDataId}`;
159
+ ClientData2.formatClientData = (clientData) => {
160
+ return `${clientData.firstName} ${clientData.lastName} (${clientData.email})`;
161
+ };
162
+ ClientData2.createNew = (firstName, lastName, email, phone, address, city, state, zip, country, countryPhoneCode, suburb) => {
163
+ return {
164
+ firstName,
165
+ lastName,
166
+ middleName: "",
167
+ preferredName: "",
168
+ email,
169
+ phone,
170
+ address,
171
+ city,
172
+ suburb,
173
+ state,
174
+ zip,
175
+ country,
176
+ countryPhoneCode,
177
+ createdAt: (/* @__PURE__ */ new Date()).toISOString()
178
+ };
179
+ };
180
+ })(ClientData || (ClientData = {}));
181
+
182
+ // src/models2/ClientLogin.ts
183
+ var ClientLogin_exports = {};
184
+ __export(ClientLogin_exports, {
185
+ ClientLogin: () => ClientLogin
186
+ });
187
+ var ClientLogin;
188
+ ((ClientLogin2) => {
189
+ ClientLogin2.collection = (userId) => `clientLogins/${userId}`;
190
+ ClientLogin2.document = (userId, domain) => `clientLogins/${userId}/logins/${domain}`;
191
+ ClientLogin2.formatClientLogin = (clientLogin) => {
192
+ return `${clientLogin.domain} (${clientLogin.username || clientLogin.email || "no username"})`;
193
+ };
194
+ ClientLogin2.createNew = (userId, url, domain, password, username, email) => {
195
+ return {
196
+ userId,
197
+ url,
198
+ domain,
199
+ password,
200
+ username,
201
+ email,
202
+ createdAt: (/* @__PURE__ */ new Date()).toISOString()
203
+ };
204
+ };
205
+ })(ClientLogin || (ClientLogin = {}));
206
+
207
+ // src/models2/Question.ts
208
+ var Question_exports = {};
209
+
210
+ // src/models2/UserQuestion.ts
211
+ var UserQuestion_exports = {};
212
+
213
+ // src/models2/Vacancy.ts
214
+ var Vacancy_exports = {};
215
+ __export(Vacancy_exports, {
216
+ Vacancy: () => Vacancy
217
+ });
218
+ var Vacancy;
219
+ ((Vacancy2) => {
220
+ Vacancy2.collection = () => "vacancies";
221
+ Vacancy2.document = (vacancyId) => `vacancies/${vacancyId}`;
222
+ Vacancy2.formatSummary = (vacancy) => {
223
+ return `${vacancy.position} at ${vacancy.company} (${vacancy.location})`;
224
+ };
225
+ Vacancy2.formatDate = (date) => {
226
+ const dateObj = date instanceof Date ? date : new Date(date);
227
+ return dateObj.toLocaleDateString();
228
+ };
229
+ Vacancy2.createNew = (company, position, location, description, advertisingUrl, applicationUrl, applicationDomain, advertisingDomain, fullPageText, jobId) => {
230
+ return {
231
+ company,
232
+ position,
233
+ location,
234
+ description,
235
+ advertisingUrl,
236
+ applicationUrl,
237
+ applicationDomain,
238
+ advertisingDomain,
239
+ fullPageText,
240
+ jobId,
241
+ createdAt: (/* @__PURE__ */ new Date()).toISOString()
242
+ };
243
+ };
244
+ })(Vacancy || (Vacancy = {}));
245
+
246
+ // src/models2/VacancySuggestion.ts
247
+ var VacancySuggestion_exports = {};
248
+ __export(VacancySuggestion_exports, {
249
+ VacancySuggestion: () => VacancySuggestion
250
+ });
251
+ var VacancySuggestion;
252
+ ((VacancySuggestion2) => {
253
+ VacancySuggestion2.collection = (clientId) => `clients/${clientId}/vacancySuggestions`;
254
+ VacancySuggestion2.document = (clientId, suggestionId) => `clients/${clientId}/vacancySuggestions/${suggestionId}`;
255
+ VacancySuggestion2.formatSummary = (suggestion) => {
256
+ return `${suggestion.vacancyPosition} at ${suggestion.vacancyCompany} (${suggestion.status})`;
257
+ };
258
+ VacancySuggestion2.createNew = (clientId, vacancyId, vacancyCompany, vacancyPosition, status = "new") => {
259
+ return {
260
+ clientId,
261
+ vacancyId,
262
+ vacancyCompany,
263
+ vacancyPosition,
264
+ status,
265
+ createdAt: (/* @__PURE__ */ new Date()).toISOString()
266
+ };
267
+ };
268
+ })(VacancySuggestion || (VacancySuggestion = {}));
269
+ export {
270
+ Application_exports as Application,
271
+ AuthUser_exports as AuthUser,
272
+ Client_exports as Client,
273
+ ClientData_exports as ClientData,
274
+ ClientLogin_exports as ClientLogin,
275
+ Question_exports as Question,
276
+ UserQuestion_exports as UserQuestion,
277
+ Vacancy_exports as Vacancy,
278
+ VacancySuggestion_exports as VacancySuggestion
279
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jobsearch-works/firestore-models",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
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",
@@ -8,7 +8,7 @@
8
8
  "dist"
9
9
  ],
10
10
  "scripts": {
11
- "build": "tsc",
11
+ "build": "tsup src/index.ts --format esm,cjs --dts --clean",
12
12
  "prepare": "npm run build",
13
13
  "test": "vitest",
14
14
  "lint": "eslint ./src",
@@ -1,8 +0,0 @@
1
- /**
2
- * Generic type for all model interfaces
3
- */
4
- export interface BaseModel {
5
- id?: string;
6
- createdAt?: Date | string;
7
- updatedAt?: Date | string;
8
- }
package/dist/BaseModel.js DELETED
@@ -1 +0,0 @@
1
- export {};
@@ -1,19 +0,0 @@
1
- import { BaseModel } from "../BaseModel";
2
- export declare namespace VacancySuggestion {
3
- /**
4
- * Represents a job vacancy suggestion for a client
5
- */
6
- interface Model extends BaseModel {
7
- clientId: string;
8
- vacancyId: string;
9
- vacancyCompany: string;
10
- vacancyPosition: string;
11
- status: string;
12
- createdAt: Date | string;
13
- updatedAt?: Date | string;
14
- }
15
- const collection: (clientId: string) => string;
16
- const document: (clientId: string, suggestionId: string) => string;
17
- const formatSummary: (suggestion: VacancySuggestion.Model) => string;
18
- const createNew: (clientId: string, vacancyId: string, vacancyCompany: string, vacancyPosition: string, status?: string) => VacancySuggestion.Model;
19
- }
@@ -1,18 +0,0 @@
1
- export var VacancySuggestion;
2
- (function (VacancySuggestion) {
3
- VacancySuggestion.collection = (clientId) => `clients/${clientId}/vacancySuggestions`;
4
- VacancySuggestion.document = (clientId, suggestionId) => `clients/${clientId}/vacancySuggestions/${suggestionId}`;
5
- VacancySuggestion.formatSummary = (suggestion) => {
6
- return `${suggestion.vacancyPosition} at ${suggestion.vacancyCompany} (${suggestion.status})`;
7
- };
8
- VacancySuggestion.createNew = (clientId, vacancyId, vacancyCompany, vacancyPosition, status = "new") => {
9
- return {
10
- clientId,
11
- vacancyId,
12
- vacancyCompany,
13
- vacancyPosition,
14
- status,
15
- createdAt: new Date().toISOString(),
16
- };
17
- };
18
- })(VacancySuggestion || (VacancySuggestion = {}));