-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bde6a36
commit 7d09a25
Showing
2 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
|
||
import datetime | ||
|
||
from database import Base | ||
from sqlalchemy import Column, DateTime, Integer | ||
|
||
|
||
class Reservation(Base): | ||
__tablename__ = 'reservation' | ||
|
||
id = Column(Integer, primary_key=True) | ||
user_id = Column(Integer()) | ||
car_id = Column(Integer()) | ||
parking_lot_id = Column(Integer()) | ||
start_time = Column(DateTime, nullable=False) | ||
end_time = Column(DateTime, nullable=False) | ||
|
||
def __init__( | ||
self, | ||
user_id: int, | ||
car_id: int, | ||
parking_lot_id: int, | ||
start_time: datetime, | ||
end_time: datetime | ||
): | ||
self.user_id = user_id | ||
self.car_id = car_id | ||
self.parking_lot_id = parking_lot_id | ||
self.start_time = start_time | ||
self.end_time = end_time | ||
|
||
def __repr__(self): | ||
return f'<Reservation {self.id}>' | ||
|
||
def json(self): | ||
return { | ||
'reservation_id': self.id, | ||
'reservation_start_time': self.start_time, | ||
'reservation_end_time': self.end_time | ||
} |