Files
romm/backend/endpoints/tasks.py

25 lines
695 B
Python

from decorators.auth import protected_route
from endpoints.responses import MessageResponse
from fastapi import APIRouter, Request
from tasks.update_mame_xml import update_mame_xml_task
from tasks.update_switch_titledb import update_switch_titledb_task
router = APIRouter()
@protected_route(router.post, "/tasks/run", ["tasks.run"])
async def run_tasks(request: Request) -> MessageResponse:
"""Run all tasks endpoint
Args:
request (Request): Fastapi Request object
Returns:
RunTasksResponse: Standard message response
"""
await update_mame_xml_task.run()
await update_switch_titledb_task.run()
return {"message": "All tasks run successfully!"}