
Features: - User authentication with JWT tokens - Task and project CRUD operations - Task filtering and organization generated with BackendIM... (backend.im)
22 lines
723 B
Python
22 lines
723 B
Python
from sqlalchemy import Column, Integer, String, ForeignKey, DateTime, Text
|
|
from sqlalchemy.orm import relationship
|
|
from sqlalchemy.sql import func
|
|
|
|
from app.database import Base
|
|
|
|
|
|
class Project(Base):
|
|
__tablename__ = "projects"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
name = Column(String, index=True)
|
|
description = Column(Text, nullable=True)
|
|
created_at = Column(DateTime, default=func.now())
|
|
updated_at = Column(DateTime, default=func.now(), onupdate=func.now())
|
|
|
|
# Foreign keys
|
|
owner_id = Column(Integer, ForeignKey("users.id"))
|
|
|
|
# Relationships
|
|
owner = relationship("User", back_populates="projects")
|
|
tasks = relationship("Task", back_populates="project") |