feat(backend): add sample options for freight config dialog

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
zlwuandCursor committed 2026-10-08 09:59:29 +08:00
1 parent 971af93132
commit f092b64a33
2 files changed
+196 -1

No files matched your search

+28
View File
@@ -100,6 +100,34 @@ async def list_sample_freights(
return error_response(400, str(e))
@router.get("/sample-freights/sample-options")
async def list_sample_freight_options(
page: int = Query(1, ge=1),
pageSize: int = Query(20, ge=1, le=100, alias="pageSize"),
keyword: Optional[str] = None,
sampleSource: Optional[str] = None,
user: dict = Depends(require_admin_or_super_admin),
db: Session = Depends(get_db),
):
try:
tenant_no = _get_tenant_no(db, user)
items, total = freight_svc.list_sample_options(
db,
tenant_no=tenant_no,
page=page,
page_size=pageSize,
keyword=keyword,
sample_source=sampleSource,
)
return success_response(
{"list": items, "total": total, "page": page, "pageSize": pageSize}
)
except PermissionError as e:
return error_response(403, str(e))
except ValueError as e:
return error_response(400, str(e))
@router.get("/sample-freights/{freight_id}")
async def get_sample_freight(
freight_id: str,