Some checks failed
ci / lint_and_test (push) Failing after 5s
Delete endpoints do not fully support bodies. Queries used instead. Tests added. Resolves #20
47 lines
945 B
Python
47 lines
945 B
Python
"""
|
|
Pydantic models for service module
|
|
|
|
Models follow the nomenclature of:
|
|
- Sub-models: "<Resource><Opt:>Schema"
|
|
- Mixins: "<Attribute>Mixin"
|
|
- Models: "<Module><Method><Resource><Opt:Resource><Direction>" ie "ServiceGetServiceResponse"
|
|
"""
|
|
|
|
from pydantic import ConfigDict, Field
|
|
|
|
from src.schemas import CustomBaseModel
|
|
|
|
|
|
class ServiceIDMixin(CustomBaseModel):
|
|
service_id: int = Field(gt=0)
|
|
|
|
|
|
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
|