- add typed response schemas for pricing write endpoints - add stale draft version guard for pricing mutations - unify pricing API contract around expected_scheme_version_id - update API route map - add smoke regression checklist for backend routes and artifact flows
105 lines
2.6 KiB
Python
105 lines
2.6 KiB
Python
from pydantic import BaseModel, Field
|
|
|
|
|
|
class PricingCategoryCreateRequest(BaseModel):
|
|
name: str = Field(..., min_length=1, max_length=255)
|
|
code: str | None = Field(default=None, max_length=128)
|
|
|
|
|
|
class PricingCategoryUpdateRequest(BaseModel):
|
|
name: str = Field(..., min_length=1, max_length=255)
|
|
code: str | None = Field(default=None, max_length=128)
|
|
|
|
|
|
class PriceRuleCreateRequest(BaseModel):
|
|
pricing_category_id: str = Field(..., max_length=32)
|
|
target_type: str = Field(..., pattern="^(seat|group|sector)$")
|
|
target_ref: str = Field(..., min_length=1, max_length=128)
|
|
amount: str = Field(..., min_length=1, max_length=32)
|
|
currency: str = Field(default="RUB", min_length=3, max_length=8)
|
|
|
|
|
|
class PriceRuleUpdateRequest(BaseModel):
|
|
pricing_category_id: str = Field(..., max_length=32)
|
|
target_type: str = Field(..., pattern="^(seat|group|sector)$")
|
|
target_ref: str = Field(..., min_length=1, max_length=128)
|
|
amount: str = Field(..., min_length=1, max_length=32)
|
|
currency: str = Field(default="RUB", min_length=3, max_length=8)
|
|
|
|
|
|
class PricingCategoryItem(BaseModel):
|
|
pricing_category_id: str
|
|
scheme_id: str
|
|
name: str
|
|
code: str | None
|
|
created_at: str
|
|
|
|
|
|
class PriceRuleItem(BaseModel):
|
|
price_rule_id: str
|
|
scheme_id: str
|
|
pricing_category_id: str | None
|
|
target_type: str
|
|
target_ref: str
|
|
amount: str
|
|
currency: str
|
|
created_at: str
|
|
|
|
|
|
class PricingBundleResponse(BaseModel):
|
|
categories: list[PricingCategoryItem]
|
|
rules: list[PriceRuleItem]
|
|
|
|
|
|
class PricingCategoryCreateResponse(BaseModel):
|
|
pricing_category_id: str
|
|
scheme_id: str
|
|
name: str
|
|
code: str | None
|
|
|
|
|
|
class PricingCategoryUpdateResponse(BaseModel):
|
|
pricing_category_id: str
|
|
scheme_id: str
|
|
name: str
|
|
code: str | None
|
|
|
|
|
|
class PriceRuleCreateResponse(BaseModel):
|
|
price_rule_id: str
|
|
scheme_id: str
|
|
pricing_category_id: str
|
|
target_type: str
|
|
target_ref: str
|
|
amount: str
|
|
currency: str
|
|
|
|
|
|
class PriceRuleUpdateResponse(BaseModel):
|
|
price_rule_id: str
|
|
scheme_id: str
|
|
pricing_category_id: str | None
|
|
target_type: str
|
|
target_ref: str
|
|
amount: str
|
|
currency: str
|
|
|
|
|
|
class DeleteResponse(BaseModel):
|
|
deleted: bool
|
|
pricing_category_id: str | None = None
|
|
price_rule_id: str | None = None
|
|
|
|
|
|
class EffectiveSeatPriceResponse(BaseModel):
|
|
scheme_id: str
|
|
scheme_version_id: str
|
|
seat_id: str
|
|
sector_id: str | None
|
|
group_id: str | None
|
|
matched_rule_level: str
|
|
matched_target_ref: str
|
|
pricing_category_id: str | None
|
|
amount: str
|
|
currency: str
|