b255a0f90e
Renames src/fabledassistant -> src/scribe and all imports, plus the default DB name and DB user/password (fabled -> scribe) in config + compose. 952 refs / 154 files. Reverses the old 'internal name stays fabledassistant' convention. Code-only: live databases are still physically named 'fabledassistant'. Deployed environments must set POSTGRES_DB / POSTGRES_USER (or rename the DB) since the defaults now resolve to 'scribe'. Repo (FabledScribe), git host (fabledsword), MCP (fabled-git) and the image name (fabledscribe) are intentionally unchanged. ruff check src/ clean locally; CI (typecheck + pytest) is the gate. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
34 lines
1.3 KiB
Python
34 lines
1.3 KiB
Python
from sqlalchemy import ARRAY, ForeignKey, Integer, Text
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
|
|
from scribe.models import Base
|
|
from scribe.models.base import CreatedAtMixin
|
|
|
|
|
|
class NoteVersion(Base, CreatedAtMixin):
|
|
__tablename__ = "note_versions"
|
|
|
|
id: Mapped[int] = mapped_column(primary_key=True)
|
|
note_id: Mapped[int] = mapped_column(Integer, ForeignKey("notes.id", ondelete="CASCADE"))
|
|
user_id: Mapped[int] = mapped_column(Integer, ForeignKey("users.id", ondelete="CASCADE"))
|
|
body: Mapped[str] = mapped_column(Text)
|
|
title: Mapped[str] = mapped_column(Text, default="")
|
|
tags: Mapped[list[str]] = mapped_column(ARRAY(Text), default=list)
|
|
pin_kind: Mapped[str | None] = mapped_column(Text, nullable=True)
|
|
pin_label: Mapped[str | None] = mapped_column(Text, nullable=True)
|
|
|
|
def to_dict(self, include_body: bool = True) -> dict:
|
|
d: dict = {
|
|
"id": self.id,
|
|
"note_id": self.note_id,
|
|
"user_id": self.user_id,
|
|
"title": self.title,
|
|
"tags": self.tags or [],
|
|
"pin_kind": self.pin_kind,
|
|
"pin_label": self.pin_label,
|
|
"created_at": self.created_at.isoformat(),
|
|
}
|
|
if include_body:
|
|
d["body"] = self.body
|
|
return d
|