Skip to content

Commit 621d1a3

Browse files
authored
Merge pull request #7 from huntflow/INT-196_add_vacancy_request_hook_model
Int 196 add vacancy request hook model
2 parents 06cffda + 9145625 commit 621d1a3

File tree

4 files changed

+66
-0
lines changed

4 files changed

+66
-0
lines changed

huntflow_webhook_models/__init__.py

+4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
from . import consts
22
from .applicant import ApplicantHookRequest
3+
from .vacancy import VacancyHookRequest
4+
from .vacancy_request import VacancyRequestHookRequest
35

46
__all__ = [
57
"consts",
68
"ApplicantHookRequest",
9+
"VacancyHookRequest",
10+
"VacancyRequestHookRequest",
711
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import datetime
2+
from typing import Any, Dict
3+
4+
from pydantic import BaseModel, Field
5+
6+
from huntflow_webhook_models.consts import VacancyRequestLogAction
7+
8+
9+
class VacancyRequest(BaseModel):
10+
id: int = Field(..., description="Vacancy request ID", example=1)
11+
account_vacancy_request: int = Field(..., description="Account vacancy request ID", example=1)
12+
created: datetime.datetime = Field(
13+
...,
14+
description="Date time vacancy request created",
15+
example=datetime.datetime(1970, 1, 1, 1, 1, 1),
16+
)
17+
position: str = Field(..., description="Vacancy position", example="Developer")
18+
values: Dict[str, Any] = Field(
19+
...,
20+
description="Vacancy request fields",
21+
example={"company": "test_company"},
22+
)
23+
24+
25+
class VacancyRequestLog(BaseModel):
26+
id: int = Field(..., description="Vacancy request log ID", example=1)
27+
action: VacancyRequestLogAction = Field(
28+
...,
29+
description="Vacancy request log action",
30+
example=VacancyRequestLogAction.CREATE,
31+
)
32+
created: datetime.datetime = Field(
33+
...,
34+
description="Date time vacancy request log created",
35+
example=datetime.datetime(1970, 1, 1, 1, 1, 1),
36+
)

huntflow_webhook_models/consts.py

+7
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,13 @@ class VacancyState(str, Enum):
6262
JOIN = "JOIN"
6363

6464

65+
class VacancyRequestLogAction(str, Enum):
66+
CREATE = "CREATE"
67+
EDIT = "EDIT"
68+
REMOVE = "REMOVE"
69+
MIGRATE = "MIGRATE"
70+
71+
6572
class CalendarEventStatus(str, Enum):
6673
accepted = "accepted"
6774
declined = "declined"
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from pydantic import BaseModel
2+
3+
from huntflow_webhook_models.base import BaseHuntflowWebhookRequest, WebhookMetaInfoBase
4+
from huntflow_webhook_models.common_models.vacancy_request import VacancyRequest, VacancyRequestLog
5+
from huntflow_webhook_models.consts import CommonWebhookActionType
6+
7+
8+
class VacancyRequestHookRequestMeta(WebhookMetaInfoBase):
9+
webhook_action: CommonWebhookActionType
10+
11+
12+
class VacancyRequestEvent(BaseModel):
13+
vacancy_request: VacancyRequest
14+
vacancy_request_log: VacancyRequestLog
15+
16+
17+
class VacancyRequestHookRequest(BaseHuntflowWebhookRequest):
18+
event: VacancyRequestEvent
19+
meta: VacancyRequestHookRequestMeta

0 commit comments

Comments
 (0)