feat: add API routers for network, tasks, calendar, and services
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
15
backend/routers/calendar.py
Normal file
15
backend/routers/calendar.py
Normal file
@@ -0,0 +1,15 @@
|
||||
from datetime import datetime, timedelta
|
||||
from fastapi import APIRouter, Query
|
||||
|
||||
router = APIRouter(prefix="/api/calendar", tags=["calendar"])
|
||||
|
||||
|
||||
@router.get("/events")
|
||||
async def get_events(
|
||||
days: int = Query(default=7, ge=1, le=30),
|
||||
):
|
||||
from main import odoo_client
|
||||
today = datetime.now().strftime("%Y-%m-%d")
|
||||
end = (datetime.now() + timedelta(days=days)).strftime("%Y-%m-%d")
|
||||
events = await odoo_client.get_calendar_events(date_from=today, date_to=end)
|
||||
return {"events": events, "date_from": today, "date_to": end}
|
||||
Reference in New Issue
Block a user