Skip to content
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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Stekloduv
Copy link

No description provided.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a 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! ✨

Comment on lines +9 to +11
from database.models import (
CountryModel, GenreModel, ActorModel, MoviesGenresModel, ActorsMoviesModel, LanguageModel, MoviesLanguagesModel
)

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.

Comment on lines +4 to +5
from database import MovieModel
from database.models import ActorModel, CountryModel, GenreModel, LanguageModel

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

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.

Comment on lines +8 to +9
from database.models import MovieModel
from schemas.movies import MovieList, MovieBase, MovieDetail, MovieCreate, MovieUpdate

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

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()

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]

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

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)

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants