-
Notifications
You must be signed in to change notification settings - Fork 58
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
problem with movie_id(src\routes\movies.py) #42
base: main
Are you sure you want to change the base?
Conversation
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.
Your implementation meets the core requirements of the task, and the code is well-structured and functional. 🎉 While there are some areas for improvement, such as ensuring all models and schemas are correctly defined and imported, these are minor issues that do not significantly impact the functionality. Keep up the great work, and consider addressing these minor points to enhance the robustness of your code! 😊
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
from database.models import ( | ||
CountryModel, GenreModel, ActorModel, MoviesGenresModel, ActorsMoviesModel, LanguageModel, MoviesLanguagesModel | ||
) |
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.
Ensure that all models imported from database.models
are correctly defined in the database/models.py
file. Verify that CountryModel
, GenreModel
, ActorModel
, MoviesGenresModel
, ActorsMoviesModel
, LanguageModel
, and MoviesLanguagesModel
exist and are correctly implemented.
from database import MovieModel | ||
from database.models import ActorModel, CountryModel, GenreModel, LanguageModel |
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.
Ensure that MovieModel
, ActorModel
, CountryModel
, GenreModel
, and LanguageModel
are correctly defined in the database
and database.models
modules. Verify their existence and correct implementation to avoid runtime errors.
|
||
from database import MovieModel | ||
from database.models import ActorModel, CountryModel, GenreModel, LanguageModel | ||
from schemas.movies import MovieCreate, MovieUpdate |
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.
Ensure that MovieCreate
and MovieUpdate
schemas are correctly defined in the schemas.movies
module. Verify their existence and correct implementation to ensure compatibility with CRUD operations.
from database.models import MovieModel | ||
from schemas.movies import MovieList, MovieBase, MovieDetail, MovieCreate, MovieUpdate |
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.
Ensure that MovieModel
is correctly defined in the database.models
module. Verify its existence and correct implementation to avoid runtime errors.
from database.models import MovieModel, CountryModel, GenreModel, ActorModel, LanguageModel | ||
|
||
from database.models import MovieModel | ||
from schemas.movies import MovieList, MovieBase, MovieDetail, MovieCreate, MovieUpdate |
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.
Ensure that MovieList
, MovieBase
, MovieDetail
, MovieCreate
, and MovieUpdate
schemas are correctly defined in the schemas.movies
module. Verify their existence and correct implementation to ensure compatibility with the API endpoints.
) | ||
|
||
offset = (page - 1) * per_page | ||
movies_query = movies.order_by(-MovieModel.id).offset(offset).limit(per_page).all() |
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.
The order_by(-MovieModel.id)
syntax might not be correct. Consider using order_by(MovieModel.id.desc())
to ensure proper descending order sorting.
if not movies_query: | ||
raise HTTPException(status_code=404, detail="No movies found.") | ||
|
||
movies_data = [MovieBase.model_validate(movie) for movie in movies_query] |
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.
Ensure that MovieBase.model_validate
is a valid method for validating or transforming the movie objects. If model_validate
is not a defined method, consider using an appropriate method or function to handle this transformation.
|
||
from pydantic import BaseModel, Field, field_validator, ConfigDict | ||
|
||
from database.models import MovieStatusEnum |
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.
Ensure that MovieStatusEnum
is correctly defined in the database.models
module. Verify its existence and correct implementation to avoid runtime errors.
raise ValueError("The date must not be more than one year in the future") | ||
return value | ||
|
||
model_config = ConfigDict(from_attributes=True) |
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.
The ConfigDict
class is not a standard Pydantic feature. Ensure that it is correctly defined and used. If this is a custom implementation, verify its functionality.
No description provided.