Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 13 additions & 15 deletions spp_api_v2_change_request/schemas/change_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from datetime import datetime
from typing import Any, Literal

from pydantic import BaseModel, Field
from pydantic import BaseModel, ConfigDict, Field


class ChangeRequestType(BaseModel):
Expand All @@ -29,8 +29,7 @@ class ChangeRequestMeta(BaseModel):
last_updated: datetime | None = Field(None, alias="lastUpdated")
source: str | None = Field(None, description="Source system URI")

class Config:
populate_by_name = True
model_config = ConfigDict(populate_by_name=True)


class ChangeRequestCreate(BaseModel):
Expand Down Expand Up @@ -70,9 +69,9 @@ class ChangeRequestCreate(BaseModel):
description: str | None = None
notes: str | None = None

class Config:
populate_by_name = True
json_schema_extra = {
model_config = ConfigDict(
populate_by_name=True,
json_schema_extra={
"example": {
"type": "ChangeRequest",
"requestType": {"code": "edit_individual"},
Expand All @@ -86,7 +85,8 @@ class Config:
"phone": "+639171234567",
},
}
}
},
)


class ChangeRequestResponse(BaseModel):
Expand Down Expand Up @@ -137,8 +137,7 @@ class ChangeRequestResponse(BaseModel):
# Metadata
meta: ChangeRequestMeta | None = None

class Config:
populate_by_name = True
model_config = ConfigDict(populate_by_name=True)


class ChangeRequestUpdate(BaseModel):
Expand All @@ -149,15 +148,16 @@ class ChangeRequestUpdate(BaseModel):
description="Type-specific detail fields to update",
)

class Config:
json_schema_extra = {
model_config = ConfigDict(
json_schema_extra={
"example": {
"detail": {
"given_name": "Maria Elena",
"phone": "+639171234568",
}
}
}
)


class ApproveActionData(BaseModel):
Expand Down Expand Up @@ -206,8 +206,7 @@ class ChangeRequestTypeInfo(BaseModel):
)
requires_applicant: bool = Field(False, alias="requiresApplicant", description="Whether an applicant is required")

class Config:
populate_by_name = True
model_config = ConfigDict(populate_by_name=True)


class ChangeRequestTypeSchema(BaseModel):
Expand All @@ -226,5 +225,4 @@ class ChangeRequestTypeSchema(BaseModel):
default_factory=list, alias="requiredDocuments", description="Documents that must be attached"
)

class Config:
populate_by_name = True
model_config = ConfigDict(populate_by_name=True)
14 changes: 7 additions & 7 deletions spp_api_v2_cycles/schemas/cycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from datetime import datetime
from typing import Any, Literal

from pydantic import BaseModel, Field
from pydantic import BaseModel, ConfigDict, Field

from odoo.addons.spp_api_v2.schemas.base import Period, Reference, ResourceMeta

Expand All @@ -18,8 +18,7 @@ class CycleStatistics(BaseModel):
total_amount: float | None = Field(None, alias="totalAmount", description="Total amount allocated")
currency: str | None = Field(None, description="Currency code")

class Config:
populate_by_name = True
model_config = ConfigDict(populate_by_name=True)


class Cycle(BaseModel):
Expand Down Expand Up @@ -63,9 +62,9 @@ class Cycle(BaseModel):
# Metadata
meta: ResourceMeta | None = None

class Config:
populate_by_name = True
json_schema_extra = {
model_config = ConfigDict(
populate_by_name=True,
json_schema_extra={
"example": {
"type": "Cycle",
"identifier": "4Ps-2024-Q1",
Expand All @@ -87,4 +86,5 @@ class Config:
"currency": "PHP",
},
}
}
},
)
11 changes: 6 additions & 5 deletions spp_api_v2_entitlements/schemas/entitlement.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from datetime import date
from typing import Any, Literal

from pydantic import BaseModel, Field
from pydantic import BaseModel, ConfigDict, Field

from odoo.addons.spp_api_v2.schemas.base import Period, Reference, ResourceMeta

Expand Down Expand Up @@ -85,9 +85,9 @@ class Entitlement(BaseModel):
# Metadata
meta: ResourceMeta | None = None

class Config:
populate_by_name = True
json_schema_extra = {
model_config = ConfigDict(
populate_by_name=True,
json_schema_extra={
"example": {
"type": "Entitlement",
"identifier": "abc123-def456",
Expand All @@ -114,4 +114,5 @@ class Config:
"currency": "PHP",
},
}
}
},
)
11 changes: 6 additions & 5 deletions spp_api_v2_products/schemas/product.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from typing import Any, Literal

from pydantic import BaseModel, Field
from pydantic import BaseModel, ConfigDict, Field

from odoo.addons.spp_api_v2.schemas.base import Reference, ResourceMeta

Expand Down Expand Up @@ -48,9 +48,9 @@ class Product(BaseModel):
# Metadata
meta: ResourceMeta | None = None

class Config:
populate_by_name = True
json_schema_extra = {
model_config = ConfigDict(
populate_by_name=True,
json_schema_extra={
"example": {
"resourceType": "Product",
"identifier": "RICE-25KG",
Expand All @@ -68,4 +68,5 @@ class Config:
"currency": "PHP",
"active": True,
}
}
},
)
11 changes: 6 additions & 5 deletions spp_api_v2_products/schemas/product_category.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from typing import Literal

from pydantic import BaseModel, Field
from pydantic import BaseModel, ConfigDict, Field

from odoo.addons.spp_api_v2.schemas.base import Reference, ResourceMeta

Expand Down Expand Up @@ -31,9 +31,9 @@ class ProductCategory(BaseModel):
# Metadata
meta: ResourceMeta | None = None

class Config:
populate_by_name = True
json_schema_extra = {
model_config = ConfigDict(
populate_by_name=True,
json_schema_extra={
"example": {
"resourceType": "ProductCategory",
"identifier": "Food",
Expand All @@ -43,4 +43,5 @@ class Config:
"display": "All",
},
}
}
},
)
11 changes: 6 additions & 5 deletions spp_api_v2_products/schemas/uom.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from typing import Literal

from pydantic import BaseModel, Field
from pydantic import BaseModel, ConfigDict, Field

from odoo.addons.spp_api_v2.schemas.base import Reference, ResourceMeta

Expand Down Expand Up @@ -36,9 +36,9 @@ class UnitOfMeasure(BaseModel):
# Metadata
meta: ResourceMeta | None = None

class Config:
populate_by_name = True
json_schema_extra = {
model_config = ConfigDict(
populate_by_name=True,
json_schema_extra={
"example": {
"resourceType": "UnitOfMeasure",
"identifier": "kg",
Expand All @@ -50,4 +50,5 @@ class Config:
},
"factor": 1.0,
}
}
},
)
11 changes: 6 additions & 5 deletions spp_api_v2_service_points/schemas/service_point.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from typing import Any, Literal

from pydantic import BaseModel, Field
from pydantic import BaseModel, ConfigDict, Field

from odoo.addons.spp_api_v2.schemas.base import (
Address,
Expand Down Expand Up @@ -54,9 +54,9 @@ class ServicePoint(BaseModel):
# Metadata
meta: ResourceMeta | None = None

class Config:
populate_by_name = True
json_schema_extra = {
model_config = ConfigDict(
populate_by_name=True,
json_schema_extra={
"example": {
"resourceType": "ServicePoint",
"identifier": "SP-MANILA-001",
Expand All @@ -72,4 +72,5 @@ class Config:
}
],
}
}
},
)
Loading