-
Notifications
You must be signed in to change notification settings - Fork 55
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
base: master
Are you sure you want to change the base?
Changes from all commits
3cfb1ed
388bc9c
23d253e
ee847d9
c076142
755ad9d
6d48a25
0295e35
e10fbc7
75e1f15
1f32669
8ff1fa7
c04b7f7
437cde7
cc68d5a
d073e77
9e8ba3a
82129cb
160f5e9
f5f888c
3cf1b2b
c424b86
d21c147
34966b8
d4651e1
66bbbd5
32d7324
04bd4c0
4e357de
314c982
8dbf5de
a157c3c
ada4d90
c09fcd9
8f0d167
9ce0b3e
7adfd3d
fd0ff1b
dff4ea5
0d9e7c9
5abf8ce
abf0f51
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. At the moment, any of these columns can contain |
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') |
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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The same comment about required information for |
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.
👍