- add backend README and refresh API map and smoke regression docs - add full backend smoke regression script - add admin pricing cleanup preview and dry-run endpoints - add helper script for test pricing cleanup - verify typed error contracts, draft flow, publish readiness and preview flows - verify publish preview retention and clean backend startup behavior
52 lines
1.3 KiB
Python
52 lines
1.3 KiB
Python
from pydantic import BaseModel, Field
|
|
|
|
|
|
class PricingCleanupPreviewItem(BaseModel):
|
|
pricing_category_id: str
|
|
name: str
|
|
code: str
|
|
rules_count: int = Field(ge=0)
|
|
matched_by: list[str]
|
|
deletable: bool
|
|
|
|
|
|
class PricingCleanupPreviewResponse(BaseModel):
|
|
scheme_id: str
|
|
code_prefixes: list[str]
|
|
name_prefixes: list[str]
|
|
pricing_category_ids: list[str]
|
|
delete_only_without_rules: bool
|
|
total_candidates: int = Field(ge=0)
|
|
safe_to_delete_count: int = Field(ge=0)
|
|
items: list[PricingCleanupPreviewItem]
|
|
|
|
|
|
class PricingCleanupExecuteRequest(BaseModel):
|
|
code_prefixes: list[str] = Field(default_factory=list)
|
|
name_prefixes: list[str] = Field(default_factory=list)
|
|
pricing_category_ids: list[str] = Field(default_factory=list)
|
|
delete_only_without_rules: bool = True
|
|
dry_run: bool = True
|
|
|
|
|
|
class PricingCleanupSkippedItem(BaseModel):
|
|
pricing_category_id: str
|
|
reason: str
|
|
|
|
|
|
class PricingCleanupExecuteResponse(BaseModel):
|
|
scheme_id: str
|
|
dry_run: bool
|
|
delete_only_without_rules: bool
|
|
|
|
requested_total: int = Field(ge=0)
|
|
matched_total: int = Field(ge=0)
|
|
|
|
would_delete_count: int = Field(ge=0)
|
|
deleted_count: int = Field(ge=0)
|
|
skipped_count: int = Field(ge=0)
|
|
|
|
would_delete_category_ids: list[str]
|
|
deleted_category_ids: list[str]
|
|
skipped: list[PricingCleanupSkippedItem]
|