首次提交by MimoCode
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
from sqlalchemy import Column, Integer, String, Boolean, DateTime
|
||||
from sqlalchemy.orm import relationship
|
||||
from datetime import datetime
|
||||
|
||||
from app.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)
|
||||
password_hash = Column(String(255), nullable=False)
|
||||
role = Column(String(20), nullable=False, default="user")
|
||||
display_name = Column(String(100))
|
||||
email = Column(String(100))
|
||||
notification_level = Column(String(20), default="normal")
|
||||
is_active = Column(Boolean, default=True)
|
||||
created_at = Column(DateTime, default=datetime.utcnow)
|
||||
updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)
|
||||
|
||||
medicines = relationship("Medicine", back_populates="creator")
|
||||
audit_logs = relationship("AuditLog", back_populates="user")
|
||||
notifications = relationship("Notification", back_populates="user")
|
||||
Reference in New Issue
Block a user