feat: add started_at/completed_at columns to notes

This commit is contained in:
2026-03-27 22:37:55 -04:00
parent 7a12cba4d5
commit 1125c8e107
2 changed files with 25 additions and 2 deletions
+6 -2
View File
@@ -1,7 +1,7 @@
import enum
from datetime import date
from datetime import date, datetime
from sqlalchemy import Date, ForeignKey, Index, Integer, Text
from sqlalchemy import Date, DateTime, ForeignKey, Index, Integer, Text
from sqlalchemy.dialects.postgresql import ARRAY
from sqlalchemy.orm import Mapped, mapped_column
@@ -45,6 +45,8 @@ class Note(Base, TimestampMixin):
status: Mapped[str | None] = mapped_column(Text, nullable=True)
priority: Mapped[str | None] = mapped_column(Text, nullable=True)
due_date: Mapped[date | None] = mapped_column(Date, nullable=True)
started_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True), nullable=True)
completed_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True), nullable=True)
__table_args__ = (
Index("ix_notes_tags", "tags", postgresql_using="gin"),
@@ -71,6 +73,8 @@ class Note(Base, TimestampMixin):
"status": self.status,
"priority": self.priority,
"due_date": self.due_date.isoformat() if self.due_date else None,
"started_at": self.started_at.isoformat() if self.started_at else None,
"completed_at": self.completed_at.isoformat() if self.completed_at else None,
"is_task": self.is_task,
"created_at": self.created_at.isoformat(),
"updated_at": self.updated_at.isoformat(),