from tortoise import fields from app.schemas.menus import MenuType from .base import BaseModel, TimestampMixin from .enums import MethodType class AppUser(BaseModel, TimestampMixin): username = fields.CharField(max_length=20, unique=True, null=True, description="用户名称", index=True) alias = fields.CharField(max_length=30, null=True, description="姓名", index=True) email = fields.CharField(max_length=255, unique=True, null=True, description="邮箱", index=True) phone = fields.CharField(max_length=20, unique=True, description="手机号", index=True) password = fields.CharField(max_length=128, description="密码") company_name = fields.CharField(max_length=100, null=True, description="公司名称", index=True) company_address = fields.CharField(max_length=255, null=True, description="公司地址") company_contact = fields.CharField(max_length=50, null=True, description="公司联系人") company_phone = fields.CharField(max_length=20, null=True, description="公司电话") company_email = fields.CharField(max_length=100, null=True, description="公司邮箱") is_active = fields.BooleanField(default=True, description="是否激活", index=True) last_login = fields.DatetimeField(null=True, description="最后登录时间", index=True) class Meta: table = "app_user" table_description = "用户表"