Skip to content

Commit 492454b

Browse files
authored
Merge pull request #9 from huntflow/INT-222_create_Response_model
[INT-222] - Create ResponseHookRequest.
2 parents cf5d874 + 751f4b8 commit 492454b

File tree

5 files changed

+430
-1
lines changed

5 files changed

+430
-1
lines changed

huntflow_webhook_models/common_models/hf_base.py

+11
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,14 @@ class AccountInfo(BaseModel):
1414
id: int = Field(..., description="Account ID", example=1)
1515
name: str = Field(..., description="Account owner name", example="John")
1616
email: Optional[str] = Field(..., description="Account owner email", example="[email protected]")
17+
18+
19+
class AccountSource(BaseModel):
20+
id: int = Field(..., description="Resume source ID", example=1)
21+
foreign: Optional[str] = Field(
22+
None,
23+
description="Applicant source foreign",
24+
example="f2",
25+
)
26+
name: str = Field(..., description="Applicant source name", example="Headhunter")
27+
type: str = Field(..., description="Applicant source type", example="user")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,376 @@
1+
from datetime import datetime
2+
from typing import Any, List, Optional, Union
3+
4+
from pydantic.fields import Field
5+
from pydantic.main import BaseModel
6+
7+
from huntflow_webhook_models.common_models.hf_base import AccountSource
8+
from huntflow_webhook_models.common_models.vacancy import Vacancy
9+
from huntflow_webhook_models.consts import (
10+
ApplicantResponseExternalStatus,
11+
PrecisionTypes,
12+
VacancyExternalPublishStatus,
13+
)
14+
15+
16+
class PhotoData(BaseModel):
17+
small: Optional[str] = Field(
18+
None,
19+
description="Small image url",
20+
example="https://example.com/image_small.png",
21+
)
22+
medium: Optional[str] = Field(
23+
None,
24+
description="Medium image url",
25+
example="https://example.com/image_medium.png",
26+
)
27+
large: Optional[str] = Field(
28+
None,
29+
description="Large image url",
30+
example="https://example.com/image_large.png",
31+
)
32+
external_id: Optional[str] = Field(None, description="Photo external ID", example="12")
33+
description: Optional[str] = Field(
34+
None,
35+
description="Photo description",
36+
example="Applicant's photo",
37+
)
38+
source: Optional[str] = Field(
39+
None,
40+
description="Photo's source url",
41+
example="https://example.com/photo_source.png",
42+
)
43+
id: Optional[int] = Field(None, description="Huntflow photo ID", example=10)
44+
45+
46+
class DateWithPrecision(BaseModel):
47+
year: Optional[int] = Field(None, description="Year", example=2021)
48+
month: Optional[int] = Field(None, description="Month", example=12)
49+
day: Optional[int] = Field(None, description="Day", example=12)
50+
precision: PrecisionTypes = Field(..., description="Precision type", example=PrecisionTypes.day)
51+
52+
53+
class TextBlock(BaseModel):
54+
header: Optional[str] = Field(None, description="Text block header", example="About header")
55+
body: Optional[str] = Field(None, description="Text block body", example="About body")
56+
57+
58+
class PersonalInfo(BaseModel):
59+
photo: Optional[PhotoData] = Field(None, description="Urls for resume photo")
60+
first_name: Optional[str] = Field(None, description="First name", example="John")
61+
middle_name: Optional[str] = Field(None, description="Middle name", example="Abraham")
62+
last_name: Optional[str] = Field(None, description="Last name", example="Doe")
63+
birth_date: Optional[DateWithPrecision] = Field(None, description="Date of birth")
64+
text_block: Optional[TextBlock] = Field(None, description='Additional "About" info')
65+
66+
67+
class ExternalEntity(BaseModel):
68+
id: Optional[Union[int, str]] = Field(None, description="Entity ID in Huntflow system")
69+
external_id: Optional[str] = Field(None, description="Entity external ID")
70+
name: Optional[str] = Field(None, description="Entity name")
71+
72+
73+
class Specialization(ExternalEntity):
74+
profarea_id: Optional[str] = Field(
75+
None,
76+
description="Specialization ID in Huntflow system",
77+
example="10",
78+
)
79+
external_profarea_id: Optional[str] = Field(
80+
None,
81+
description="Specialization external ID",
82+
example="external_10",
83+
)
84+
prefarea_name: Optional[str] = Field(None, description="Specialization name", example="Sales")
85+
86+
87+
class Area(BaseModel):
88+
country: Optional[ExternalEntity] = Field(None, description="Country")
89+
city: Optional[ExternalEntity] = Field(None, description="City")
90+
metro: Optional[ExternalEntity] = Field(None, description="Metro station")
91+
address: Optional[str] = Field(None, description="Full address", example="Washington DC")
92+
lat: Optional[float] = Field(None, description="Latitude", example=38.8951)
93+
lng: Optional[float] = Field(None, description="Longitude", example=-77.0364)
94+
95+
96+
class Skill(BaseModel):
97+
title: str = Field(..., description="Skill name", example="English language")
98+
99+
100+
class Experience(BaseModel):
101+
position: Optional[str] = Field(None, description="Position", example="Manager")
102+
date_from: Optional[DateWithPrecision] = Field(None, description="Experience start date")
103+
date_to: Optional[DateWithPrecision] = Field(None, description="Experience end date")
104+
company: Optional[str] = Field(None, description="Company name", example="Company")
105+
url: Optional[str] = Field(None, description="Company's url", example="https://example.com")
106+
area: Optional[Area] = Field(None, description="Experience area")
107+
industries: Optional[List[ExternalEntity]] = Field(
108+
None,
109+
description="List of experience industries",
110+
)
111+
description: Optional[str] = Field(
112+
None,
113+
description="Experience description",
114+
example="I worked as a manager",
115+
)
116+
skills: Optional[List[Skill]] = Field(None, description="List of skills")
117+
118+
119+
class BaseEducationInfo(BaseModel):
120+
name: Optional[str] = Field(None, description="Education name", example="Higher")
121+
description: Optional[str] = Field(
122+
None,
123+
description="Education description",
124+
example="I have a higher education",
125+
)
126+
date_from: Optional[DateWithPrecision] = Field(None, description="Education start date")
127+
date_to: Optional[DateWithPrecision] = Field(None, description="Education end date")
128+
area: Optional[Area] = Field(None, description="Education area")
129+
130+
131+
class EducationInfoWithResult(BaseEducationInfo):
132+
result: Optional[str] = Field(None, description="Education result", example="Completed")
133+
134+
135+
class ExtendedEducationInfo(BaseEducationInfo):
136+
faculty: Optional[str] = Field(None, description="Faculty name", example="Mathematics")
137+
form: Optional[ExternalEntity]
138+
139+
140+
class Attestation(BaseModel):
141+
date: Optional[DateWithPrecision]
142+
name: Optional[str]
143+
organization: Optional[str]
144+
description: Optional[str]
145+
result: Optional[str]
146+
147+
148+
class Education(BaseModel):
149+
level: Optional[ExternalEntity] = Field(None, description="Education level")
150+
higher: Optional[List[ExtendedEducationInfo]] = Field(
151+
None,
152+
description="List of higher education institutions",
153+
)
154+
vocational: Optional[List[ExtendedEducationInfo]] = Field(
155+
None,
156+
description="List of vocational education institutions",
157+
)
158+
elementary: Optional[List[BaseEducationInfo]] = Field(
159+
None,
160+
description="List of elementary education institutions",
161+
)
162+
additional: Optional[List[EducationInfoWithResult]] = Field(
163+
None,
164+
description="List of additional education institutions",
165+
)
166+
attestation: Optional[List[Attestation]] = Field(None, description="List of attestations")
167+
168+
169+
class Certificate(BaseModel):
170+
name: Optional[str] = Field(None, description="Name of certificate", example="Certificate")
171+
organization: Optional[str] = Field(
172+
None,
173+
description="The organization that issued the certificate",
174+
example="Certificate organnization",
175+
)
176+
description: Optional[str] = Field(
177+
None,
178+
description="Certificate description",
179+
example="Certificate for John Doe",
180+
)
181+
url: Optional[str] = Field(
182+
None,
183+
description="Certificate url",
184+
example="https://example.com/certificate_john_doe.pdf",
185+
)
186+
area: Optional[Area] = Field(None, description="Area of issue of the certificate")
187+
date: Optional[DateWithPrecision] = Field(None, description="Date of issue of the certificate")
188+
189+
190+
class ContactPhone(BaseModel):
191+
country: str = Field()
192+
city: str = Field()
193+
number: str = Field()
194+
formatted: str = Field()
195+
196+
197+
class Contact(BaseModel):
198+
type: Optional[ExternalEntity] = Field(None, description="Contact type")
199+
value: Optional[str] = Field(None, description="Contact value", example="89999999999")
200+
preferred: Optional[bool] = Field(
201+
None,
202+
description="This is the preferred method of communication",
203+
example="true",
204+
)
205+
full_value: Optional[ContactPhone] = Field(
206+
None,
207+
description="If contact is a phone number - additional data about it",
208+
)
209+
210+
211+
class Relocation(BaseModel):
212+
type: Optional[ExternalEntity] = Field(None, description="Type of relocation")
213+
area: Optional[List[Area]] = Field(None, description="List of areas for relocation")
214+
215+
216+
class Language(ExternalEntity):
217+
level: Optional[ExternalEntity] = Field(None, description="Language proficiency level")
218+
219+
220+
class Military(BaseModel):
221+
date_from: Optional[DateWithPrecision] = Field(None, description="Military service start date")
222+
date_to: Optional[DateWithPrecision] = Field(None, description="Military service end date")
223+
area: Optional[Area] = Field(None, description="Military service area")
224+
unit: Optional[dict] = Field(
225+
None,
226+
description="Military service unit",
227+
example={"name": "Infantry", "external_id": 3336026},
228+
)
229+
230+
231+
class SocialRating(BaseModel):
232+
kind: Optional[str]
233+
stats: Optional[Any]
234+
tags: Optional[List[str]]
235+
url: Optional[str]
236+
login: Optional[str]
237+
registered_at: Optional[str] = Field(None, description="ISO datetime")
238+
239+
240+
class Salary(BaseModel):
241+
amount: Optional[float] = Field(None, description="Salary amount")
242+
currency: Optional[str] = Field(None, description="Salary currency")
243+
244+
245+
class Recommendation(BaseModel):
246+
value: Optional[str] = Field(None, description="Recommendation")
247+
date: Optional[DateWithPrecision] = Field(None, description="Date of recommendation")
248+
name: Optional[str] = Field(None, description="Name to whom recommendation")
249+
position: Optional[str] = Field(None, description="Position", example="Manager")
250+
organization: Optional[str] = Field(
251+
None,
252+
description="Organization name",
253+
example="Test organization",
254+
)
255+
contact: Optional[str] = Field(None, description="Contact", example="89999999999")
256+
257+
258+
class SimplePhoto(BaseModel):
259+
url: Optional[str] = Field(None, description="Photo url")
260+
original: Optional[str] = Field(None, description="Photo original")
261+
262+
263+
class Additional(BaseModel):
264+
name: Optional[str] = Field(None, description="Name of additional info")
265+
description: Optional[str] = Field(None, description="Description of additional info")
266+
267+
268+
class Resume(BaseModel):
269+
personal_info: Optional[PersonalInfo] = Field(None, description="Personal info")
270+
source_url: Optional[str] = Field(
271+
None,
272+
description="Resume url to external job site",
273+
example="https://example.com/resume",
274+
)
275+
position: Optional[str] = Field(None, description="Resume header", example="Manager")
276+
specialization: Optional[List[Specialization]] = Field(None, description="Specializations")
277+
skill_set: Optional[List[str]] = Field(
278+
None,
279+
description="List of skills",
280+
example=["English language"],
281+
)
282+
gender: Optional[ExternalEntity] = Field(None, description="Gender")
283+
experience: Optional[List[Experience]] = Field(None, description="Work experiences")
284+
education: Optional[Education] = Field(None, description="Education")
285+
certificate: Optional[List[Certificate]] = Field(None, description="Certificates")
286+
portfolio: Optional[List[PhotoData]] = Field(None, description="Portfolio")
287+
contact: Optional[List[Contact]] = Field(None, description="List of contacts")
288+
area: Optional[Area] = Field(None, description="Living area")
289+
relocation: Optional[Relocation] = Field(None, description="Relocation info")
290+
citizenship: Optional[List[ExternalEntity]] = Field(None, description="Citizenship")
291+
work_permit: Optional[List[ExternalEntity]] = Field(
292+
None,
293+
description="List of countries with work permission",
294+
)
295+
language: Optional[List[Language]] = Field(None, description="Language proficiency")
296+
wanted_salary: Optional[Salary] = Field(None, description="Desired salary")
297+
work_schedule: Optional[List[ExternalEntity]] = Field(None, description="Work schedules")
298+
business_trip_readiness: Optional[ExternalEntity] = Field(
299+
None,
300+
description="Readiness for business trips",
301+
)
302+
recommendations: Optional[List[Recommendation]] = Field(
303+
None,
304+
description="List of recommendations",
305+
)
306+
has_vehicle: Optional[bool] = Field(None, description="Ownership of vehicle", example="false")
307+
driver_license_types: Optional[List[str]] = Field(
308+
None,
309+
description="List of available driver's licenses",
310+
example=["A1", "B1"],
311+
)
312+
military: Optional[List[Military]] = Field(None, description="Military service")
313+
social_ratings: Optional[List[SocialRating]] = Field(None, description="Social ratings")
314+
photos: Optional[List[SimplePhoto]] = Field(None, description="Photos")
315+
additionals: Optional[List[Additional]] = Field(
316+
None,
317+
description="Some additional info related to resume",
318+
)
319+
wanted_place_of_work: Optional[str] = Field(
320+
None,
321+
description="Desired place of work",
322+
example="New York",
323+
)
324+
updated_on_source: Optional[DateWithPrecision] = Field(
325+
None,
326+
description="Date of resume update in the source",
327+
)
328+
travel_time: Optional[ExternalEntity] = Field(None, description="Preferred travel time")
329+
330+
331+
class ApplicantExternalResponse(BaseModel):
332+
id: int = Field(..., description="Applicant source ID", example=1)
333+
created: datetime = Field(
334+
...,
335+
description="The datetime when the response was stored in the database",
336+
example=datetime(1970, 1, 1, 1, 1, 1),
337+
)
338+
foreign: str = Field(..., description="Foreign applicant external ID", example="external-9-23")
339+
resume: Optional[Resume] = Field(None, description="Applicant resume")
340+
state: Optional[ApplicantResponseExternalStatus] = Field(
341+
None,
342+
description="Response state",
343+
example=ApplicantResponseExternalStatus.TAKEN,
344+
)
345+
updated: datetime = Field(
346+
...,
347+
description="Datetime of response creation/update on the career site",
348+
example=datetime(1980, 1, 1, 1, 1, 1),
349+
)
350+
351+
352+
class AccountVacancyExternal(BaseModel):
353+
id: int = Field(..., description="Account vacancy external ID", example=1)
354+
account_source: AccountSource = Field(..., description="Vacancy account source")
355+
auth_type: str = Field(..., description="Authentication type", example="NATIVE")
356+
name: str = Field(..., description="Account vacancy external name", example="HeadHunter")
357+
358+
359+
class VacancyExternal(BaseModel):
360+
id: int = Field(..., description="Vacancy external ID", example=1)
361+
account_vacancy_external: AccountVacancyExternal = Field(
362+
...,
363+
description="Account vacancy external",
364+
)
365+
data: str = Field(
366+
...,
367+
description="Additional data",
368+
example="comment",
369+
)
370+
foreign: str = Field(..., description="Foreign vacancy external ID", example="12345")
371+
state: Optional[VacancyExternalPublishStatus] = Field(
372+
None,
373+
description="Vacancy external publish status",
374+
example=VacancyExternalPublishStatus.PUBLISHED,
375+
)
376+
vacancy: Vacancy = Field(..., description="Vacancy data")

0 commit comments

Comments
 (0)