初始提交:极码 GeekCode 全栈项目(FastAPI + Vue3)
This commit is contained in:
18
backend/models/user.py
Normal file
18
backend/models/user.py
Normal file
@@ -0,0 +1,18 @@
|
||||
"""用户模型"""
|
||||
from sqlalchemy import Column, Integer, String, DateTime, Boolean
|
||||
from sqlalchemy.sql import func
|
||||
from database import Base
|
||||
|
||||
|
||||
class User(Base):
|
||||
__tablename__ = "users"
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
username = Column(String(50), unique=True, index=True, nullable=False)
|
||||
email = Column(String(100), unique=True, index=True, nullable=False)
|
||||
password_hash = Column(String(200), nullable=False)
|
||||
avatar = Column(String(500), default="")
|
||||
is_admin = Column(Boolean, default=False, nullable=False)
|
||||
is_banned = Column(Boolean, default=False, nullable=False)
|
||||
is_approved = Column(Boolean, default=False, nullable=False) # 新用户需管理员审核
|
||||
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
||||
Reference in New Issue
Block a user