Step 3: Add admin API endpoints for pricing configuration
- Add PricingConfigResponse and PricingConfigUpdate schemas - Create PricingService with validation logic - Add GET and PUT endpoints in routes/pricing.py - Add MANAGE_PRICING permission to admin role - Register pricing router in main.py - Add comprehensive API tests for permissions and validation
This commit is contained in:
parent
74b934135a
commit
4d0dad8e2b
8 changed files with 534 additions and 0 deletions
|
|
@ -44,6 +44,9 @@ from .price import (
|
|||
PriceResponse,
|
||||
)
|
||||
|
||||
# Export pricing schemas
|
||||
from .pricing import PricingConfigResponse, PricingConfigUpdate
|
||||
|
||||
# Export profile schemas
|
||||
from .profile import ProfileResponse, ProfileUpdate
|
||||
|
||||
|
|
@ -73,6 +76,8 @@ __all__ = [
|
|||
"PaginatedResponse",
|
||||
"PriceHistoryResponse",
|
||||
"PriceResponse",
|
||||
"PricingConfigResponse",
|
||||
"PricingConfigUpdate",
|
||||
"ProfileResponse",
|
||||
"ProfileUpdate",
|
||||
"RecordT",
|
||||
|
|
|
|||
27
backend/schemas/pricing.py
Normal file
27
backend/schemas/pricing.py
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class PricingConfigResponse(BaseModel):
|
||||
"""Response model for pricing configuration."""
|
||||
|
||||
premium_buy: int
|
||||
premium_sell: int
|
||||
small_trade_threshold_eur: int
|
||||
small_trade_extra_premium: int
|
||||
eur_min_buy: int
|
||||
eur_max_buy: int
|
||||
eur_min_sell: int
|
||||
eur_max_sell: int
|
||||
|
||||
|
||||
class PricingConfigUpdate(BaseModel):
|
||||
"""Request model for updating pricing configuration."""
|
||||
|
||||
premium_buy: int
|
||||
premium_sell: int
|
||||
small_trade_threshold_eur: int
|
||||
small_trade_extra_premium: int
|
||||
eur_min_buy: int
|
||||
eur_max_buy: int
|
||||
eur_min_sell: int
|
||||
eur_max_sell: int
|
||||
Loading…
Add table
Add a link
Reference in a new issue