mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-26 01:06:23 +02:00
feat: Implement file upload limits and page limit enforcement in backend
- Added constants for maximum files per upload, per-file size, and total upload size. - Enhanced document upload route to validate file counts and sizes, returning appropriate HTTP errors. - Introduced end-to-end tests for upload limits and page limit enforcement, ensuring correct behavior under various scenarios. - Updated test helpers to support notification retrieval for page limit exceeded scenarios.
This commit is contained in:
parent
93c0af475b
commit
a57ab02900
7 changed files with 628 additions and 2 deletions
|
|
@ -184,3 +184,29 @@ async def delete_document(
|
|||
f"/api/v1/documents/{document_id}",
|
||||
headers=headers,
|
||||
)
|
||||
|
||||
|
||||
async def get_notifications(
|
||||
client: httpx.AsyncClient,
|
||||
headers: dict[str, str],
|
||||
*,
|
||||
type_filter: str | None = None,
|
||||
search_space_id: int | None = None,
|
||||
limit: int = 50,
|
||||
) -> list[dict]:
|
||||
"""Fetch notifications for the authenticated user, optionally filtered by type."""
|
||||
params: dict[str, str | int] = {"limit": limit}
|
||||
if type_filter:
|
||||
params["type"] = type_filter
|
||||
if search_space_id is not None:
|
||||
params["search_space_id"] = search_space_id
|
||||
|
||||
resp = await client.get(
|
||||
"/api/v1/notifications",
|
||||
headers=headers,
|
||||
params=params,
|
||||
)
|
||||
assert resp.status_code == 200, (
|
||||
f"GET notifications failed ({resp.status_code}): {resp.text}"
|
||||
)
|
||||
return resp.json()["items"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue