Add Doris Schoolhouse and clean pending homelab changes
This commit is contained in:
27
home/doris-schoolhouse/app/routes/api_sync.py
Normal file
27
home/doris-schoolhouse/app/routes/api_sync.py
Normal file
@@ -0,0 +1,27 @@
|
||||
from fastapi import APIRouter
|
||||
|
||||
from app.services.d2l import D2LService
|
||||
|
||||
|
||||
router = APIRouter(prefix="/api/d2l", tags=["d2l"])
|
||||
service = D2LService()
|
||||
|
||||
|
||||
@router.get("/courses")
|
||||
async def get_courses():
|
||||
return {"items": service.get_courses()}
|
||||
|
||||
|
||||
@router.get("/assignments")
|
||||
async def get_course_assignments(course_id: str):
|
||||
return {"items": service.get_assignments(course_id), "course_id": course_id}
|
||||
|
||||
|
||||
@router.get("/grades")
|
||||
async def get_course_grades(course_id: str):
|
||||
return service.get_grades(course_id)
|
||||
|
||||
|
||||
@router.post("/sync")
|
||||
async def sync_d2l():
|
||||
return service.sync_to_store()
|
||||
Reference in New Issue
Block a user