@jobsearch-works/firestore-models 1.0.7 → 1.0.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.
@@ -0,0 +1,308 @@
1
+ /**
2
+ * Generic type for all model interfaces
3
+ */
4
+ interface BaseModel {
5
+ id?: string;
6
+ createdAt?: Date | string;
7
+ updatedAt?: Date | string;
8
+ }
9
+
10
+ declare namespace Application {
11
+ /**
12
+ * Represents a job application
13
+ */
14
+ interface Model extends BaseModel {
15
+ vacancyId: string;
16
+ clientId: string;
17
+ status: "new" | "submitted" | "interviewing" | "accepted" | "rejected" | "withdrawn" | "applying" | "suggested" | "approved";
18
+ coverLetter?: string;
19
+ resume?: string;
20
+ company?: string;
21
+ position?: string;
22
+ location?: string;
23
+ jobId?: string;
24
+ advertisingUrl?: string;
25
+ applicationUrl?: string;
26
+ applicationDomain?: string;
27
+ advertisingDomain?: string;
28
+ description?: string;
29
+ fullPageText?: string;
30
+ }
31
+ const collection: (clientId: string) => string;
32
+ const document: (clientId: string, applicationId: string) => string;
33
+ const formatSummary: (application: Application.Model) => string;
34
+ const formatDate: (date: Date | string) => string;
35
+ const createNew: (clientId: string, vacancyId: string, vacancyData?: {
36
+ company?: string;
37
+ position?: string;
38
+ location?: string;
39
+ jobId?: string;
40
+ advertisingUrl?: string;
41
+ applicationUrl?: string;
42
+ applicationDomain?: string;
43
+ advertisingDomain?: string;
44
+ description?: string;
45
+ fullPageText?: string;
46
+ }) => Application.Model;
47
+ const updateStatus: (application: Application.Model, newStatus: Application.Model["status"]) => Application.Model;
48
+ }
49
+
50
+ declare const Application$1_Application: typeof Application;
51
+ declare namespace Application$1 {
52
+ export {
53
+ Application$1_Application as Application,
54
+ };
55
+ }
56
+
57
+ interface FirestoreTimestamp {
58
+ seconds: number;
59
+ nanoseconds: number;
60
+ _firestore_timestamp?: boolean;
61
+ }
62
+ /**
63
+ * AuthUser interface - replaces the old class-based model
64
+ */
65
+ interface AuthUser extends BaseModel {
66
+ email: string;
67
+ displayName?: string;
68
+ photoURL?: string;
69
+ lastSignIn?: Date | string;
70
+ emailVerified?: boolean;
71
+ }
72
+ declare const AuthUserCollectionPath = "users";
73
+ declare const getAuthUserDocumentPath: (userId: string) => string;
74
+ declare const AuthUserUtils: {
75
+ getTimestampFields: () => string[];
76
+ isFirestoreTimestamp: (value: any) => value is FirestoreTimestamp;
77
+ fromFirebaseUser: (user: any) => AuthUser;
78
+ formatDates: (user: AuthUser) => {
79
+ lastSignIn: string;
80
+ createdAt: string;
81
+ updatedAt?: string;
82
+ };
83
+ toFirestore: (user: AuthUser) => Record<string, any>;
84
+ fromFirestore: (data: Record<string, any>) => AuthUser;
85
+ };
86
+
87
+ type AuthUser$1_AuthUser = AuthUser;
88
+ declare const AuthUser$1_AuthUserCollectionPath: typeof AuthUserCollectionPath;
89
+ declare const AuthUser$1_AuthUserUtils: typeof AuthUserUtils;
90
+ declare const AuthUser$1_getAuthUserDocumentPath: typeof getAuthUserDocumentPath;
91
+ declare namespace AuthUser$1 {
92
+ export {
93
+ AuthUser$1_AuthUser as AuthUser,
94
+ AuthUser$1_AuthUserCollectionPath as AuthUserCollectionPath,
95
+ AuthUser$1_AuthUserUtils as AuthUserUtils,
96
+ AuthUser$1_getAuthUserDocumentPath as getAuthUserDocumentPath,
97
+ };
98
+ }
99
+
100
+ declare namespace Client {
101
+ interface Model extends BaseModel {
102
+ name: string;
103
+ email: string;
104
+ status: "active" | "inactive";
105
+ resume?: string;
106
+ }
107
+ const collection: () => string;
108
+ const document: (clientId: string) => string;
109
+ const formatClient: (client: Client.Model) => string;
110
+ const createNew: (name: string, email: string) => Client.Model;
111
+ }
112
+
113
+ declare const Client$1_Client: typeof Client;
114
+ declare namespace Client$1 {
115
+ export {
116
+ Client$1_Client as Client,
117
+ };
118
+ }
119
+
120
+ declare namespace ClientData {
121
+ /**
122
+ * Represents a user's personal data.
123
+ */
124
+ interface Model extends BaseModel {
125
+ firstName: string;
126
+ lastName: string;
127
+ middleName: string;
128
+ preferredName: string;
129
+ email: string;
130
+ phone: string;
131
+ address: string;
132
+ city: string;
133
+ suburb: string;
134
+ state: string;
135
+ zip: string;
136
+ country: string;
137
+ linkedIn?: string;
138
+ countryPhoneCode: string;
139
+ }
140
+ const collection: () => string;
141
+ const document: (clientDataId: string) => string;
142
+ const formatClientData: (clientData: ClientData.Model) => string;
143
+ 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;
144
+ }
145
+
146
+ declare const ClientData$1_ClientData: typeof ClientData;
147
+ declare namespace ClientData$1 {
148
+ export {
149
+ ClientData$1_ClientData as ClientData,
150
+ };
151
+ }
152
+
153
+ declare namespace ClientLogin {
154
+ /**
155
+ * Represents login credentials for a client website
156
+ */
157
+ interface Model extends BaseModel {
158
+ userId: string;
159
+ url: string;
160
+ domain: string;
161
+ username?: string;
162
+ password: string;
163
+ email?: string;
164
+ }
165
+ const collection: (userId: string) => string;
166
+ const document: (userId: string, domain: string) => string;
167
+ const formatClientLogin: (clientLogin: ClientLogin.Model) => string;
168
+ const createNew: (userId: string, url: string, domain: string, password: string, username?: string, email?: string) => ClientLogin.Model;
169
+ }
170
+
171
+ declare const ClientLogin$1_ClientLogin: typeof ClientLogin;
172
+ declare namespace ClientLogin$1 {
173
+ export {
174
+ ClientLogin$1_ClientLogin as ClientLogin,
175
+ };
176
+ }
177
+
178
+ /**
179
+ * QuestionData interface defines the core data fields for a generic question.
180
+ */
181
+ interface QuestionData {
182
+ question: string;
183
+ options: string[];
184
+ }
185
+ /**
186
+ * Question interface - extends BaseModelInterface and includes QuestionData
187
+ */
188
+ interface Question extends BaseModel, QuestionData {
189
+ }
190
+ interface ApplicationQuestion {
191
+ questionText: string;
192
+ type: "text";
193
+ answer?: string;
194
+ }
195
+ /**
196
+ * Represents ApplicationQuestion data including its Firestore document ID.
197
+ */
198
+ type ApplicationQuestionDocument = ApplicationQuestion & {
199
+ id: string;
200
+ };
201
+ /**
202
+ * Represents a question-answer pair stored centrally for a client.
203
+ * Assumes structure in clients/{clientId}/questions collection.
204
+ */
205
+ interface ClientQuestionAnswerPair {
206
+ id?: string;
207
+ questionText: string;
208
+ answer: string;
209
+ createdAt?: Date;
210
+ }
211
+
212
+ type Question$1_ApplicationQuestion = ApplicationQuestion;
213
+ type Question$1_ApplicationQuestionDocument = ApplicationQuestionDocument;
214
+ type Question$1_ClientQuestionAnswerPair = ClientQuestionAnswerPair;
215
+ type Question$1_Question = Question;
216
+ type Question$1_QuestionData = QuestionData;
217
+ declare namespace Question$1 {
218
+ export {
219
+ Question$1_ApplicationQuestion as ApplicationQuestion,
220
+ Question$1_ApplicationQuestionDocument as ApplicationQuestionDocument,
221
+ Question$1_ClientQuestionAnswerPair as ClientQuestionAnswerPair,
222
+ Question$1_Question as Question,
223
+ Question$1_QuestionData as QuestionData,
224
+ };
225
+ }
226
+
227
+ /**
228
+ * UserQuestionData interface defines the core data fields for a user question.
229
+ */
230
+ interface UserQuestionData {
231
+ userId: string;
232
+ question: string;
233
+ answer: string;
234
+ options: string[];
235
+ }
236
+ /**
237
+ * UserQuestion interface - extends BaseModel and includes UserQuestionData
238
+ */
239
+ interface UserQuestion extends BaseModel, UserQuestionData {
240
+ }
241
+
242
+ type UserQuestion$1_UserQuestion = UserQuestion;
243
+ type UserQuestion$1_UserQuestionData = UserQuestionData;
244
+ declare namespace UserQuestion$1 {
245
+ export {
246
+ UserQuestion$1_UserQuestion as UserQuestion,
247
+ UserQuestion$1_UserQuestionData as UserQuestionData,
248
+ };
249
+ }
250
+
251
+ declare namespace Vacancy {
252
+ /**
253
+ * Represents a job vacancy
254
+ */
255
+ interface Model extends BaseModel {
256
+ company: string;
257
+ position: string;
258
+ location: string;
259
+ description: string;
260
+ advertisingUrl: string;
261
+ applicationUrl: string;
262
+ applicationDomain: string;
263
+ advertisingDomain: string;
264
+ fullPageText: string;
265
+ jobId: string;
266
+ suggestedTo?: string[];
267
+ }
268
+ const collection: () => string;
269
+ const document: (vacancyId: string) => string;
270
+ const formatSummary: (vacancy: Vacancy.Model) => string;
271
+ const formatDate: (date: Date | string) => string;
272
+ const createNew: (company: string, position: string, location: string, description: string, advertisingUrl: string, applicationUrl: string, applicationDomain: string, advertisingDomain: string, fullPageText: string, jobId: string) => Vacancy.Model;
273
+ }
274
+
275
+ declare const Vacancy$1_Vacancy: typeof Vacancy;
276
+ declare namespace Vacancy$1 {
277
+ export {
278
+ Vacancy$1_Vacancy as Vacancy,
279
+ };
280
+ }
281
+
282
+ declare namespace VacancySuggestion {
283
+ /**
284
+ * Represents a job vacancy suggestion for a client
285
+ */
286
+ interface Model extends BaseModel {
287
+ clientId: string;
288
+ vacancyId: string;
289
+ vacancyCompany: string;
290
+ vacancyPosition: string;
291
+ status: string;
292
+ createdAt: Date | string;
293
+ updatedAt?: Date | string;
294
+ }
295
+ const collection: (clientId: string) => string;
296
+ const document: (clientId: string, suggestionId: string) => string;
297
+ const formatSummary: (suggestion: VacancySuggestion.Model) => string;
298
+ const createNew: (clientId: string, vacancyId: string, vacancyCompany: string, vacancyPosition: string, status?: string) => VacancySuggestion.Model;
299
+ }
300
+
301
+ declare const VacancySuggestion$1_VacancySuggestion: typeof VacancySuggestion;
302
+ declare namespace VacancySuggestion$1 {
303
+ export {
304
+ VacancySuggestion$1_VacancySuggestion as VacancySuggestion,
305
+ };
306
+ }
307
+
308
+ export { Application$1 as Application, AuthUser$1 as AuthUser, BaseModel, Client$1 as Client, ClientData$1 as ClientData, ClientLogin$1 as ClientLogin, Question$1 as Question, UserQuestion$1 as UserQuestion, Vacancy$1 as Vacancy, VacancySuggestion$1 as VacancySuggestion };
package/dist/index.d.ts CHANGED
@@ -1,11 +1,308 @@
1
- export * from "./BaseModel";
2
- import * as Application from "./models/Application";
3
- import * as AuthUser from "./models/AuthUser";
4
- import * as Client from "./models/Client";
5
- import * as ClientData from "./models/ClientData";
6
- import * as ClientLogin from "./models/ClientLogin";
7
- import * as Question from "./models/Question";
8
- import * as UserQuestion from "./models/UserQuestion";
9
- import * as Vacancy from "./models/Vacancy";
10
- import * as VacancySuggestion from "./models/VacancySuggestion";
11
- export { Application, AuthUser, Client, ClientData, ClientLogin, Question, UserQuestion, Vacancy, VacancySuggestion, };
1
+ /**
2
+ * Generic type for all model interfaces
3
+ */
4
+ interface BaseModel {
5
+ id?: string;
6
+ createdAt?: Date | string;
7
+ updatedAt?: Date | string;
8
+ }
9
+
10
+ declare namespace Application {
11
+ /**
12
+ * Represents a job application
13
+ */
14
+ interface Model extends BaseModel {
15
+ vacancyId: string;
16
+ clientId: string;
17
+ status: "new" | "submitted" | "interviewing" | "accepted" | "rejected" | "withdrawn" | "applying" | "suggested" | "approved";
18
+ coverLetter?: string;
19
+ resume?: string;
20
+ company?: string;
21
+ position?: string;
22
+ location?: string;
23
+ jobId?: string;
24
+ advertisingUrl?: string;
25
+ applicationUrl?: string;
26
+ applicationDomain?: string;
27
+ advertisingDomain?: string;
28
+ description?: string;
29
+ fullPageText?: string;
30
+ }
31
+ const collection: (clientId: string) => string;
32
+ const document: (clientId: string, applicationId: string) => string;
33
+ const formatSummary: (application: Application.Model) => string;
34
+ const formatDate: (date: Date | string) => string;
35
+ const createNew: (clientId: string, vacancyId: string, vacancyData?: {
36
+ company?: string;
37
+ position?: string;
38
+ location?: string;
39
+ jobId?: string;
40
+ advertisingUrl?: string;
41
+ applicationUrl?: string;
42
+ applicationDomain?: string;
43
+ advertisingDomain?: string;
44
+ description?: string;
45
+ fullPageText?: string;
46
+ }) => Application.Model;
47
+ const updateStatus: (application: Application.Model, newStatus: Application.Model["status"]) => Application.Model;
48
+ }
49
+
50
+ declare const Application$1_Application: typeof Application;
51
+ declare namespace Application$1 {
52
+ export {
53
+ Application$1_Application as Application,
54
+ };
55
+ }
56
+
57
+ interface FirestoreTimestamp {
58
+ seconds: number;
59
+ nanoseconds: number;
60
+ _firestore_timestamp?: boolean;
61
+ }
62
+ /**
63
+ * AuthUser interface - replaces the old class-based model
64
+ */
65
+ interface AuthUser extends BaseModel {
66
+ email: string;
67
+ displayName?: string;
68
+ photoURL?: string;
69
+ lastSignIn?: Date | string;
70
+ emailVerified?: boolean;
71
+ }
72
+ declare const AuthUserCollectionPath = "users";
73
+ declare const getAuthUserDocumentPath: (userId: string) => string;
74
+ declare const AuthUserUtils: {
75
+ getTimestampFields: () => string[];
76
+ isFirestoreTimestamp: (value: any) => value is FirestoreTimestamp;
77
+ fromFirebaseUser: (user: any) => AuthUser;
78
+ formatDates: (user: AuthUser) => {
79
+ lastSignIn: string;
80
+ createdAt: string;
81
+ updatedAt?: string;
82
+ };
83
+ toFirestore: (user: AuthUser) => Record<string, any>;
84
+ fromFirestore: (data: Record<string, any>) => AuthUser;
85
+ };
86
+
87
+ type AuthUser$1_AuthUser = AuthUser;
88
+ declare const AuthUser$1_AuthUserCollectionPath: typeof AuthUserCollectionPath;
89
+ declare const AuthUser$1_AuthUserUtils: typeof AuthUserUtils;
90
+ declare const AuthUser$1_getAuthUserDocumentPath: typeof getAuthUserDocumentPath;
91
+ declare namespace AuthUser$1 {
92
+ export {
93
+ AuthUser$1_AuthUser as AuthUser,
94
+ AuthUser$1_AuthUserCollectionPath as AuthUserCollectionPath,
95
+ AuthUser$1_AuthUserUtils as AuthUserUtils,
96
+ AuthUser$1_getAuthUserDocumentPath as getAuthUserDocumentPath,
97
+ };
98
+ }
99
+
100
+ declare namespace Client {
101
+ interface Model extends BaseModel {
102
+ name: string;
103
+ email: string;
104
+ status: "active" | "inactive";
105
+ resume?: string;
106
+ }
107
+ const collection: () => string;
108
+ const document: (clientId: string) => string;
109
+ const formatClient: (client: Client.Model) => string;
110
+ const createNew: (name: string, email: string) => Client.Model;
111
+ }
112
+
113
+ declare const Client$1_Client: typeof Client;
114
+ declare namespace Client$1 {
115
+ export {
116
+ Client$1_Client as Client,
117
+ };
118
+ }
119
+
120
+ declare namespace ClientData {
121
+ /**
122
+ * Represents a user's personal data.
123
+ */
124
+ interface Model extends BaseModel {
125
+ firstName: string;
126
+ lastName: string;
127
+ middleName: string;
128
+ preferredName: string;
129
+ email: string;
130
+ phone: string;
131
+ address: string;
132
+ city: string;
133
+ suburb: string;
134
+ state: string;
135
+ zip: string;
136
+ country: string;
137
+ linkedIn?: string;
138
+ countryPhoneCode: string;
139
+ }
140
+ const collection: () => string;
141
+ const document: (clientDataId: string) => string;
142
+ const formatClientData: (clientData: ClientData.Model) => string;
143
+ 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;
144
+ }
145
+
146
+ declare const ClientData$1_ClientData: typeof ClientData;
147
+ declare namespace ClientData$1 {
148
+ export {
149
+ ClientData$1_ClientData as ClientData,
150
+ };
151
+ }
152
+
153
+ declare namespace ClientLogin {
154
+ /**
155
+ * Represents login credentials for a client website
156
+ */
157
+ interface Model extends BaseModel {
158
+ userId: string;
159
+ url: string;
160
+ domain: string;
161
+ username?: string;
162
+ password: string;
163
+ email?: string;
164
+ }
165
+ const collection: (userId: string) => string;
166
+ const document: (userId: string, domain: string) => string;
167
+ const formatClientLogin: (clientLogin: ClientLogin.Model) => string;
168
+ const createNew: (userId: string, url: string, domain: string, password: string, username?: string, email?: string) => ClientLogin.Model;
169
+ }
170
+
171
+ declare const ClientLogin$1_ClientLogin: typeof ClientLogin;
172
+ declare namespace ClientLogin$1 {
173
+ export {
174
+ ClientLogin$1_ClientLogin as ClientLogin,
175
+ };
176
+ }
177
+
178
+ /**
179
+ * QuestionData interface defines the core data fields for a generic question.
180
+ */
181
+ interface QuestionData {
182
+ question: string;
183
+ options: string[];
184
+ }
185
+ /**
186
+ * Question interface - extends BaseModelInterface and includes QuestionData
187
+ */
188
+ interface Question extends BaseModel, QuestionData {
189
+ }
190
+ interface ApplicationQuestion {
191
+ questionText: string;
192
+ type: "text";
193
+ answer?: string;
194
+ }
195
+ /**
196
+ * Represents ApplicationQuestion data including its Firestore document ID.
197
+ */
198
+ type ApplicationQuestionDocument = ApplicationQuestion & {
199
+ id: string;
200
+ };
201
+ /**
202
+ * Represents a question-answer pair stored centrally for a client.
203
+ * Assumes structure in clients/{clientId}/questions collection.
204
+ */
205
+ interface ClientQuestionAnswerPair {
206
+ id?: string;
207
+ questionText: string;
208
+ answer: string;
209
+ createdAt?: Date;
210
+ }
211
+
212
+ type Question$1_ApplicationQuestion = ApplicationQuestion;
213
+ type Question$1_ApplicationQuestionDocument = ApplicationQuestionDocument;
214
+ type Question$1_ClientQuestionAnswerPair = ClientQuestionAnswerPair;
215
+ type Question$1_Question = Question;
216
+ type Question$1_QuestionData = QuestionData;
217
+ declare namespace Question$1 {
218
+ export {
219
+ Question$1_ApplicationQuestion as ApplicationQuestion,
220
+ Question$1_ApplicationQuestionDocument as ApplicationQuestionDocument,
221
+ Question$1_ClientQuestionAnswerPair as ClientQuestionAnswerPair,
222
+ Question$1_Question as Question,
223
+ Question$1_QuestionData as QuestionData,
224
+ };
225
+ }
226
+
227
+ /**
228
+ * UserQuestionData interface defines the core data fields for a user question.
229
+ */
230
+ interface UserQuestionData {
231
+ userId: string;
232
+ question: string;
233
+ answer: string;
234
+ options: string[];
235
+ }
236
+ /**
237
+ * UserQuestion interface - extends BaseModel and includes UserQuestionData
238
+ */
239
+ interface UserQuestion extends BaseModel, UserQuestionData {
240
+ }
241
+
242
+ type UserQuestion$1_UserQuestion = UserQuestion;
243
+ type UserQuestion$1_UserQuestionData = UserQuestionData;
244
+ declare namespace UserQuestion$1 {
245
+ export {
246
+ UserQuestion$1_UserQuestion as UserQuestion,
247
+ UserQuestion$1_UserQuestionData as UserQuestionData,
248
+ };
249
+ }
250
+
251
+ declare namespace Vacancy {
252
+ /**
253
+ * Represents a job vacancy
254
+ */
255
+ interface Model extends BaseModel {
256
+ company: string;
257
+ position: string;
258
+ location: string;
259
+ description: string;
260
+ advertisingUrl: string;
261
+ applicationUrl: string;
262
+ applicationDomain: string;
263
+ advertisingDomain: string;
264
+ fullPageText: string;
265
+ jobId: string;
266
+ suggestedTo?: string[];
267
+ }
268
+ const collection: () => string;
269
+ const document: (vacancyId: string) => string;
270
+ const formatSummary: (vacancy: Vacancy.Model) => string;
271
+ const formatDate: (date: Date | string) => string;
272
+ const createNew: (company: string, position: string, location: string, description: string, advertisingUrl: string, applicationUrl: string, applicationDomain: string, advertisingDomain: string, fullPageText: string, jobId: string) => Vacancy.Model;
273
+ }
274
+
275
+ declare const Vacancy$1_Vacancy: typeof Vacancy;
276
+ declare namespace Vacancy$1 {
277
+ export {
278
+ Vacancy$1_Vacancy as Vacancy,
279
+ };
280
+ }
281
+
282
+ declare namespace VacancySuggestion {
283
+ /**
284
+ * Represents a job vacancy suggestion for a client
285
+ */
286
+ interface Model extends BaseModel {
287
+ clientId: string;
288
+ vacancyId: string;
289
+ vacancyCompany: string;
290
+ vacancyPosition: string;
291
+ status: string;
292
+ createdAt: Date | string;
293
+ updatedAt?: Date | string;
294
+ }
295
+ const collection: (clientId: string) => string;
296
+ const document: (clientId: string, suggestionId: string) => string;
297
+ const formatSummary: (suggestion: VacancySuggestion.Model) => string;
298
+ const createNew: (clientId: string, vacancyId: string, vacancyCompany: string, vacancyPosition: string, status?: string) => VacancySuggestion.Model;
299
+ }
300
+
301
+ declare const VacancySuggestion$1_VacancySuggestion: typeof VacancySuggestion;
302
+ declare namespace VacancySuggestion$1 {
303
+ export {
304
+ VacancySuggestion$1_VacancySuggestion as VacancySuggestion,
305
+ };
306
+ }
307
+
308
+ export { Application$1 as Application, AuthUser$1 as AuthUser, BaseModel, Client$1 as Client, ClientData$1 as ClientData, ClientLogin$1 as ClientLogin, Question$1 as Question, UserQuestion$1 as UserQuestion, Vacancy$1 as Vacancy, VacancySuggestion$1 as VacancySuggestion };