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

Ocelots - Larissa and Soumya #19

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

Ocelots - Larissa and Soumya #19

wants to merge 68 commits into from

Conversation

smysh
Copy link

@smysh smysh commented Jan 9, 2023

No description provided.

smysh and others added 30 commits January 3, 2023 13:53
…id to validate_model. Some more refactoring to make the tests pass.
…uest and validate_put_request into validate_request.
test wave 3 updates from kyra
smysh and others added 25 commits January 8, 2023 00:30
Wave 1 and Wave 2 tests are passing!
customer_id = db.Column(db.Integer, db.ForeignKey("customer.id"))
video = db.relationship("Video", back_populates="rentals")
video_id = db.Column(db.Integer, db.ForeignKey("video.id"))

Choose a reason for hiding this comment

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

Nice job setting up the relationships, here

from app.models.validation import validate_model, validate_request, validate_and_process_query_params, create_model_query

# ~~~~~~ initialize customers blueprint ~~~~~~
customers_bp = Blueprint("customers", __name__, url_prefix="/customers")

Choose a reason for hiding this comment

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

Really nice job refactoring routes to individual files!



# ~~~~~~ validation checkers and processing functions ~~~~~~
def validate_model(cls, model_id):

Choose a reason for hiding this comment

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

Really nice job refactoring here and organizing this code so nicely!

join_query = join_query.order_by(sort)
else:
# default sort is ascending rental id
join_query = join_query.order_by(Rental.id.asc())

Choose a reason for hiding this comment

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

nice use of SQLAlchemy's OOP interface for sorting :)

new_rental = Rental.from_dict(request_body)

new_rental.customer = customer
new_rental.customer.videos_checked_out_count += 1

Choose a reason for hiding this comment

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

Great example making use of the relationships you've set up, to be able to cleanly use SQLAlchemy's OOP interface!

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.

3 participants