-
Notifications
You must be signed in to change notification settings - Fork 1
[INT-950] recommendation entity #102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
6cca4e0
tmp
KlochkovHF bd8d98d
implemented
KlochkovHF a72e831
Merge branch 'v2' into INT-950
KlochkovHF 0b016c4
fix error
KlochkovHF 2384f15
codestyle
KlochkovHF c1cae43
fix error
KlochkovHF 9a1b5c4
fix by comments
KlochkovHF File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| from typing import Dict, Optional, Union | ||
|
|
||
| from huntflow_api_client.entities.base import BaseEntity, ListEntityMixin | ||
| from huntflow_api_client.models.consts import RecommendationProcessingStatus | ||
| from huntflow_api_client.models.response.recommendation import RecommendationListResponse | ||
|
|
||
|
|
||
| class Recommendation(BaseEntity, ListEntityMixin): | ||
| async def list( | ||
| self, | ||
| account_id: int, | ||
| vacancy_id: int, | ||
| count: int = 30, | ||
| processing_status: RecommendationProcessingStatus = RecommendationProcessingStatus.ALL, | ||
| next_page_cursor: Optional[str] = None, | ||
| ) -> RecommendationListResponse: | ||
| """ | ||
| API method reference | ||
| https://api.huntflow.ai/v2/docs#get-/accounts/-account_id-/recommendations/-vacancy_id- | ||
|
|
||
| :param account_id: Organization ID | ||
| :param vacancy_id: Vacancy ID | ||
| :param count: Number of items per page | ||
| :param next_page_cursor: Next page cursor | ||
| :param processing_status: Get all recommendations or processed/unprocessed only | ||
| :return: A list of applicants recommended for a vacancy | ||
| """ | ||
| params: Dict[str, Union[str, int]] | ||
| if next_page_cursor is not None: | ||
| params = {"next_page_cursor": next_page_cursor} | ||
| else: | ||
| params = {"count": count} | ||
| params["processing_status"] = processing_status.value | ||
|
|
||
| response = await self._api.request( | ||
| "GET", | ||
| f"/accounts/{account_id}/recommendations/{vacancy_id}", | ||
| params=params, | ||
| ) | ||
| return RecommendationListResponse.model_validate(response.json()) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| from datetime import datetime | ||
| from typing import List, Optional | ||
|
|
||
| from pydantic import BaseModel, Field | ||
|
|
||
| from huntflow_api_client.models.consts import RecommendationStatus | ||
|
|
||
|
|
||
| class RecommendationItem(BaseModel): | ||
| id: int = Field(..., description="Recommendation ID") | ||
| vacancy_id: int = Field(..., description="Vacancy ID") | ||
| applicant_id: int = Field(..., description="Applicant ID") | ||
| rank: int = Field(..., description="Position of the recommendation in the ranking list.") | ||
| created_at: datetime = Field( | ||
| ..., | ||
| description="Date and time when the recommendation was created.", | ||
| ) | ||
| updated_at: datetime = Field( | ||
| ..., | ||
| description="Date and time when the recommendation was last updated.", | ||
| ) | ||
| resolved_by_user: Optional[int] = Field( | ||
| None, | ||
| description="ID of the recruiter who resolved recommendation. null if not processed yet.", | ||
| ) | ||
| status: Optional[RecommendationStatus] = Field( | ||
| None, | ||
| description="Current status of the recommendation. null if not processed yet.", | ||
| ) | ||
|
|
||
|
|
||
| class RecommendationListResponse(BaseModel): | ||
| items: List[RecommendationItem] | ||
| next_page_cursor: Optional[str] = None |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Сейчас логика с params раздвоена
при передаче next_page_cursor игнорируются count и processing_status
Это норм?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ты прав, по коду сервиса рекомендаций параметр processing_status в любом случае принимается, игнорится только count если есть курсор
recommendation_service/recommendation_service/api/views/recommendation.py:59поправил