kinda doesnt work yet
This commit is contained in:
29
app/routes/manabox_routes.py
Normal file
29
app/routes/manabox_routes.py
Normal file
@ -0,0 +1,29 @@
|
||||
from fastapi import APIRouter, Depends, UploadFile, File, HTTPException
|
||||
from sqlalchemy.orm import Session
|
||||
from app.db.database import get_db
|
||||
from app.services.service_manager import ServiceManager
|
||||
|
||||
router = APIRouter(prefix="/manabox")
|
||||
|
||||
service_manager = ServiceManager()
|
||||
|
||||
@router.post("/process-csv")
|
||||
async def process_manabox_csv(
|
||||
file: UploadFile = File(...),
|
||||
db: Session = Depends(get_db)
|
||||
):
|
||||
try:
|
||||
|
||||
content = await file.read()
|
||||
|
||||
manabox_service = service_manager.get_service("manabox")
|
||||
|
||||
success = await manabox_service.process_manabox_csv(db, content)
|
||||
|
||||
if not success:
|
||||
raise HTTPException(status_code=400, detail="Failed to process CSV file")
|
||||
|
||||
return {"message": "CSV processed successfully"}
|
||||
|
||||
except Exception as e:
|
||||
raise HTTPException(status_code=500, detail=str(e))
|
Reference in New Issue
Block a user