@jobsearch-works/firestore-models 1.0.1 → 1.0.3
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 +167 -3
- package/dist/index.d.ts +10 -0
- package/dist/index.js +12 -0
- package/package.json +1 -1
package/README.md
CHANGED
@@ -24,22 +24,186 @@ npm install @jsw/firestore-models
|
|
24
24
|
yarn add @jsw/firestore-models
|
25
25
|
```
|
26
26
|
|
27
|
+
## Project Structure
|
28
|
+
|
29
|
+
```
|
30
|
+
firestore-models/
|
31
|
+
├── src/
|
32
|
+
│ ├── models/ # All Firestore models
|
33
|
+
│ │ ├── Application.ts
|
34
|
+
│ │ ├── AuthUser.ts
|
35
|
+
│ │ ├── Client.ts
|
36
|
+
│ │ ├── ClientData.ts
|
37
|
+
│ │ ├── ClientLogin.ts
|
38
|
+
│ │ ├── Question.ts
|
39
|
+
│ │ ├── UserQuestion.ts
|
40
|
+
│ │ ├── Vacancy.ts
|
41
|
+
│ │ └── VacancySuggestion.ts
|
42
|
+
│ ├── BaseModel.ts # Base interface for all models
|
43
|
+
│ └── index.ts # Main entry point
|
44
|
+
├── dist/ # Compiled output
|
45
|
+
└── package.json
|
46
|
+
```
|
47
|
+
|
48
|
+
## Models
|
49
|
+
|
50
|
+
### Client
|
51
|
+
|
52
|
+
```typescript
|
53
|
+
interface Client {
|
54
|
+
name: string;
|
55
|
+
email: string;
|
56
|
+
status: "active" | "inactive";
|
57
|
+
resume?: string;
|
58
|
+
createdAt: string;
|
59
|
+
updatedAt?: string;
|
60
|
+
}
|
61
|
+
```
|
62
|
+
|
63
|
+
### Application
|
64
|
+
|
65
|
+
```typescript
|
66
|
+
interface Application {
|
67
|
+
vacancyId: string;
|
68
|
+
clientId: string;
|
69
|
+
status:
|
70
|
+
| "new"
|
71
|
+
| "submitted"
|
72
|
+
| "interviewing"
|
73
|
+
| "accepted"
|
74
|
+
| "rejected"
|
75
|
+
| "withdrawn"
|
76
|
+
| "applying"
|
77
|
+
| "suggested"
|
78
|
+
| "approved";
|
79
|
+
coverLetter?: string;
|
80
|
+
resume?: string;
|
81
|
+
// Denormalized fields from Vacancy
|
82
|
+
company?: string;
|
83
|
+
position?: string;
|
84
|
+
location?: string;
|
85
|
+
jobId?: string;
|
86
|
+
advertisingUrl?: string;
|
87
|
+
applicationUrl?: string;
|
88
|
+
applicationDomain?: string;
|
89
|
+
advertisingDomain?: string;
|
90
|
+
description?: string;
|
91
|
+
fullPageText?: string;
|
92
|
+
createdAt: string;
|
93
|
+
updatedAt?: string;
|
94
|
+
}
|
95
|
+
```
|
96
|
+
|
97
|
+
### AuthUser
|
98
|
+
|
99
|
+
```typescript
|
100
|
+
interface AuthUser {
|
101
|
+
email: string;
|
102
|
+
role: "admin" | "client";
|
103
|
+
clientId?: string; // Required if role is "client"
|
104
|
+
createdAt: string;
|
105
|
+
updatedAt?: string;
|
106
|
+
}
|
107
|
+
```
|
108
|
+
|
109
|
+
### Vacancy
|
110
|
+
|
111
|
+
```typescript
|
112
|
+
interface Vacancy {
|
113
|
+
company: string;
|
114
|
+
position: string;
|
115
|
+
location: string;
|
116
|
+
jobId: string;
|
117
|
+
advertisingUrl: string;
|
118
|
+
applicationUrl: string;
|
119
|
+
applicationDomain: string;
|
120
|
+
advertisingDomain: string;
|
121
|
+
description: string;
|
122
|
+
fullPageText: string;
|
123
|
+
status: "active" | "inactive";
|
124
|
+
createdAt: string;
|
125
|
+
updatedAt?: string;
|
126
|
+
}
|
127
|
+
```
|
128
|
+
|
129
|
+
### Question
|
130
|
+
|
131
|
+
```typescript
|
132
|
+
interface Question {
|
133
|
+
text: string;
|
134
|
+
type: "text" | "multiple_choice" | "single_choice";
|
135
|
+
options?: string[];
|
136
|
+
required: boolean;
|
137
|
+
order: number;
|
138
|
+
createdAt: string;
|
139
|
+
updatedAt?: string;
|
140
|
+
}
|
141
|
+
```
|
142
|
+
|
143
|
+
### UserQuestion
|
144
|
+
|
145
|
+
```typescript
|
146
|
+
interface UserQuestion {
|
147
|
+
clientId: string;
|
148
|
+
questionId: string;
|
149
|
+
answer: string;
|
150
|
+
createdAt: string;
|
151
|
+
updatedAt?: string;
|
152
|
+
}
|
153
|
+
```
|
154
|
+
|
155
|
+
### ClientData
|
156
|
+
|
157
|
+
```typescript
|
158
|
+
interface ClientData {
|
159
|
+
clientId: string;
|
160
|
+
key: string;
|
161
|
+
value: any;
|
162
|
+
createdAt: string;
|
163
|
+
updatedAt?: string;
|
164
|
+
}
|
165
|
+
```
|
166
|
+
|
167
|
+
### ClientLogin
|
168
|
+
|
169
|
+
```typescript
|
170
|
+
interface ClientLogin {
|
171
|
+
clientId: string;
|
172
|
+
ipAddress: string;
|
173
|
+
userAgent: string;
|
174
|
+
createdAt: string;
|
175
|
+
}
|
176
|
+
```
|
177
|
+
|
178
|
+
### VacancySuggestion
|
179
|
+
|
180
|
+
```typescript
|
181
|
+
interface VacancySuggestion {
|
182
|
+
clientId: string;
|
183
|
+
vacancyId: string;
|
184
|
+
status: "pending" | "accepted" | "rejected";
|
185
|
+
createdAt: string;
|
186
|
+
updatedAt?: string;
|
187
|
+
}
|
188
|
+
```
|
189
|
+
|
27
190
|
## Usage
|
28
191
|
|
29
192
|
Import the models and path builders in your application:
|
30
193
|
|
31
194
|
```typescript
|
32
|
-
import {
|
195
|
+
import { Client, clientPath } from "@jsw/firestore-models";
|
33
196
|
|
34
197
|
// Use the type-safe model
|
35
|
-
const
|
198
|
+
const client: Client.Model = {
|
36
199
|
id: "123",
|
37
200
|
name: "John Doe",
|
38
201
|
email: "john@example.com",
|
202
|
+
status: "active",
|
39
203
|
};
|
40
204
|
|
41
205
|
// Use the path builder
|
42
|
-
const
|
206
|
+
const clientDocPath = clientPath("123"); // returns 'clients/123'
|
43
207
|
```
|
44
208
|
|
45
209
|
## Contributing
|
package/dist/index.d.ts
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
export * from "./BaseModel";
|
2
|
+
export * from "./models/Application";
|
3
|
+
export * from "./models/AuthUser";
|
4
|
+
export * from "./models/Client";
|
5
|
+
export * from "./models/ClientData";
|
6
|
+
export * from "./models/ClientLogin";
|
7
|
+
export * from "./models/Question";
|
8
|
+
export * from "./models/UserQuestion";
|
9
|
+
export * from "./models/Vacancy";
|
10
|
+
export * from "./models/VacancySuggestion";
|
package/dist/index.js
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
// Re-export base model
|
2
|
+
export * from "./BaseModel";
|
3
|
+
// Re-export all models
|
4
|
+
export * from "./models/Application";
|
5
|
+
export * from "./models/AuthUser";
|
6
|
+
export * from "./models/Client";
|
7
|
+
export * from "./models/ClientData";
|
8
|
+
export * from "./models/ClientLogin";
|
9
|
+
export * from "./models/Question";
|
10
|
+
export * from "./models/UserQuestion";
|
11
|
+
export * from "./models/Vacancy";
|
12
|
+
export * from "./models/VacancySuggestion";
|
package/package.json
CHANGED