@jobsearch-works/firestore-models 1.0.33 → 1.1.0

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.d.ts CHANGED
@@ -1,340 +1,252 @@
1
- /**
2
- * Generic type for all model interfaces
3
- */
4
- interface BaseModel {
1
+ interface Client {
5
2
  id?: string;
3
+ name: string;
4
+ email: string;
5
+ status: "active" | "inactive";
6
+ resume?: string;
6
7
  createdAt?: Date | string;
7
- updatedAt?: Date | string;
8
8
  }
9
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: Status;
18
- assignedTo?: string;
19
- coverLetter?: string;
20
- resume?: string;
21
- submittedAt?: Date | string;
22
- interviewingAt?: Date | string;
23
- acceptedAt?: Date | string;
24
- rejectedAt?: Date | string;
25
- withdrawnAt?: Date | string;
26
- applyingAt?: Date | string;
27
- suggestedAt?: Date | string;
28
- approvedAt?: Date | string;
29
- company?: string;
30
- position?: string;
31
- location?: string;
32
- jobId?: string;
33
- advertisingUrl?: string;
34
- applicationUrl?: string;
35
- applicationDomain?: string;
36
- advertisingDomain?: string;
37
- description?: string;
38
- fullPageText?: string;
39
- }
40
- const Status: {
41
- readonly New: "new";
42
- readonly Submitted: "submitted";
43
- readonly Interviewing: "interviewing";
44
- readonly Accepted: "accepted";
45
- readonly Rejected: "rejected";
46
- readonly Withdrawn: "withdrawn";
47
- readonly Applying: "applying";
48
- readonly Suggested: "suggested";
49
- readonly Approved: "approved";
50
- };
51
- type Status = (typeof Status)[keyof typeof Status];
52
- const StatusOptions: readonly Status[];
53
- const collection: (clientId: string) => string;
54
- const document: (clientId: string, applicationId: string) => string;
55
- const formatSummary: (application: Application.Model) => string;
56
- const formatDate: (date: Date | string) => string;
57
- const createNew: (clientId: string, vacancyId: string, vacancyData?: {
58
- company?: string;
59
- position?: string;
60
- location?: string;
61
- jobId?: string;
62
- advertisingUrl?: string;
63
- applicationUrl?: string;
64
- applicationDomain?: string;
65
- advertisingDomain?: string;
66
- description?: string;
67
- fullPageText?: string;
68
- }) => Application.Model;
69
- const updateStatus: (application: Application.Model, newStatus: Application.Model["status"]) => Application.Model;
70
- }
71
-
72
- declare namespace AuthUser {
73
- export interface Model extends BaseModel {
74
- email: string;
75
- displayName?: string;
76
- photoURL?: string;
77
- lastSignIn?: string;
78
- emailVerified?: boolean;
79
- }
80
- interface FirestoreTimestamp {
81
- seconds: number;
82
- nanoseconds: number;
83
- _firestore_timestamp?: boolean;
84
- }
85
- export const collection: () => string;
86
- export const document: (userId: string) => string;
87
- export const getTimestampFields: () => (keyof Model)[];
88
- export const isFirestoreTimestamp: (value: any) => value is FirestoreTimestamp;
89
- export const fromFirebaseUser: (user: any) => Model;
90
- export const format: (user: Model) => string;
91
- export const formatDates: (user: Model) => {
92
- lastSignIn: string;
93
- createdAt: string;
94
- updatedAt?: string;
95
- };
96
- export const toFirestore: (user: Model) => Record<string, any>;
97
- export const fromFirestore: (data: Record<string, any>) => Model;
98
- export const createNew: (email: string, displayName?: string, photoURL?: string) => Model;
99
- export {};
10
+ declare const ApplicationStatus: {
11
+ readonly New: "new";
12
+ readonly Submitted: "submitted";
13
+ readonly Interviewing: "interviewing";
14
+ readonly Accepted: "accepted";
15
+ readonly Rejected: "rejected";
16
+ readonly Withdrawn: "withdrawn";
17
+ readonly Applying: "applying";
18
+ readonly Suggested: "suggested";
19
+ readonly Approved: "approved";
20
+ };
21
+ type ApplicationStatus = (typeof ApplicationStatus)[keyof typeof ApplicationStatus];
22
+ interface Application {
23
+ id?: string;
24
+ vacancyId: string;
25
+ clientId: string;
26
+ status: ApplicationStatus;
27
+ assignedTo?: string;
28
+ coverLetter?: string;
29
+ resume?: string;
30
+ submittedAt?: Date | string;
31
+ interviewingAt?: Date | string;
32
+ acceptedAt?: Date | string;
33
+ rejectedAt?: Date | string;
34
+ withdrawnAt?: Date | string;
35
+ applyingAt?: Date | string;
36
+ suggestedAt?: Date | string;
37
+ approvedAt?: Date | string;
38
+ company?: string;
39
+ position?: string;
40
+ location?: string;
41
+ jobId?: string;
42
+ advertisingUrl?: string;
43
+ applicationUrl?: string;
44
+ applicationDomain?: string;
45
+ advertisingDomain?: string;
46
+ description?: string;
47
+ fullPageText?: string;
48
+ createdAt?: Date | string;
49
+ updatedAt?: Date | string;
100
50
  }
101
51
 
102
- declare namespace Client {
103
- interface Model extends BaseModel {
104
- name: string;
105
- email: string;
106
- status: "active" | "inactive";
107
- resume?: string;
108
- }
109
- const collection: () => string;
110
- const document: (clientId: string) => string;
111
- const formatClient: (client: Client.Model) => string;
112
- const createNew: (name: string, email: string) => Client.Model;
52
+ interface AuthUser {
53
+ id?: string;
54
+ email: string;
55
+ displayName?: string;
56
+ photoURL?: string;
57
+ lastSignIn?: string;
58
+ emailVerified?: boolean;
59
+ createdAt?: Date | string;
60
+ updatedAt?: Date | string;
113
61
  }
114
62
 
115
- declare namespace ClientData {
116
- /**
117
- * Represents a user's personal data.
118
- */
119
- interface Model extends BaseModel {
120
- firstName: string;
121
- lastName: string;
122
- middleName?: string;
123
- preferredName?: string;
124
- email: string;
125
- phone: string;
126
- address: string;
127
- city: string;
128
- suburb: string;
129
- state: string;
130
- zip: string;
131
- country: string;
132
- linkedIn?: string;
133
- countryPhoneCode: string;
134
- nationality: string;
135
- dateOfBirth?: Date | string;
136
- }
137
- const collection: () => string;
138
- const document: (clientDataId: string) => string;
139
- const formatClientData: (clientData: ClientData.Model) => string;
140
- 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;
63
+ declare const VacancyCategory: {
64
+ readonly Accounting: "Accounting";
65
+ readonly AdministrationAndOfficeSupport: "Administration & Office Support";
66
+ readonly AdvertisingArtsAndMedia: "Advertising, Arts & Media";
67
+ readonly BankingAndFinancialServices: "Banking & Financial Services";
68
+ readonly CallCentreAndCustomerService: "Call Centre & Customer Service";
69
+ readonly CEOAndGeneralManagement: "CEO & General Management";
70
+ readonly CommunityServicesAndDevelopment: "Community Services & Development";
71
+ readonly Construction: "Construction";
72
+ readonly ConsultingAndStrategy: "Consulting & Strategy";
73
+ readonly DesignAndArchitecture: "Design & Architecture";
74
+ readonly EducationAndTraining: "Education & Training";
75
+ readonly Engineering: "Engineering";
76
+ readonly FarmingAnimalsAndConservation: "Farming, Animals & Conservation";
77
+ readonly GovernmentAndDefence: "Government & Defence";
78
+ readonly HealthcareAndMedical: "Healthcare & Medical";
79
+ readonly HospitalityAndTourism: "Hospitality & Tourism";
80
+ readonly HumanResourcesAndRecruitment: "Human Resources & Recruitment";
81
+ readonly InformationAndCommunicationTechnology: "Information & Communication Technology";
82
+ readonly InsuranceAndSuperannuation: "Insurance & Superannuation";
83
+ readonly Legal: "Legal";
84
+ readonly ManufacturingTransportAndLogistics: "Manufacturing, Transport & Logistics";
85
+ readonly MarketingAndCommunications: "Marketing & Communications";
86
+ readonly MiningResourcesAndEnergy: "Mining, Resources & Energy";
87
+ readonly RealEstateAndProperty: "Real Estate & Property";
88
+ readonly RetailAndConsumerProducts: "Retail & Consumer Products";
89
+ readonly Sales: "Sales";
90
+ readonly ScienceAndTechnology: "Science & Technology";
91
+ readonly SelfEmployment: "Self Employment";
92
+ readonly SportAndRecreation: "Sport & Recreation";
93
+ readonly TradesAndServices: "Trades & Services";
94
+ };
95
+ type VacancyCategory = (typeof VacancyCategory)[keyof typeof VacancyCategory];
96
+ interface Vacancy {
97
+ id?: string;
98
+ company: string;
99
+ position: string;
100
+ location: string;
101
+ description: string;
102
+ advertisingUrl: string;
103
+ applicationUrl: string;
104
+ applicationDomain: string;
105
+ advertisingDomain: string;
106
+ fullPageText: string;
107
+ jobId: string;
108
+ category: VacancyCategory;
109
+ suggestedTo?: string[];
110
+ createdAt?: Date | string;
111
+ updatedAt?: Date | string;
141
112
  }
142
113
 
143
- declare namespace ClientLogin {
144
- /**
145
- * Represents login credentials for a client website
146
- */
147
- interface Model extends BaseModel {
148
- userId: string;
149
- url: string;
150
- domain: string;
151
- username?: string;
152
- password: string;
153
- email?: string;
154
- }
155
- const collection: (userId: string) => string;
156
- const document: (userId: string, domain: string) => string;
157
- const formatClientLogin: (clientLogin: ClientLogin.Model) => string;
158
- const createNew: (userId: string, url: string, domain: string, password: string, username?: string, email?: string) => ClientLogin.Model;
114
+ interface Agent {
115
+ id?: string;
116
+ name: string;
117
+ email: string;
118
+ status: "active" | "inactive";
119
+ profilePicture?: string;
120
+ createdAt?: Date | string;
121
+ updatedAt?: Date | string;
159
122
  }
160
123
 
161
- declare namespace ClientQuestion {
162
- /**
163
- * Represents a Q&A pair in the user's knowledge base
164
- */
165
- interface Model extends BaseModel {
166
- questionText: string;
167
- answerText?: string;
168
- type: Type;
169
- options?: string[];
170
- }
171
- type Type = "text" | "select";
172
- const TypeOptions: readonly Type[];
173
- const collection: (clientId: string) => string;
174
- const document: (clientId: string, questionId: string) => string;
175
- const createNew: (questionText: string, type: Type, answerText?: string, options?: string[]) => ClientQuestion.Model;
124
+ type ClientQuestionType = "text" | "select";
125
+ declare const ClientQuestionTypeOptions: readonly ClientQuestionType[];
126
+ interface ClientQuestion {
127
+ id?: string;
128
+ questionText: string;
129
+ answerText?: string;
130
+ type: ClientQuestionType;
131
+ options?: string[];
132
+ createdAt?: Date | string;
133
+ updatedAt?: Date | string;
176
134
  }
177
135
 
178
- declare namespace Vacancy {
179
- /**
180
- * Runtime constant object representing all categories.
181
- */
182
- const Category: {
183
- readonly Accounting: "Accounting";
184
- readonly AdministrationAndOfficeSupport: "Administration & Office Support";
185
- readonly AdvertisingArtsAndMedia: "Advertising, Arts & Media";
186
- readonly BankingAndFinancialServices: "Banking & Financial Services";
187
- readonly CallCentreAndCustomerService: "Call Centre & Customer Service";
188
- readonly CEOAndGeneralManagement: "CEO & General Management";
189
- readonly CommunityServicesAndDevelopment: "Community Services & Development";
190
- readonly Construction: "Construction";
191
- readonly ConsultingAndStrategy: "Consulting & Strategy";
192
- readonly DesignAndArchitecture: "Design & Architecture";
193
- readonly EducationAndTraining: "Education & Training";
194
- readonly Engineering: "Engineering";
195
- readonly FarmingAnimalsAndConservation: "Farming, Animals & Conservation";
196
- readonly GovernmentAndDefence: "Government & Defence";
197
- readonly HealthcareAndMedical: "Healthcare & Medical";
198
- readonly HospitalityAndTourism: "Hospitality & Tourism";
199
- readonly HumanResourcesAndRecruitment: "Human Resources & Recruitment";
200
- readonly InformationAndCommunicationTechnology: "Information & Communication Technology";
201
- readonly InsuranceAndSuperannuation: "Insurance & Superannuation";
202
- readonly Legal: "Legal";
203
- readonly ManufacturingTransportAndLogistics: "Manufacturing, Transport & Logistics";
204
- readonly MarketingAndCommunications: "Marketing & Communications";
205
- readonly MiningResourcesAndEnergy: "Mining, Resources & Energy";
206
- readonly RealEstateAndProperty: "Real Estate & Property";
207
- readonly RetailAndConsumerProducts: "Retail & Consumer Products";
208
- readonly Sales: "Sales";
209
- readonly ScienceAndTechnology: "Science & Technology";
210
- readonly SelfEmployment: "Self Employment";
211
- readonly SportAndRecreation: "Sport & Recreation";
212
- readonly TradesAndServices: "Trades & Services";
213
- };
214
- /**
215
- * Type representing a valid category value.
216
- */
217
- type Category = (typeof Category)[keyof typeof Category];
218
- /**
219
- * Vacancy model definition.
220
- */
221
- interface Model extends BaseModel {
222
- company: string;
223
- position: string;
224
- location: string;
225
- description: string;
226
- advertisingUrl: string;
227
- applicationUrl: string;
228
- applicationDomain: string;
229
- advertisingDomain: string;
230
- fullPageText: string;
231
- jobId: string;
232
- category: Category;
233
- suggestedTo?: string[];
234
- }
235
- /**
236
- * Returns the Firestore collection path for vacancies.
237
- */
238
- const collection: () => string;
239
- /**
240
- * Returns the Firestore document path for a specific vacancy.
241
- */
242
- const document: (vacancyId: string) => string;
243
- /**
244
- * Formats a short summary of a vacancy.
245
- */
246
- const formatSummary: (vacancy: Vacancy.Model) => string;
247
- /**
248
- * Formats a date into a localized string.
249
- */
250
- const formatDate: (date: Date | string) => string;
251
- /**
252
- * Creates a new Vacancy.Model with the given data.
253
- */
254
- const createNew: (company: string, position: string, location: string, description: string, advertisingUrl: string, applicationUrl: string, applicationDomain: string, advertisingDomain: string, fullPageText: string, jobId: string, category: Category) => Vacancy.Model;
136
+ interface ClientData {
137
+ id?: string;
138
+ firstName: string;
139
+ lastName: string;
140
+ middleName?: string;
141
+ preferredName?: string;
142
+ email: string;
143
+ phone: string;
144
+ address: string;
145
+ city: string;
146
+ suburb: string;
147
+ state: string;
148
+ zip: string;
149
+ country: string;
150
+ linkedIn?: string;
151
+ countryPhoneCode: string;
152
+ nationality: string;
153
+ dateOfBirth?: Date | string;
154
+ createdAt?: Date | string;
155
+ updatedAt?: Date | string;
255
156
  }
256
157
 
257
- declare namespace VacancySuggestion {
258
- /**
259
- * Represents a job vacancy suggestion for a client
260
- */
261
- interface Model extends BaseModel {
262
- clientId: string;
263
- vacancyId: string;
264
- status: string;
265
- company: string;
266
- position: string;
267
- location: string;
268
- description: string;
269
- advertisingUrl: string;
270
- applicationUrl: string;
271
- applicationDomain: string;
272
- advertisingDomain: string;
273
- fullPageText: string;
274
- jobId: string;
275
- category: Vacancy.Category;
276
- }
277
- const collection: (clientId: string) => string;
278
- const document: (clientId: string, suggestionId: string) => string;
279
- const formatSummary: (suggestion: VacancySuggestion.Model) => string;
280
- const createNew: (clientId: string, vacancyId: string, status: string, company: string, position: string, location: string, description: string, advertisingUrl: string, applicationUrl: string, applicationDomain: string, advertisingDomain: string, fullPageText: string, jobId: string, category: Vacancy.Category) => VacancySuggestion.Model;
158
+ interface ClientLogin {
159
+ id?: string;
160
+ userId: string;
161
+ url: string;
162
+ domain: string;
163
+ username?: string;
164
+ password: string;
165
+ email?: string;
166
+ createdAt?: Date | string;
167
+ updatedAt?: Date | string;
281
168
  }
282
169
 
283
- declare namespace ApplicationQuestion {
284
- /**
285
- * Represents a question and answer for a job application
286
- */
287
- interface Model extends BaseModel {
288
- questionText: string;
289
- answerText?: string;
290
- type: Type;
291
- }
292
- type Type = "text" | "select";
293
- const TypeOptions: readonly Type[];
294
- const collection: (clientId: string, applicationId: string) => string;
295
- const document: (clientId: string, applicationId: string, questionId: string) => string;
296
- const createNew: (questionText: string, type: Type, answerText?: string) => ApplicationQuestion.Model;
170
+ type ApplicationQuestionType = "text" | "select";
171
+ declare const ApplicationQuestionTypeOptions: readonly ApplicationQuestionType[];
172
+ interface ApplicationQuestion {
173
+ id?: string;
174
+ questionText: string;
175
+ answerText?: string;
176
+ type: ApplicationQuestionType;
177
+ createdAt?: Date | string;
178
+ updatedAt?: Date | string;
297
179
  }
298
180
 
299
- declare namespace Agent {
300
- interface Model extends BaseModel {
301
- name: string;
302
- email: string;
303
- status: "active" | "inactive";
304
- profilePicture?: string;
305
- }
306
- const collection: () => string;
307
- const document: (agentId: string) => string;
308
- const formatAgent: (agent: Agent.Model) => string;
309
- const createNew: (name: string, email: string) => Agent.Model;
181
+ interface VacancySuggestion {
182
+ id?: string;
183
+ clientId: string;
184
+ vacancyId: string;
185
+ status: string;
186
+ company: string;
187
+ position: string;
188
+ location: string;
189
+ description: string;
190
+ advertisingUrl: string;
191
+ applicationUrl: string;
192
+ applicationDomain: string;
193
+ advertisingDomain: string;
194
+ fullPageText: string;
195
+ jobId: string;
196
+ category: VacancyCategory;
197
+ createdAt?: Date | string;
198
+ updatedAt?: Date | string;
310
199
  }
311
200
 
312
- declare namespace GmailMessage {
313
- interface Model extends BaseModel {
314
- messageId: string;
315
- threadId?: string;
316
- labelIds?: string[];
317
- snippet?: string;
318
- internalDate?: string;
319
- payload?: {
320
- headers?: Array<{
321
- name: string;
322
- value: string;
323
- }>;
201
+ interface GmailMessage {
202
+ id?: string;
203
+ messageId: string;
204
+ threadId?: string;
205
+ labelIds?: string[];
206
+ snippet?: string;
207
+ internalDate?: string;
208
+ payload?: {
209
+ headers?: Array<{
210
+ name: string;
211
+ value: string;
212
+ }>;
213
+ body?: {
214
+ data?: string;
215
+ };
216
+ parts?: Array<{
217
+ mimeType?: string;
324
218
  body?: {
325
219
  data?: string;
326
220
  };
327
- parts?: Array<{
328
- mimeType?: string;
329
- body?: {
330
- data?: string;
331
- };
332
- }>;
333
- };
334
- }
335
- const collection: (clientId: string) => string;
336
- const document: (clientId: string, messageId: string) => string;
337
- const createNew: (messageId: string, threadId?: string, payload?: Model["payload"], labelIds?: string[], snippet?: string, internalDate?: string) => Model;
221
+ }>;
222
+ };
223
+ createdAt?: Date | string;
224
+ updatedAt?: Date | string;
338
225
  }
339
226
 
340
- export { Agent, Application, ApplicationQuestion, AuthUser, Client, ClientData, ClientLogin, ClientQuestion, GmailMessage, Vacancy, VacancySuggestion };
227
+ declare const pathStrings: {
228
+ readonly clients: () => string;
229
+ readonly client: (clientId: string) => string;
230
+ readonly applications: (clientId: string) => string;
231
+ readonly application: (clientId: string, applicationId: string) => string;
232
+ readonly users: () => string;
233
+ readonly user: (userId: string) => string;
234
+ readonly vacancies: () => string;
235
+ readonly vacancy: (vacancyId: string) => string;
236
+ readonly agents: () => string;
237
+ readonly agent: (agentId: string) => string;
238
+ readonly clientQuestions: (clientId: string) => string;
239
+ readonly clientQuestion: (clientId: string, questionId: string) => string;
240
+ readonly clientData: () => string;
241
+ readonly clientDataItem: (clientDataId: string) => string;
242
+ readonly clientLogins: (userId: string) => string;
243
+ readonly clientLogin: (userId: string, domain: string) => string;
244
+ readonly applicationQuestions: (clientId: string, applicationId: string) => string;
245
+ readonly applicationQuestion: (clientId: string, applicationId: string, questionId: string) => string;
246
+ readonly vacancySuggestions: (clientId: string) => string;
247
+ readonly vacancySuggestion: (clientId: string, suggestionId: string) => string;
248
+ readonly gmailMessages: (clientId: string) => string;
249
+ readonly gmailMessage: (clientId: string, messageId: string) => string;
250
+ };
251
+
252
+ export { Agent, Application, ApplicationQuestion, ApplicationQuestionType, ApplicationQuestionTypeOptions, ApplicationStatus, AuthUser, Client, ClientData, ClientLogin, ClientQuestion, ClientQuestionType, ClientQuestionTypeOptions, GmailMessage, Vacancy, VacancyCategory, VacancySuggestion, pathStrings };