fix: Bugs created after the overhaul, performance and layout fixes
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from fastapi import APIRouter, Depends, Query
|
||||
from fastapi import APIRouter, Depends, Query, UploadFile, File
|
||||
from fastapi.responses import StreamingResponse
|
||||
from typing import Optional
|
||||
import io
|
||||
@@ -28,6 +28,14 @@ async def get_next_number(
|
||||
return NextNumberResponse(next_number=next_num)
|
||||
|
||||
|
||||
@router.get("/all", response_model=list[dict])
|
||||
async def list_all_quotations(
|
||||
_user: TokenPayload = Depends(require_permission("crm", "view")),
|
||||
):
|
||||
"""Returns all quotations across all customers, each including customer_name."""
|
||||
return await svc.list_all_quotations()
|
||||
|
||||
|
||||
@router.get("/customer/{customer_id}", response_model=QuotationListResponse)
|
||||
async def list_quotations_for_customer(
|
||||
customer_id: str,
|
||||
@@ -99,3 +107,15 @@ async def regenerate_pdf(
|
||||
):
|
||||
"""Force PDF regeneration and re-upload to Nextcloud."""
|
||||
return await svc.regenerate_pdf(quotation_id)
|
||||
|
||||
|
||||
@router.post("/{quotation_id}/legacy-pdf", response_model=QuotationInDB)
|
||||
async def upload_legacy_pdf(
|
||||
quotation_id: str,
|
||||
file: UploadFile = File(...),
|
||||
_user: TokenPayload = Depends(require_permission("crm", "edit")),
|
||||
):
|
||||
"""Upload a PDF file for a legacy quotation and store its Nextcloud path."""
|
||||
pdf_bytes = await file.read()
|
||||
filename = file.filename or f"legacy-{quotation_id}.pdf"
|
||||
return await svc.upload_legacy_pdf(quotation_id, pdf_bytes, filename)
|
||||
|
||||
Reference in New Issue
Block a user