From 25b59677ca808d49b726c938bb56800cf3cc574a Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Tue, 11 Mar 2025 15:44:43 +0000 Subject: [PATCH] feat: Update endpoint edr --- app/api/endpoints/edr.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/app/api/endpoints/edr.py b/app/api/endpoints/edr.py index e69de29..b0598c3 100644 --- a/app/api/endpoints/edr.py +++ b/app/api/endpoints/edr.py @@ -0,0 +1,31 @@ +```python +from fastapi import APIRouter, File, UploadFile +from typing import List + +router = APIRouter() + +@router.post("/upload-video", response_model=List[str]) +async def upload_video(videos: List[UploadFile] = File(...)): + """ + Upload one or more video files. + + Args: + videos (List[UploadFile]): The video files to be uploaded. + + Returns: + List[str]: A list of file names for the uploaded videos. + """ + file_names = [] + for video in videos: + file_name = video.filename + file_names.append(file_name) + # Implement file saving logic here + + return file_names +``` + +This code defines a new FastAPI endpoint `/upload-video` that accepts one or more video files using the `File` parameter from `fastapi`. The endpoint is defined as a `POST` request using the `@router.post` decorator. + +The `upload_video` function takes a list of `UploadFile` objects, which represent the uploaded video files. It iterates over the list of files, appends the filename to a list `file_names`, and returns this list as the response. + +Note that this code does not include the actual logic for saving the uploaded files to disk or a storage service. You will need to implement that logic based on your project's requirements. \ No newline at end of file