@jobsearch-works/firestore-models 1.0.3 → 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/README.md +184 -100
- package/dist/index.d.mts +308 -0
- package/dist/index.d.ts +308 -10
- package/dist/index.js +308 -12
- package/dist/index.mjs +279 -0
- package/package.json +2 -2
- package/dist/BaseModel.d.ts +0 -8
- package/dist/BaseModel.js +0 -1
- package/dist/models/VacancySuggestion.d.ts +0 -19
- package/dist/models/VacancySuggestion.js +0 -18
- package/dist/models/application.d.ts +0 -40
- package/dist/models/application.js +0 -37
- package/dist/models/authUser.d.ts +0 -31
- package/dist/models/authUser.js +0 -80
- package/dist/models/client.d.ts +0 -13
- package/dist/models/client.js +0 -16
- package/dist/models/clientData.d.ts +0 -25
- package/dist/models/clientData.js +0 -24
- package/dist/models/clientLogin.d.ts +0 -18
- package/dist/models/clientLogin.js +0 -19
- package/dist/models/question.d.ts +0 -34
- package/dist/models/question.js +0 -1
- package/dist/models/userLogin.d.ts +0 -0
- package/dist/models/userLogin.js +0 -59
- package/dist/models/userQuestion.d.ts +0 -15
- package/dist/models/userQuestion.js +0 -37
- package/dist/models/vacancy.d.ts +0 -24
- package/dist/models/vacancy.js +0 -27
@@ -1,34 +0,0 @@
|
|
1
|
-
import { BaseModel } from "../BaseModel";
|
2
|
-
/**
|
3
|
-
* QuestionData interface defines the core data fields for a generic question.
|
4
|
-
*/
|
5
|
-
export interface QuestionData {
|
6
|
-
question: string;
|
7
|
-
options: string[];
|
8
|
-
}
|
9
|
-
/**
|
10
|
-
* Question interface - extends BaseModelInterface and includes QuestionData
|
11
|
-
*/
|
12
|
-
export interface Question extends BaseModel, QuestionData {
|
13
|
-
}
|
14
|
-
export interface ApplicationQuestion {
|
15
|
-
questionText: string;
|
16
|
-
type: "text";
|
17
|
-
answer?: string;
|
18
|
-
}
|
19
|
-
/**
|
20
|
-
* Represents ApplicationQuestion data including its Firestore document ID.
|
21
|
-
*/
|
22
|
-
export type ApplicationQuestionDocument = ApplicationQuestion & {
|
23
|
-
id: string;
|
24
|
-
};
|
25
|
-
/**
|
26
|
-
* Represents a question-answer pair stored centrally for a client.
|
27
|
-
* Assumes structure in clients/{clientId}/questions collection.
|
28
|
-
*/
|
29
|
-
export interface ClientQuestionAnswerPair {
|
30
|
-
id?: string;
|
31
|
-
questionText: string;
|
32
|
-
answer: string;
|
33
|
-
createdAt?: Date;
|
34
|
-
}
|
package/dist/models/question.js
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
File without changes
|
package/dist/models/userLogin.js
DELETED
@@ -1,59 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
// import { BaseModel } from "../BaseModel";
|
3
|
-
// /**
|
4
|
-
// * ClientLogin interface - represents login credentials for a client website
|
5
|
-
// */
|
6
|
-
// export interface ClientLogin extends BaseModel {
|
7
|
-
// userId: string;
|
8
|
-
// url: string;
|
9
|
-
// username?: string;
|
10
|
-
// password: string;
|
11
|
-
// email?: string;
|
12
|
-
// createdAt: Date | string;
|
13
|
-
// updatedAt?: Date | string;
|
14
|
-
// }
|
15
|
-
// // Helper functions for ClientLogin collections
|
16
|
-
// export const getClientLoginCollectionPath = (userId: string) =>
|
17
|
-
// ClientLoginPaths.collection(userId);
|
18
|
-
// export const getClientLoginDocumentPath = (userId: string, loginId: string) =>
|
19
|
-
// ClientLoginPaths.document(userId, loginId);
|
20
|
-
// // Helper utilities for working with ClientLogins
|
21
|
-
// export const ClientLoginUtils = {
|
22
|
-
// // Format dates for display
|
23
|
-
// formatDates: (
|
24
|
-
// login: ClientLogin
|
25
|
-
// ): { createdAt: string; updatedAt: string } => {
|
26
|
-
// const createdDate =
|
27
|
-
// login.createdAt instanceof Date
|
28
|
-
// ? login.createdAt
|
29
|
-
// : new Date(login.createdAt);
|
30
|
-
// const updatedDate = login.updatedAt
|
31
|
-
// ? login.updatedAt instanceof Date
|
32
|
-
// ? login.updatedAt
|
33
|
-
// : new Date(login.updatedAt)
|
34
|
-
// : createdDate;
|
35
|
-
// return {
|
36
|
-
// createdAt: createdDate.toLocaleDateString(),
|
37
|
-
// updatedAt: updatedDate.toLocaleDateString(),
|
38
|
-
// };
|
39
|
-
// },
|
40
|
-
// // Create a new login with defaults
|
41
|
-
// createNew: (
|
42
|
-
// userId: string,
|
43
|
-
// url: string,
|
44
|
-
// password: string,
|
45
|
-
// username?: string
|
46
|
-
// ): ClientLogin => {
|
47
|
-
// return {
|
48
|
-
// userId,
|
49
|
-
// url,
|
50
|
-
// username,
|
51
|
-
// password,
|
52
|
-
// createdAt: new Date().toISOString(),
|
53
|
-
// };
|
54
|
-
// },
|
55
|
-
// // Get display name for a login (e.g. for UI lists)
|
56
|
-
// getDisplayName: (login: ClientLogin): string => {
|
57
|
-
// return `${login.url} (${login.username || "no username"})`;
|
58
|
-
// },
|
59
|
-
// };
|
@@ -1,15 +0,0 @@
|
|
1
|
-
import { BaseModel } from "../BaseModel";
|
2
|
-
/**
|
3
|
-
* UserQuestionData interface defines the core data fields for a user question.
|
4
|
-
*/
|
5
|
-
export interface UserQuestionData {
|
6
|
-
userId: string;
|
7
|
-
question: string;
|
8
|
-
answer: string;
|
9
|
-
options: string[];
|
10
|
-
}
|
11
|
-
/**
|
12
|
-
* UserQuestion interface - extends BaseModel and includes UserQuestionData
|
13
|
-
*/
|
14
|
-
export interface UserQuestion extends BaseModel, UserQuestionData {
|
15
|
-
}
|
@@ -1,37 +0,0 @@
|
|
1
|
-
export {};
|
2
|
-
// Remove the old class definition and path methods
|
3
|
-
/*
|
4
|
-
export class UserQuestion extends FirestoreModel {
|
5
|
-
userId!: string
|
6
|
-
question!: string
|
7
|
-
answer!: string
|
8
|
-
options!: string[]
|
9
|
-
|
10
|
-
constructor(data: { id?: string } & UserQuestionData) {
|
11
|
-
super(data)
|
12
|
-
if (!data.options) {
|
13
|
-
// Default options logic needs to move to creation site
|
14
|
-
// this.options = []
|
15
|
-
}
|
16
|
-
}
|
17
|
-
|
18
|
-
static buildPath(userId: string, id?: string): string {
|
19
|
-
let path = `users/${userId}/questions`
|
20
|
-
return id ? `${path}/${id}` : path
|
21
|
-
}
|
22
|
-
|
23
|
-
getDocPath(): string {
|
24
|
-
if (!this.id) throw new Error('Cannot get document path without an ID')
|
25
|
-
if (!this.userId) throw new Error('Missing userId for doc path')
|
26
|
-
return UserQuestion.buildPath(this.userId, this.id)
|
27
|
-
}
|
28
|
-
|
29
|
-
getColPath(): string {
|
30
|
-
if (!this.userId) throw new Error('Missing userId for col path')
|
31
|
-
return UserQuestion.buildPath(this.userId)
|
32
|
-
}
|
33
|
-
}
|
34
|
-
*/
|
35
|
-
// Add helper path functions (assuming UserQuestionPaths exists)
|
36
|
-
// export const getUserQuestionCollectionPath = (userId: string) => UserQuestionPaths.collection(userId);
|
37
|
-
// export const getUserQuestionDocumentPath = (userId: string, questionId: string) => UserQuestionPaths.document(userId, questionId);
|
package/dist/models/vacancy.d.ts
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
import { BaseModel } from "../BaseModel";
|
2
|
-
export declare namespace Vacancy {
|
3
|
-
/**
|
4
|
-
* Represents a job vacancy
|
5
|
-
*/
|
6
|
-
interface Model extends BaseModel {
|
7
|
-
company: string;
|
8
|
-
position: string;
|
9
|
-
location: string;
|
10
|
-
description: string;
|
11
|
-
advertisingUrl: string;
|
12
|
-
applicationUrl: string;
|
13
|
-
applicationDomain: string;
|
14
|
-
advertisingDomain: string;
|
15
|
-
fullPageText: string;
|
16
|
-
jobId: string;
|
17
|
-
suggestedTo?: string[];
|
18
|
-
}
|
19
|
-
const collection: () => string;
|
20
|
-
const document: (vacancyId: string) => string;
|
21
|
-
const formatSummary: (vacancy: Vacancy.Model) => string;
|
22
|
-
const formatDate: (date: Date | string) => string;
|
23
|
-
const createNew: (company: string, position: string, location: string, description: string, advertisingUrl: string, applicationUrl: string, applicationDomain: string, advertisingDomain: string, fullPageText: string, jobId: string) => Vacancy.Model;
|
24
|
-
}
|
package/dist/models/vacancy.js
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
export var Vacancy;
|
2
|
-
(function (Vacancy) {
|
3
|
-
Vacancy.collection = () => "vacancies";
|
4
|
-
Vacancy.document = (vacancyId) => `vacancies/${vacancyId}`;
|
5
|
-
Vacancy.formatSummary = (vacancy) => {
|
6
|
-
return `${vacancy.position} at ${vacancy.company} (${vacancy.location})`;
|
7
|
-
};
|
8
|
-
Vacancy.formatDate = (date) => {
|
9
|
-
const dateObj = date instanceof Date ? date : new Date(date);
|
10
|
-
return dateObj.toLocaleDateString();
|
11
|
-
};
|
12
|
-
Vacancy.createNew = (company, position, location, description, advertisingUrl, applicationUrl, applicationDomain, advertisingDomain, fullPageText, jobId) => {
|
13
|
-
return {
|
14
|
-
company,
|
15
|
-
position,
|
16
|
-
location,
|
17
|
-
description,
|
18
|
-
advertisingUrl,
|
19
|
-
applicationUrl,
|
20
|
-
applicationDomain,
|
21
|
-
advertisingDomain,
|
22
|
-
fullPageText,
|
23
|
-
jobId,
|
24
|
-
createdAt: new Date().toISOString(),
|
25
|
-
};
|
26
|
-
};
|
27
|
-
})(Vacancy || (Vacancy = {}));
|