Polymorphes akte_notiz-Modell (gleiches entitaet_typ/entitaet_id-Muster wie Dokument/Historie/Mangel), CRUD-Endpunkte, NotizenPanel im Akte-Grid. Löschen nur durch Autor oder Administrator. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CVgbozhYmuEhiEJHffRXCV
23 lines
906 B
Python
23 lines
906 B
Python
import uuid
|
|
from datetime import datetime
|
|
|
|
from sqlalchemy import ForeignKey, String
|
|
from sqlalchemy.dialects.postgresql import TIMESTAMP, UUID
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
|
|
from app.db.base import Base
|
|
|
|
|
|
class AkteNotiz(Base):
|
|
"""FILE-009: formlose Freitext-Notiz an beliebiger Ressource - gleiches
|
|
entitaet_typ/entitaet_id-Muster wie Dokument/Historie/Mangel."""
|
|
|
|
__tablename__ = "akte_notiz"
|
|
|
|
id: Mapped[uuid.UUID] = mapped_column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
|
|
entitaet_typ: Mapped[str] = mapped_column(String, nullable=False)
|
|
entitaet_id: Mapped[str] = mapped_column(String, nullable=False)
|
|
text: Mapped[str] = mapped_column(String, nullable=False)
|
|
autor_id: Mapped[int] = mapped_column(ForeignKey("benutzer.id"), nullable=False)
|
|
erstellt_am: Mapped[datetime] = mapped_column(TIMESTAMP(timezone=True), nullable=False)
|