diff --git a/src/organisation/schemas.py b/src/organisation/schemas.py index 4641118..522158e 100644 --- a/src/organisation/schemas.py +++ b/src/organisation/schemas.py @@ -9,7 +9,7 @@ Models follow the nomenclature of: from typing import Optional from datetime import datetime -from pydantic import EmailStr, ConfigDict +from pydantic import EmailStr, ConfigDict, Field from src.schemas import ( CustomBaseModel, @@ -55,7 +55,7 @@ class OrgSchema(OrgIDMixin): class OrgPostOrgRequest(CustomBaseModel): - name: str + name: str = Field(min_length=3) intake_questionnaire: Optional[CurrentQuestions] = None diff --git a/src/schemas.py b/src/schemas.py index 0244c11..cb2e742 100644 --- a/src/schemas.py +++ b/src/schemas.py @@ -55,3 +55,8 @@ class GroupSummary(CustomBaseModel): class UserSummary(CustomBaseModel): id: int email: str + + +class ServiceSummary(CustomBaseModel): + id: int + name: str diff --git a/src/service/schemas.py b/src/service/schemas.py index 531951f..71bb215 100644 --- a/src/service/schemas.py +++ b/src/service/schemas.py @@ -6,28 +6,21 @@ Models follow the nomenclature of: - Models: "" ie "ServiceGetServiceResponse" """ -from pydantic import ConfigDict +from pydantic import Field -from src.schemas import CustomBaseModel, ServiceIDMixin +from src.schemas import CustomBaseModel, ServiceIDMixin, ServiceSummary -class ServiceSchema(CustomBaseModel): - model_config = ConfigDict(from_attributes=True, extra="ignore") - - id: int - name: str - - -class ServiceWithKeySchema(ServiceSchema): +class ServiceWithKeySchema(ServiceSummary): api_key: str class ServiceGetServiceResponse(CustomBaseModel): - services: list[ServiceSchema] + services: list[ServiceSummary] class ServicePostServiceRequest(CustomBaseModel): - name: str + name: str = Field(min_length=3) class ServicePostServiceResponse(CustomBaseModel): diff --git a/test/conftest.py b/test/conftest.py index 750d2f5..a36e9a3 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -215,7 +215,7 @@ def generate_query_and_status(params) -> list[tuple[str, int]]: def generate_body_and_status(params: dict[str, str]) -> list[tuple[dict, int]]: possible_values_int = [0, -1, 42, "banana", ""] - possible_values_str = [0] + possible_values_str = [0, "", "a"] defaults = [{param: 1 for param in params.keys()}]