-
Notifications
You must be signed in to change notification settings - Fork 15
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
base: main
Are you sure you want to change the base?
Conversation
…sting a new customer
…e attr to be changed
Wave 1: LA-costumer-model
…id to validate_model. Some more refactoring to make the tests pass.
Pull request : Wave 01
…uest and validate_put_request into validate_request.
Wave 1 tests passing.
test wave 3 updates from kyra
Wave 1 and Wave 2 tests are passing!
…t_count in response dict to pass tests
…into ss-videos-model
…into ss-videos-model
Wave 3 tests
wave 3 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")) |
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.
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") |
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.
Really nice job refactoring routes to individual files!
|
||
|
||
# ~~~~~~ validation checkers and processing functions ~~~~~~ | ||
def validate_model(cls, model_id): |
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.
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()) |
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.
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 |
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.
Great example making use of the relationships you've set up, to be able to cleanly use SQLAlchemy's OOP interface!
No description provided.