Added TELL spreadsheet template

This commit is contained in:
GotthardG
2024-11-06 16:54:34 +01:00
parent 3cf9c669b9
commit eed50aa942
4 changed files with 27 additions and 6 deletions

View File

@ -1,11 +1,26 @@
from fastapi import APIRouter, UploadFile, File, HTTPException
import logging
from app.services.spreadsheet_service import SampleSpreadsheetImporter, SpreadsheetImportError
from fastapi.responses import FileResponse
import os
router = APIRouter()
logger = logging.getLogger(__name__)
@router.get("/download-template", response_class=FileResponse)
async def download_template():
# Constructing the absolute path
current_dir = os.path.dirname(__file__)
template_path = os.path.join(current_dir, "../../downloads/V7_TELLSamplesSpreadsheetTemplate.xlsx")
if not os.path.exists(template_path):
raise HTTPException(status_code=404, detail="Template file not found.")
return FileResponse(template_path, filename="V7_TELLSamplesSpreadsheetTemplate.xlsx",
media_type="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
@router.post("/upload")
async def upload_file(file: UploadFile = File(...)):
try:

View File

@ -260,4 +260,11 @@ class SpreadsheetModel(BaseModel):
return v
class TELLModel(SpreadsheetModel):
pass # Extend the SpreadsheetModel with TELL-specific fields if needed
input_order: int
samplemountcount: int = 0
samplestatus: str = "not present"
puckaddress: str = "---"
username: str
puck_number: int
prefix: Optional[str]
folder: Optional[str]