40 lines
831 B
Python
40 lines
831 B
Python
"""
|
|
Pydantic models for the service module
|
|
|
|
Models:
|
|
- List: Description
|
|
- Models: Description
|
|
"""
|
|
from pydantic import ConfigDict
|
|
|
|
from src.schemas import CustomBaseModel
|
|
|
|
class ServiceIDMixin(CustomBaseModel):
|
|
service_id: int
|
|
|
|
class ServiceSchema(CustomBaseModel):
|
|
model_config = ConfigDict(from_attributes=True, extra="ignore")
|
|
|
|
id: int
|
|
name: str
|
|
|
|
class ServiceWithKeySchema(ServiceSchema):
|
|
api_key: str
|
|
|
|
class ServiceGetServiceResponse(CustomBaseModel):
|
|
services: list[ServiceSchema]
|
|
|
|
class ServicePostServiceRequest(CustomBaseModel):
|
|
name: str
|
|
|
|
class ServicePostServiceResponse(CustomBaseModel):
|
|
service: ServiceWithKeySchema
|
|
|
|
class ServicePatchKeyRequest(ServiceIDMixin):
|
|
pass
|
|
|
|
class ServicePatchKeyResponse(CustomBaseModel):
|
|
service: ServiceWithKeySchema
|
|
|
|
class ServiceDeleteServiceRequest(ServiceIDMixin):
|
|
pass
|