feat(api): add backend
routes and WebSockets
This commit is contained in:
19
services/api/app/schemas/base.py
Normal file
19
services/api/app/schemas/base.py
Normal file
@@ -0,0 +1,19 @@
|
||||
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
|
||||
Reference in New Issue
Block a user