Files
sound-analyze/services/api/app/schemas/base.py
Iwwww 1b864228d4 feat(api): add backend
routes and WebSockets
2025-12-26 19:26:06 +03:00

20 lines
441 B
Python

from __future__ import annotations
from typing import Generic, TypeVar
from pydantic import BaseModel, Field
T = TypeVar("T")
class ApiError(BaseModel):
code: str = Field(..., examples=["validation_error", "db_error"])
message: str
details: dict | None = None
class ApiResponse(BaseModel, Generic[T]):
success: bool = True
errors: list[ApiError] | None = None
count: int | None = None
data: T | None = None