Fix: Update permission names, models and constants
Permission renames: - BOOK_APPOINTMENT -> CREATE_EXCHANGE - VIEW_OWN_APPOINTMENTS -> VIEW_OWN_EXCHANGES - CANCEL_OWN_APPOINTMENT -> CANCEL_OWN_EXCHANGE - VIEW_ALL_APPOINTMENTS -> VIEW_ALL_EXCHANGES - CANCEL_ANY_APPOINTMENT -> CANCEL_ANY_EXCHANGE - Add COMPLETE_EXCHANGE permission Model changes: - Delete AppointmentStatus enum - Delete Appointment model Schema changes: - Delete BookingRequest (was for old booking) - Delete AppointmentResponse, PaginatedAppointments - Delete BookableSlot, AvailableSlotsResponse (unused) Constants changes: - Remove appointmentStatuses from shared/constants.json - Merge booking constants into exchange section - Update shared_constants.py and validate_constants.py
This commit is contained in:
parent
743129b11d
commit
fa07490b7b
6 changed files with 32 additions and 147 deletions
|
|
@ -6,7 +6,6 @@ from pathlib import Path
|
|||
from models import (
|
||||
ROLE_ADMIN,
|
||||
ROLE_REGULAR,
|
||||
AppointmentStatus,
|
||||
ExchangeStatus,
|
||||
InviteStatus,
|
||||
TradeDirection,
|
||||
|
|
@ -42,15 +41,6 @@ def validate_shared_constants() -> None:
|
|||
f"Invite status mismatch. Expected: {expected_invite_statuses}, Got: {got}"
|
||||
)
|
||||
|
||||
# Validate appointment statuses
|
||||
expected_appointment_statuses = {s.name: s.value for s in AppointmentStatus}
|
||||
if constants.get("appointmentStatuses") != expected_appointment_statuses:
|
||||
got = constants.get("appointmentStatuses")
|
||||
raise ValueError(
|
||||
f"Appointment status mismatch. "
|
||||
f"Expected: {expected_appointment_statuses}, Got: {got}"
|
||||
)
|
||||
|
||||
# Validate exchange statuses
|
||||
expected_exchange_statuses = {s.name: s.value for s in ExchangeStatus}
|
||||
if constants.get("exchangeStatuses") != expected_exchange_statuses:
|
||||
|
|
@ -69,21 +59,12 @@ def validate_shared_constants() -> None:
|
|||
f"Expected: {expected_trade_directions}, Got: {got}"
|
||||
)
|
||||
|
||||
# Validate booking constants exist with required fields
|
||||
booking = constants.get("booking", {})
|
||||
required_booking_fields = [
|
||||
"slotDurationMinutes",
|
||||
"maxAdvanceDays",
|
||||
"minAdvanceDays",
|
||||
"noteMaxLength",
|
||||
]
|
||||
for field in required_booking_fields:
|
||||
if field not in booking:
|
||||
raise ValueError(f"Missing booking constant '{field}' in constants.json")
|
||||
|
||||
# Validate exchange constants exist with required fields
|
||||
exchange = constants.get("exchange", {})
|
||||
required_exchange_fields = [
|
||||
"slotDurationMinutes",
|
||||
"maxAdvanceDays",
|
||||
"minAdvanceDays",
|
||||
"eurTradeMin",
|
||||
"eurTradeMax",
|
||||
"eurTradeIncrement",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue