mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: add element_id to file upload params
This commit is contained in:
parent
4e539865c9
commit
643d4ae2e7
1 changed files with 9 additions and 8 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
from fastapi import APIRouter, Depends
|
from fastapi import APIRouter, Depends, UploadFile, Form
|
||||||
from src.dependencies.auth import get_current_user
|
from src.dependencies.auth import get_current_user
|
||||||
from fastapi import HTTPException, status, UploadFile
|
from fastapi import HTTPException, status, UploadFile
|
||||||
|
|
||||||
|
|
@ -10,31 +10,32 @@ router = APIRouter()
|
||||||
|
|
||||||
|
|
||||||
@router.post("/picture")
|
@router.post("/picture")
|
||||||
async def api_create_picture_file(file_object: UploadFile, current_user: PublicUser = Depends(get_current_user)):
|
async def api_create_picture_file(file_object: UploadFile, element_id: str = Form(), current_user: PublicUser = Depends(get_current_user)):
|
||||||
"""
|
"""
|
||||||
Create new picture file
|
Create new picture file
|
||||||
"""
|
"""
|
||||||
return await create_picture_file(file_object, "ed_123")
|
return await create_picture_file(file_object, element_id)
|
||||||
|
|
||||||
|
|
||||||
@router.post("/video")
|
@router.post("/video")
|
||||||
async def api_create_video_file(file_object: UploadFile, current_user: PublicUser = Depends(get_current_user)):
|
async def api_create_video_file(file_object: UploadFile,element_id: str = Form(), current_user: PublicUser = Depends(get_current_user)):
|
||||||
"""
|
"""
|
||||||
Create new video file
|
Create new video file
|
||||||
"""
|
"""
|
||||||
return await create_video_file(file_object, "ed_123")
|
return await create_video_file(file_object, element_id)
|
||||||
|
|
||||||
|
|
||||||
@router.get("/picture")
|
@router.get("/picture")
|
||||||
async def api_get_picture_file(file_id :str ,current_user: PublicUser = Depends(get_current_user)):
|
async def api_get_picture_file(file_id: str, current_user: PublicUser = Depends(get_current_user)):
|
||||||
"""
|
"""
|
||||||
Get picture file
|
Get picture file
|
||||||
"""
|
"""
|
||||||
return await get_picture_file(file_id, current_user)
|
return await get_picture_file(file_id, current_user)
|
||||||
|
|
||||||
|
|
||||||
@router.get("/video")
|
@router.get("/video")
|
||||||
async def api_get_video_file(file_id :str ,current_user: PublicUser = Depends(get_current_user)):
|
async def api_get_video_file(file_id: str, current_user: PublicUser = Depends(get_current_user)):
|
||||||
"""
|
"""
|
||||||
Get video file
|
Get video file
|
||||||
"""
|
"""
|
||||||
return await get_video_file(file_id, current_user)
|
return await get_video_file(file_id, current_user)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue