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

Spruce - C16 - Symone & Vange #51

Open
wants to merge 42 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
3cfb1ed
created db and tables
syblades Nov 10, 2021
388bc9c
created and registered customers blueprint
syblades Nov 10, 2021
23d253e
created Customer model
syblades Nov 10, 2021
ee847d9
updated requirements
syblades Nov 10, 2021
c076142
added routes for customers endpoint
syblades Nov 10, 2021
755ad9d
added Video Model
syblades Nov 10, 2021
6d48a25
db migration
syblades Nov 10, 2021
0295e35
adds videos endpoint, and all but one CRUD method
HouseOfVange Nov 10, 2021
e10fbc7
passes all wave video tests
HouseOfVange Nov 11, 2021
75e1f15
removed erroneous import
syblades Nov 11, 2021
1f32669
all routes for Customer model pass wave 1 tests
syblades Nov 11, 2021
8ff1fa7
deleted old migrations to start a new folder
syblades Nov 11, 2021
c04b7f7
adds isnumeric() check
HouseOfVange Nov 11, 2021
437cde7
Merge branch 'vange_video'
HouseOfVange Nov 11, 2021
cc68d5a
added attributes to models
syblades Nov 11, 2021
d073e77
updates Rental model attributes, adds partial routes for post check o…
HouseOfVange Nov 12, 2021
9e8ba3a
updated models
HouseOfVange Nov 12, 2021
82129cb
added and registered routes_bp blueprint
syblades Nov 13, 2021
160f5e9
updated all 3 models for many-to-many relationship
syblades Nov 14, 2021
f5f888c
created new migration
syblades Nov 14, 2021
3cf1b2b
added missing "assert"'s to test
syblades Nov 14, 2021
c424b86
added: rentals_bp, GET routes & POST routes edits
syblades Nov 14, 2021
d21c147
edits rental model and routes model
HouseOfVange Nov 15, 2021
34966b8
updates rental model and routes
HouseOfVange Nov 15, 2021
d4651e1
updates routes
HouseOfVange Nov 15, 2021
66bbbd5
cuts custom routes post
HouseOfVange Nov 15, 2021
32d7324
adds custom end points post
HouseOfVange Nov 15, 2021
04bd4c0
edits to models
HouseOfVange Nov 15, 2021
4e357de
passes checkout tests
HouseOfVange Nov 16, 2021
314c982
added due date logic
syblades Nov 16, 2021
8dbf5de
updated due date logic
syblades Nov 16, 2021
a157c3c
refactoring
syblades Nov 16, 2021
ada4d90
check in edits
HouseOfVange Nov 16, 2021
c09fcd9
refactoring
syblades Nov 16, 2021
8f0d167
idk lol
HouseOfVange Nov 16, 2021
9ce0b3e
light refactoring
syblades Nov 16, 2021
7adfd3d
hmm
HouseOfVange Nov 16, 2021
fd0ff1b
Merge branch 'master' of https://github.com/HouseOfVange/retro-video-…
HouseOfVange Nov 16, 2021
dff4ea5
passes test_can_delete_customer_with_rental
HouseOfVange Nov 16, 2021
0d9e7c9
refactor delete_existing_customer function
HouseOfVange Nov 16, 2021
5abf8ce
passes all wave 2 tests
HouseOfVange Nov 16, 2021
abf0f51
Refactoring + added docstrings
syblades Nov 16, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,10 @@ def create_app(test_config=None):
migrate.init_app(app, db)

#Register Blueprints Here

from .routes import customers_bp, videos_bp, rentals_bp

Choose a reason for hiding this comment

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

👍


app.register_blueprint(customers_bp)
app.register_blueprint(videos_bp)
app.register_blueprint(rentals_bp)

return app
8 changes: 7 additions & 1 deletion app/models/customer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
from app import db

class Customer(db.Model):
id = db.Column(db.Integer, primary_key=True)

id = db.Column(db.Integer, primary_key=True, autoincrement=True)
name = db.Column(db.String)
postal_code = db.Column(db.String)
phone = db.Column(db.String)
registered_at = db.Column(db.DateTime())
videos = db.relationship("Video", secondary="rental", backref="customers")
Comment on lines +5 to +10

Choose a reason for hiding this comment

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

At the moment, any of these columns can contain null values. Consider revisiting each column to determine which column should truly have null values versus not. For example, is it useful to store a Customer without a name or phone number? Those two columns can be considered required information to store about a customer, despite our requirements not strictly describing that behavior.

8 changes: 7 additions & 1 deletion app/models/rental.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
from app import db

# join table
class Rental(db.Model):
id = db.Column(db.Integer, primary_key=True)
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
customer_id = db.Column(db.Integer, db.ForeignKey('customer.id'))
video_id = db.Column(db.Integer, db.ForeignKey('video.id'))
due_date = db.Column(db.DateTime())
video = db.relationship('Video', backref='rentals')
customer = db.relationship('Customer', backref='rentals')
18 changes: 17 additions & 1 deletion app/models/video.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
from app import db

class Video(db.Model):
id = db.Column(db.Integer, primary_key=True)

id = db.Column(db.Integer, primary_key=True, autoincrement=True)
title = db.Column(db.String)
release_date = db.Column(db.DateTime())
total_inventory = db.Column(db.Integer)

def to_dict(self):
return {
"id": self.id,
"title" : self.title,
"release_date" : self.release_date,
"total_inventory" : self.total_inventory
}

@classmethod
def from_dict(cls, values):
return cls(**values)
Comment on lines +4 to +20

Choose a reason for hiding this comment

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

The same comment about required information for Customer can also be applied to Video and Rental.

Loading