-
Notifications
You must be signed in to change notification settings - Fork 0
/
user.py
27 lines (25 loc) · 953 Bytes
/
user.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/python3
"""This is the user class"""
from sqlalchemy.ext.declarative import declarative_base
from models.base_model import BaseModel, Base
from sqlalchemy import Column, Integer, String
from sqlalchemy.orm import relationship
from models.place import Place
from models.review import Review
class User(BaseModel, Base):
"""This is the class for user
Attributes:
email: email address
password: password for you login
first_name: first name
last_name: last name
"""
__tablename__ = "users"
email = Column(String(128), nullable=False)
password = Column(String(128), nullable=False)
first_name = Column(String(128))
last_name = Column(String(128))
places = relationship("Place", cascade='all, delete, delete-orphan',
backref="user")
reviews = relationship("Review", cascade='all, delete, delete-orphan',
backref="user")