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

Solution #30

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Solution #30

wants to merge 1 commit into from

Conversation

MatvijSafonov
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.

Great job on implementing the core functionalities and meeting the task requirements! 🎉 While there are some minor improvements suggested, such as allowing zero values for budget and revenue, and adding checks for existing country codes, these do not impact the overall functionality. Keep up the good work and consider these enhancements for future iterations! 😊

✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨

Comment on lines +33 to +38
def create_country_by_code(code, model, db):
country = model(code=code)
db.add(country)
db.commit()
db.refresh(country)
return country

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding a check to see if a country with the given code already exists in the database before creating a new one. This can prevent duplicate entries and ensure data integrity.

Comment on lines +71 to +75
if movie.date > datetime.datetime.now().date() + datetime.timedelta(days=365):
raise HTTPException(
status_code=400,
detail="Invalid input data.",
)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure that the date field is validated to not be more than one year in the future, as per the task requirements. This check is correctly implemented here.

Comment on lines +149 to +156
movie_date = movie_data.model_dump(exclude_unset=True)
for key, value in movie_date.items():
if value:
setattr(movie, key, value)
db.commit()
db.refresh(movie)
except IntegrityError:
raise HTTPException(status_code=400, detail="Invalid input data.")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the edit_movie function, ensure that the score is validated to be between 0 and 100, and that budget and revenue are non-negative. This is crucial to meet the task's validation requirements.

Comment on lines +81 to +82
budget: float = Field(gt=0)
revenue: float = Field(gt=0)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider allowing the budget and revenue fields to be zero by changing gt=0 to ge=0 in the MovieCreate schema. This would accommodate scenarios where a movie might have a budget or revenue of zero.

Comment on lines +123 to +124
budget: Optional[float] = Field(gt=0, default=None)
revenue: Optional[float] = Field(gt=0, default=None)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider allowing the budget and revenue fields to be zero by changing gt=0 to ge=0 in the MovieUpdate schema. This would accommodate scenarios where a movie might have a budget or revenue of zero.

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