diff --git a/backend/app/routers/spreadsheet.py b/backend/app/routers/spreadsheet.py index 65db3d3..0c2e9a3 100644 --- a/backend/app/routers/spreadsheet.py +++ b/backend/app/routers/spreadsheet.py @@ -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: diff --git a/backend/app/sample_models.py b/backend/app/sample_models.py index 32aa9e7..ffa5b1d 100644 --- a/backend/app/sample_models.py +++ b/backend/app/sample_models.py @@ -260,4 +260,11 @@ class SpreadsheetModel(BaseModel): return v class TELLModel(SpreadsheetModel): - pass # Extend the SpreadsheetModel with TELL-specific fields if needed \ No newline at end of file + input_order: int + samplemountcount: int = 0 + samplestatus: str = "not present" + puckaddress: str = "---" + username: str + puck_number: int + prefix: Optional[str] + folder: Optional[str] \ No newline at end of file diff --git a/backend/downloads/V7_TELLSamplesSpreadsheetTemplate.xlsx b/backend/downloads/V7_TELLSamplesSpreadsheetTemplate.xlsx new file mode 100644 index 0000000..4bc600d Binary files /dev/null and b/backend/downloads/V7_TELLSamplesSpreadsheetTemplate.xlsx differ diff --git a/frontend/src/components/UploadDialog.tsx b/frontend/src/components/UploadDialog.tsx index bdad686..ffa3da6 100644 --- a/frontend/src/components/UploadDialog.tsx +++ b/frontend/src/components/UploadDialog.tsx @@ -28,8 +28,7 @@ const UploadDialog: React.FC = ({ open, onClose }) => { dewars: string[]; pucks_count: number; pucks: string[]; - samples_count: number; - samples: string[]; + samples_count: string[]; } | null>(null); useEffect(() => { @@ -86,9 +85,9 @@ const UploadDialog: React.FC = ({ open, onClose }) => { Logo - Latest Spreadsheet Template Version 6 - Last update: October 18, 2024 - Latest Spreadsheet Instructions Version 2.3