Skip to content

Commit 72c5a44

Browse files
authored
Merge pull request #23 from huntflow/INT-663_fix_models
[INT-663] - Fix models.
2 parents 1c4a663 + 5dce8d8 commit 72c5a44

File tree

7 files changed

+85
-5
lines changed

7 files changed

+85
-5
lines changed

Diff for: huntflow_webhook_models/base.py

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ class WebhookMetaInfoBase(BaseModel):
2929
version: str = Field(..., description="Webhook version", examples=["2.0"])
3030
retry: int = Field(..., description="Webhook retry count", examples=[1])
3131
event_id: str = Field(..., description="Event ID", examples=["1"])
32+
domain: str = Field(..., description="Domain", examples=["huntflow.ai"])
3233

3334

3435
class BaseHuntflowWebhookRequest(BaseModel):

Diff for: huntflow_webhook_models/common_models/applicant.py

+30-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from pydantic import BaseModel, Field
55

66
from huntflow_webhook_models.common_models.calendar_event import ApplicantLogCalendarEvent
7-
from huntflow_webhook_models.common_models.hf_base import AccountFile
7+
from huntflow_webhook_models.common_models.hf_base import AccountFile, VacancyQuotaItem
88
from huntflow_webhook_models.common_models.survey_questionary import SurveyQuestionary
99
from huntflow_webhook_models.common_models.vacancy import Vacancy
1010
from huntflow_webhook_models.consts import AgreementState, ApplicantLogType, SurveyType
@@ -37,13 +37,35 @@ class ApplicantPDAgreement(BaseModel):
3737

3838
class VacancyApplicantStatus(BaseModel):
3939
id: int = Field(..., description="Status ID", examples=[1])
40-
name: str = Field(..., description="Status name", examples=["hired"])
4140

4241

4342
class ApplicantPhoto(AccountFile):
4443
pass
4544

4645

46+
class ApplicantExternalAccountSource(BaseModel):
47+
id: int = Field(..., description="Applicant external account source ID", examples=[1])
48+
name: Optional[str] = Field(
49+
...,
50+
description="Applicant external account source name",
51+
examples=["Headhunter"],
52+
)
53+
54+
55+
class ApplicantExternalAccount(BaseModel):
56+
id: int = Field(..., description="External ID", examples=[1])
57+
auth_type: str = Field(..., description="Authentication type", examples=["NATIVE"])
58+
account_source: Optional[ApplicantExternalAccountSource] = Field(
59+
None,
60+
description="Applicant external account source",
61+
)
62+
updated: Optional[datetime] = Field(
63+
None,
64+
description="Date the applicant external account was modified",
65+
examples=[datetime(1970, 1, 1, 1, 1, 1)],
66+
)
67+
68+
4769
class Applicant(BaseModel):
4870
id: int = Field(..., description="Applicant ID", examples=[1])
4971
email: Optional[str] = Field(
@@ -81,6 +103,7 @@ class Applicant(BaseModel):
81103
phone: Optional[str] = Field(None, description="Applicant's phone", examples=["+99999999"])
82104
skype: Optional[str] = Field(None, description="Applicant's skype", examples=["test_skype"])
83105
photo: Optional[ApplicantPhoto] = Field(None, description="Applicant's photo")
106+
has_photo: bool = Field(..., description="Does the applicant have a photo?", examples=[False])
84107
social: List[ApplicantSocial] = Field([], description="Applicant social media list")
85108
questionary: Optional[datetime] = Field(
86109
None,
@@ -96,6 +119,7 @@ class Applicant(BaseModel):
96119
description="Additional fields",
97120
examples=[{"favorite_language": "python"}],
98121
)
122+
externals: Optional[List[ApplicantExternalAccount]] = None
99123

100124

101125
class Respondent(BaseModel):
@@ -191,6 +215,10 @@ class ApplicantLog(BaseModel):
191215
description="Calendar event data",
192216
)
193217
vacancy: Optional[Vacancy] = Field(None, description="Vacancy data")
218+
hired_in_fill_quota: Optional[VacancyQuotaItem] = Field(
219+
None,
220+
description="Quota data by which applicant was hired",
221+
)
194222

195223

196224
class ApplicantTag(BaseModel):

Diff for: huntflow_webhook_models/common_models/hf_base.py

+31
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from datetime import date, datetime
12
from typing import Optional
23

34
from pydantic import BaseModel, Field
@@ -29,3 +30,33 @@ class AccountSource(BaseModel):
2930
)
3031
name: str = Field(..., description="Applicant source name", examples=["Headhunter"])
3132
type: str = Field(..., description="Applicant source type", examples=["user"])
33+
34+
35+
class VacancyQuotaBase(BaseModel):
36+
id: int = Field(..., description="Fill quota ID")
37+
vacancy_frame: int = Field(..., description="Vacancy frame ID")
38+
vacancy_request: Optional[int] = Field(None, description="Vacancy request ID")
39+
created: datetime = Field(..., description="Date and time of creating a vacancy quota")
40+
changed: Optional[datetime] = Field(
41+
None,
42+
description="Date and time of updating a vacancy quota",
43+
)
44+
applicants_to_hire: int = Field(
45+
...,
46+
description="Number of applicants should be hired on the quota",
47+
)
48+
already_hired: int = Field(..., description="Number of applicants already hired on the quota")
49+
deadline: Optional[date] = Field(None, description="Date when the quota should be filled")
50+
closed: Optional[datetime] = Field(None, description="Date and time when the quota was closed")
51+
work_days_in_work: Optional[int] = Field(
52+
None,
53+
description="How many working days the vacancy is in work",
54+
)
55+
work_days_after_deadline: Optional[int] = Field(
56+
None,
57+
description="How many working days the vacancy is in work after deadline",
58+
)
59+
60+
61+
class VacancyQuotaItem(VacancyQuotaBase):
62+
account_info: AccountInfo

Diff for: huntflow_webhook_models/common_models/recruitment_evaluation.py

+1
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,4 @@ class RecruitmentEvaluation(BaseModel):
2525
stars: Optional[int] = Field(None, description="Evaluation level", examples=[10])
2626
applicant: Applicant = Field(..., description="Applicant data")
2727
vacancy: Vacancy = Field(..., description="Vacancy data")
28+
applicant_log_id: int = Field(..., description="Applicant log ID")

Diff for: huntflow_webhook_models/common_models/survey_answer.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class SurveyAnswerRespondent(BaseModel):
2020

2121
class SurveyAnswerRequest(BaseModel):
2222
id: int = Field(..., description="Recruitment evaluation request ID", examples=[1])
23-
respondent: SurveyAnswerRespondent
23+
respondent: Optional[SurveyAnswerRespondent] = None
2424
created: datetime = Field(
2525
...,
2626
description="Date of creation",

Diff for: huntflow_webhook_models/common_models/vacancy.py

+20-1
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,16 @@ class Vacancy(BaseModel):
9595
)
9696

9797

98+
class VacancyCloseReason(BaseModel):
99+
id: int = Field(..., description="Vacancy close reason ID", examples=[1])
100+
name: str = Field(..., description="Vacancy close reason name", examples=["All hired"])
101+
102+
103+
class VacancyHoldReason(BaseModel):
104+
id: int = Field(..., description="Vacancy hold reason ID", examples=[1])
105+
name: str = Field(..., description="Vacancy hold reason name", examples=["Cancel budget"])
106+
107+
98108
class VacancyLog(BaseModel):
99109
id: int = Field(..., description="Vacancy log ID", examples=[1])
100110
state: VacancyState = Field(
@@ -107,4 +117,13 @@ class VacancyLog(BaseModel):
107117
description="Date time the vacancy log created",
108118
examples=[datetime(1970, 1, 1, 1, 1, 1)],
109119
)
110-
# TODO: Solve close reason field problem (field exists with another name)
120+
close_reason: Optional[VacancyCloseReason] = Field(
121+
None,
122+
description="Vacancy close reason",
123+
examples=[""],
124+
)
125+
hold_reason: Optional[VacancyHoldReason] = Field(
126+
None,
127+
description="Vacancy hold reason",
128+
examples=[""],
129+
)

Diff for: pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
[project]
33
name = "huntflow-webhook-models"
4-
version = "0.1.7"
4+
version = "0.1.8"
55
description = "Huntflow webhooks requests data models"
66
authors = [
77
{name = "Developers huntflow", email = "[email protected]"},

0 commit comments

Comments
 (0)