feat: init meijiaka-zj project from ai-meijiaka template
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
"""
|
||||
用户模型
|
||||
========
|
||||
|
||||
采用"手机号 + JWT"的传统认证方案。
|
||||
"""
|
||||
|
||||
from sqlalchemy import String, Text
|
||||
from sqlalchemy.orm import Mapped, mapped_column
|
||||
|
||||
from app.models.base import BaseModel
|
||||
|
||||
|
||||
class User(BaseModel):
|
||||
"""用户表"""
|
||||
|
||||
__tablename__ = "users"
|
||||
|
||||
# 手机号,作为登录账号
|
||||
mobile: Mapped[str] = mapped_column(
|
||||
String(20),
|
||||
unique=True,
|
||||
index=True,
|
||||
nullable=False,
|
||||
comment="手机号",
|
||||
)
|
||||
|
||||
nickname: Mapped[str | None] = mapped_column(
|
||||
String(64),
|
||||
nullable=True,
|
||||
comment="用户昵称",
|
||||
)
|
||||
|
||||
avatar_url: Mapped[str | None] = mapped_column(
|
||||
Text,
|
||||
nullable=True,
|
||||
comment="头像 URL",
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return f"<User(id={self.id}, mobile={self.mobile}, nickname={self.nickname})>"
|
||||
Reference in New Issue
Block a user