diff --git a/appview/lib/atvouch/xrpc_router.ex b/appview/lib/atvouch/xrpc_router.ex index 57cc28e..f18e497 100644 --- a/appview/lib/atvouch/xrpc_router.ex +++ b/appview/lib/atvouch/xrpc_router.ex @@ -136,8 +136,8 @@ defmodule Atvouch.XrpcRouter do defp parse_limit(%{"limit" => limit_str}) do case Integer.parse(limit_str) do - {limit, ""} when limit >= 1 and limit <= 100 -> {:ok, limit} - _ -> {:error, "limit must be an integer between 1 and 100"} + {limit, ""} when limit >= 1 and limit <= 1000 -> {:ok, limit} + _ -> {:error, "limit must be an integer between 1 and 1000"} end end diff --git a/appview/test/atvouch/xrpc_vouches_test.exs b/appview/test/atvouch/xrpc_vouches_test.exs index 0b79bf9..e16b01d 100644 --- a/appview/test/atvouch/xrpc_vouches_test.exs +++ b/appview/test/atvouch/xrpc_vouches_test.exs @@ -189,9 +189,9 @@ defmodule Atvouch.XrpcVouchesTest do assert conn.status == 400 end - test "returns 400 with limit over 100" do + test "returns 400 with limit over 1000" do conn = - conn(:get, "/xrpc/dev.atvouch.graph.getCurrentUserVouches?limit=101") + conn(:get, "/xrpc/dev.atvouch.graph.getCurrentUserVouches?limit=1001") |> put_req_header("authorization", "Bearer valid-token:did:plc:alice") |> Atvouch.Router.call(@opts) @@ -396,9 +396,9 @@ defmodule Atvouch.XrpcVouchesTest do assert conn.status == 400 end - test "returns 400 with limit over 100" do + test "returns 400 with limit over 1000" do conn = - conn(:get, "/xrpc/dev.atvouch.graph.getRemoteVouches?limit=101") + conn(:get, "/xrpc/dev.atvouch.graph.getRemoteVouches?limit=1001") |> put_req_header("authorization", "Bearer valid-token:did:plc:alice") |> Atvouch.Router.call(@opts) @@ -538,9 +538,9 @@ defmodule Atvouch.XrpcVouchesTest do assert conn.status == 400 end - test "returns 400 with limit over 100" do + test "returns 400 with limit over 1000" do conn = - conn(:get, "/xrpc/dev.atvouch.graph.getEntireGraph?limit=101") + conn(:get, "/xrpc/dev.atvouch.graph.getEntireGraph?limit=1001") |> Atvouch.Router.call(@opts) assert conn.status == 400 diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index a3876fb..e9aafb5 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -191,10 +191,18 @@ function Dashboard({ setVouchesLoading(true); setVouchesError(null); try { - const result = await listVouches(agent); - setVouches(result.vouches); - setVouchesTotal(result.total); - setVouchesCursor(result.cursor); + let allVouches: VouchEntry[] = []; + let cursor: string | undefined; + let total = 0; + do { + const result = await listVouches(agent, { limit: 1000, cursor }); + allVouches = [...allVouches, ...result.vouches]; + total = result.total; + cursor = result.cursor; + } while (cursor); + setVouches(allVouches); + setVouchesTotal(total); + setVouchesCursor(undefined); } catch (err) { setVouchesError(String(err)); } @@ -428,10 +436,19 @@ function RemoteVouchesSection({ setLoading(true); setError(null); try { - const result = await fetchRemoteVouchers(agent); - setVouchers(await resolveVouches(result.vouches)); - setTotal(result.total); - setCursor(result.cursor); + let allVouches: RemoteVoucher[] = []; + let pageCursor: string | undefined; + let total = 0; + do { + const result = await fetchRemoteVouchers(agent, { limit: 1000, cursor: pageCursor }); + const resolved = await resolveVouches(result.vouches); + allVouches = [...allVouches, ...resolved]; + total = result.total; + pageCursor = result.cursor; + } while (pageCursor); + setVouchers(allVouches); + setTotal(total); + setCursor(undefined); } catch (err) { setError(String(err)); } diff --git a/lexicons/dev/atvouch/graph/getCurrentUserVouches.json b/lexicons/dev/atvouch/graph/getCurrentUserVouches.json index eb27ebc..f631a7e 100644 --- a/lexicons/dev/atvouch/graph/getCurrentUserVouches.json +++ b/lexicons/dev/atvouch/graph/getCurrentUserVouches.json @@ -11,7 +11,7 @@ "limit": { "type": "integer", "minimum": 1, - "maximum": 100, + "maximum": 1000, "default": 50 }, "cursor": { "type": "string" } diff --git a/lexicons/dev/atvouch/graph/getRemoteVouches.json b/lexicons/dev/atvouch/graph/getRemoteVouches.json index 75f29d6..d8f4c9e 100644 --- a/lexicons/dev/atvouch/graph/getRemoteVouches.json +++ b/lexicons/dev/atvouch/graph/getRemoteVouches.json @@ -11,7 +11,7 @@ "limit": { "type": "integer", "minimum": 1, - "maximum": 100, + "maximum": 1000, "default": 50 }, "cursor": { "type": "string" }