@jobsearch-works/firestore-models 1.0.32 → 1.0.34

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