Files
crm-system/app/schemas/note.py
T

44 lines
921 B
Python
Raw Normal View History

2026-06-04 00:06:23 +00:00
"""Pydantic schemas for Note endpoints."""
from __future__ import annotations
from datetime import datetime
from typing import Optional
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: Optional[str] = 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: Optional[datetime] = None
__all__ = ["NoteCreate", "NoteOut", "NoteUpdate"]