diff --git a/backend/app/models/user.py b/backend/app/models/user.py new file mode 100644 index 0000000..a43a8bd --- /dev/null +++ b/backend/app/models/user.py @@ -0,0 +1,21 @@ +"""User model.""" +from sqlalchemy import Column, Integer, String, DateTime +from sqlalchemy.orm import relationship +from datetime import datetime +from app.database import Base + +class User(Base): + """User model.""" + __tablename__ = "users" + + id = Column(Integer, primary_key=True, index=True) + email = Column(String(255), unique=True, index=True, nullable=False) + username = Column(String(100), unique=True, index=True, nullable=False) + hashed_password = Column(String(255), nullable=False) + full_name = Column(String(255)) + created_at = Column(DateTime, default=datetime.utcnow) + updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow) + is_active = Column(Integer, default=1) + + workspaces = relationship("Workspace", back_populates="owner") + comments = relationship("Comment", back_populates="author")