Files
leocrm/app/schemas/note.py
T

43 lines
887 B
Python

"""Pydantic schemas for Note endpoints."""
from __future__ import annotations
from datetime import datetime
from pydantic import BaseModel, ConfigDict, Field
from app.models.note import NoteParentType
class NoteCreate(BaseModel):
"""Body for POST /api/v1/notes/."""
body: str = Field(..., min_length=1)
parent_type: NoteParentType
parent_id: int = Field(..., ge=1)
class NoteUpdate(BaseModel):
"""Body for PATCH /api/v1/notes/{id}."""
body: str | None = Field(None, min_length=1)
class NoteOut(BaseModel):
"""Response schema for a note."""
model_config = ConfigDict(from_attributes=True)
id: int
org_id: int
body: str
author_id: int
parent_type: NoteParentType
parent_id: int
created_at: datetime
updated_at: datetime
deleted_at: datetime | None = None
__all__ = ["NoteCreate", "NoteOut", "NoteUpdate"]