Files
service-finder/backend/app/schemas/service_catalog.py

34 lines
1.4 KiB
Python

# /opt/docker/dev/service_finder/backend/app/schemas/service_catalog.py
from pydantic import BaseModel, ConfigDict, Field
from typing import Optional
from datetime import datetime
class ServiceCatalogCreate(BaseModel):
"""Schema új szolgáltatás katalógus bejegyzés létrehozásához."""
service_code: str = Field(..., min_length=3, max_length=50, description="Egyedi szolgáltatás kód (pl. 'SRV_DATA_EXPORT')")
name: str = Field(..., min_length=2, max_length=200, description="Szolgáltatás megjelenített neve")
description: Optional[str] = Field(None, max_length=1000, description="Részletes leírás")
credit_cost: int = Field(0, ge=0, description="Alapértelmezett kredit költség")
is_active: bool = Field(True, description="Aktív-e a szolgáltatás")
class ServiceCatalogUpdate(BaseModel):
"""Schema meglévő szolgáltatás katalógus bejegyzés módosításához."""
name: Optional[str] = Field(None, min_length=2, max_length=200)
description: Optional[str] = Field(None, max_length=1000)
credit_cost: Optional[int] = Field(None, ge=0)
is_active: Optional[bool] = None
class ServiceCatalogResponse(BaseModel):
"""Schema szolgáltatás katalógus bejegyzés visszaadásához."""
id: int
service_code: str
name: str
description: Optional[str] = None
credit_cost: int
is_active: bool
model_config = ConfigDict(from_attributes=True)