Scaffold Next.js + FastAPI + Postgres tasks board (no auth)
This commit is contained in:
2
backend/app/models/__init__.py
Normal file
2
backend/app/models/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
||||
# Import models here so Alembic can discover them
|
||||
from .task import Task # noqa: F401
|
||||
BIN
backend/app/models/__pycache__/__init__.cpython-312.pyc
Normal file
BIN
backend/app/models/__pycache__/__init__.cpython-312.pyc
Normal file
Binary file not shown.
BIN
backend/app/models/__pycache__/task.cpython-312.pyc
Normal file
BIN
backend/app/models/__pycache__/task.cpython-312.pyc
Normal file
Binary file not shown.
28
backend/app/models/task.py
Normal file
28
backend/app/models/task.py
Normal file
@@ -0,0 +1,28 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
from sqlalchemy import DateTime, Integer, String, Text
|
||||
from sqlalchemy.sql import func
|
||||
from sqlalchemy.orm import Mapped, mapped_column
|
||||
|
||||
from app.db.base import Base
|
||||
|
||||
|
||||
class Task(Base):
|
||||
__tablename__ = "tasks"
|
||||
|
||||
id: Mapped[int] = mapped_column(Integer, primary_key=True, index=True)
|
||||
title: Mapped[str] = mapped_column(String(200), nullable=False)
|
||||
description: Mapped[str | None] = mapped_column(Text, nullable=True)
|
||||
|
||||
# kanban columns: todo | doing | done
|
||||
status: Mapped[str] = mapped_column(String(32), nullable=False, default="todo")
|
||||
|
||||
# simple attribution (no auth)
|
||||
assignee: Mapped[str | None] = mapped_column(String(120), nullable=True)
|
||||
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now())
|
||||
updated_at: Mapped[datetime] = mapped_column(
|
||||
DateTime(timezone=True), server_default=func.now(), onupdate=func.now()
|
||||
)
|
||||
Reference in New Issue
Block a user