register user, sign in and sign out working

This commit is contained in:
knst-kotov
2021-06-29 13:26:46 +03:00
parent 2dac73b412
commit c9b3d3a833
14 changed files with 81 additions and 30 deletions

View File

@@ -1,4 +1,7 @@
from orm.rbac import Operation, Permission, Role
from orm.user import User
from orm.base import Base, engine
__all__ = ["User", "Role", "Operation", "Permission"]
Base.metadata.create_all(engine)

View File

@@ -9,11 +9,11 @@ from orm.base import Base
class User(Base):
__tablename__ = 'user'
name: str = Column(String, nullable=False, comment="Name")
email: str = Column(String, nullable=False)
username: str = Column(String, nullable=False, comment="Name")
password: str = Column(String, nullable=False, comment="Password")
# phone: str = Column(String, comment="Phone")
# age: int = Column(Integer, comment="Age")
role_id: int = Column(ForeignKey("role.id"), nullable=False, comment="Role")
role_id: int = Column(ForeignKey("role.id"), nullable=True, comment="Role")
@classmethod
def get_permission(cls, user_id):