Добавлено получение лектора по tbid и соответствующие тесты#159
Open
DrNeumann388 wants to merge 1 commit intomainfrom
Open
Добавлено получение лектора по tbid и соответствующие тесты#159DrNeumann388 wants to merge 1 commit intomainfrom
DrNeumann388 wants to merge 1 commit intomainfrom
Conversation
|
💩 Code linting failed, use |
Coverage Report
Summary
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Member
|
https://github.com/profcomff/rating-api/blob/main/rating_api/exceptions.py#L18 |
petrCher
requested changes
Mar 6, 2026
|
|
||
| @lecturer.get("/timetable-id/{timetable_id}", response_model=LecturerGet) | ||
| async def get_lecturer_by_timetable_id(timetable_id: int) -> LecturerGet: | ||
| lecturer: Lecturer = Lecturer.query(session=db.session).filter(LEcturer.timetable_id == timetable_id).one_or_none() |
Member
There was a problem hiding this comment.
опечатка в filter: ты написал LEcturer
| lecturer: Lecturer = Lecturer.query(session=db.session).filter(LEcturer.timetable_id == timetable_id).one_or_none() | ||
| if lecturer is None: | ||
| raise ObjectNotFound(Lecturer, timetable_id) | ||
| result = LecturerGet.model_validate(lecturer) |
Member
There was a problem hiding this comment.
здесь не надо создавать переменную result, лучше сразу делать return, чтобы не тратить время на ненужную переменную
| assert get_response.status_code == response_status | ||
| if response_status == status.HTTP_200_OK: | ||
| json_response = get_response.json() | ||
| assert json_response["id"] == Lecturer.id |
Member
There was a problem hiding this comment.
== lecturer.id
сейчас ты обращаешься к классу, а не объекту
| return response_validated | ||
|
|
||
| @lecturer.get("/timetable-id/{timetable_id}", response_model=LecturerGet) | ||
| async def get_lecturer_by_timetable_id(timetable_id: int) -> LecturerGet: |
Member
There was a problem hiding this comment.
после объявления функции надо добавить к ней описание на русском, посмотри соседние энпоинты например
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Изменения
Добавлена ручка, по которой можнр получить из БД лектора по timetable_id.
Детали реализации
Check-List
blackиisortдля Back-End илиPrettierдля Front-End?