wd-smebiz/mods/cmebiz_rate/company_user/models.py

25 lines
910 B
Python

import uuid
from sqlalchemy.orm import relationship
from context.common import common_db
from sqlalchemy import Column, Integer, Boolean, String, ForeignKey, Text, DateTime, func, Date, Double
class CompanyUser(common_db.Base):
"""
企业用户表
"""
__tablename__ = "company_user"
id = Column(String(255), primary_key=True, comment='用户ID', default=lambda: uuid.uuid4().hex)
email = Column(String(255), comment="邮箱")
phone = Column(String(255), comment="手机号")
company_name = Column(String(255), comment="公司名称")
passwd = Column(String(255), comment="hash密码")
verified = Column(Boolean, default=False, comment="是否通过验证")
create_time = Column(DateTime, server_default=func.now(), comment='创建时间')
def to_dict(self):
data = {c.name: getattr(self, c.name) for c in self.__table__.columns}
return data