from fastapi import APIRouter, Depends from app.dependencies import validate_token from app.plan.schemas import PlanTriggerRequest from app.utils import read_csv_from_s3, logger from app.config import get_settings router = APIRouter( prefix="/plan", tags=["plan"], dependencies=[Depends(validate_token)], responses={404: {"description": "Not found"}} ) @router.post("/trigger") async def trigger_plan(body: PlanTriggerRequest): logger.info("Getting the inputs") # Read in the trigger file from s3 bucket_name = get_settings().PLAN_TRIGGER_BUCKET logger.info("bucket_name: ", bucket_name) logger.info("body.trigger_file_path: ", body.trigger_file_path) plan_input = read_csv_from_s3(bucket_name=bucket_name, filepath=body.trigger_file_path) logger.info("Got the inputs") logger.info(plan_input) # TODO: Parse the file # TODO: Put messages on the queue return {"message": "Plan triggered"}