fix scheduler orario start, immagine parcheggio, added more logs function
This commit is contained in:
@@ -26,6 +26,9 @@ router = APIRouter(prefix="/api/offices", tags=["offices"])
|
||||
class ValidOfficeCreate(BaseModel):
|
||||
name: str
|
||||
parking_quota: int = 0
|
||||
booking_window_enabled: bool = True
|
||||
booking_window_end_hour: int = 18
|
||||
booking_window_end_minute: int = 0
|
||||
|
||||
|
||||
class ClosingDayCreate(BaseModel):
|
||||
@@ -121,6 +124,9 @@ def create_office(data: ValidOfficeCreate, db: Session = Depends(get_db), user=D
|
||||
name=data.name,
|
||||
parking_quota=data.parking_quota,
|
||||
spot_prefix=get_next_available_prefix(db),
|
||||
booking_window_enabled=data.booking_window_enabled,
|
||||
booking_window_end_hour=data.booking_window_end_hour,
|
||||
booking_window_end_minute=data.booking_window_end_minute,
|
||||
created_at=datetime.utcnow()
|
||||
)
|
||||
db.add(office)
|
||||
@@ -180,12 +186,12 @@ def update_office_settings(office_id: str, data: OfficeSettingsUpdate, db: Sessi
|
||||
|
||||
if data.booking_window_end_hour is not None:
|
||||
if not (0 <= data.booking_window_end_hour <= 23):
|
||||
raise HTTPException(status_code=400, detail="Hour must be 0-23")
|
||||
raise HTTPException(status_code=400, detail="Hour must be 0-23")
|
||||
office.booking_window_end_hour = data.booking_window_end_hour
|
||||
|
||||
if data.booking_window_end_minute is not None:
|
||||
if not (0 <= data.booking_window_end_minute <= 59):
|
||||
raise HTTPException(status_code=400, detail="Minute must be 0-59")
|
||||
raise HTTPException(status_code=400, detail="Minute must be 0-59")
|
||||
office.booking_window_end_minute = data.booking_window_end_minute
|
||||
|
||||
office.updated_at = datetime.utcnow()
|
||||
|
||||
Reference in New Issue
Block a user