usermod/Model/AppModel.py

18 lines
631 B
Python
Raw Normal View History

2023-02-08 14:57:18 +08:00
import uuid
2023-02-21 13:56:47 +08:00
from sqlalchemy import Column, String, Boolean
2023-02-08 14:57:18 +08:00
from Utils.SqlAlchemyUtils import Base
class App(Base):
__tablename__ = "APP_TABLE"
2023-02-08 16:29:30 +08:00
id = Column(String(32), primary_key=True, comment="应用id")
name = Column(String(32), unique=True, comment="应用名称")
secret_key = Column(String(255), comment="验证密匙")
token_key = Column(String(255), comment="app随机token加密密匙", default=lambda: uuid.uuid4().hex)
2023-02-10 16:39:06 +08:00
allowed = Column(Boolean, comment="允许应用接入", default=False)
2023-02-08 14:57:18 +08:00
def to_dict(self):
return {c.name: getattr(self, c.name) for c in self.__table__.columns}
2023-02-15 14:14:08 +08:00