28 lines
805 B
Python
28 lines
805 B
Python
from sqlalchemy import Boolean, Column, ForeignKey, Integer, String
|
|
from sqlalchemy.orm import relationship
|
|
|
|
from databases.pgsql.database import Base
|
|
|
|
class User(Base):
|
|
__tablename__ = "users"
|
|
|
|
id = Column(Integer, primary_key= True, index= True)
|
|
email = Column(String, unique= True, index=True)
|
|
phone = Column(String, unique= True, index=True)
|
|
login = Column(String, unique= True, index=True)
|
|
name = Column(String)
|
|
surname = Column(String)
|
|
hashed_password = Column(String)
|
|
role_id = Column(Integer, ForeignKey("roles.id"))
|
|
is_active = Column(Boolean, default=True)
|
|
|
|
class Role(Base):
|
|
__tablename__ = "roles"
|
|
|
|
id = Column(Integer, primary_key=True, index= True)
|
|
name = Column(String, index= True)
|
|
description = Column(String , index= True)
|
|
|
|
|
|
|