diff --git a/web/src/lib/stores/profile_store.ts b/web/src/lib/stores/profile_store.ts index d8fb6f2a..75260a10 100644 --- a/web/src/lib/stores/profile_store.ts +++ b/web/src/lib/stores/profile_store.ts @@ -117,7 +117,6 @@ export async function profile_stats_index(handle: string, filter: SummitLogFilte const r = await f(`/api/v1/profile/${handle}/stats?` + new URLSearchParams({ filter: filterText, - perPage: "-1", expand: "trail.category,author", sort: "+date", }), { @@ -129,8 +128,8 @@ export async function profile_stats_index(handle: string, filter: SummitLogFilte throw new APIError(r.status, response.message, response.detail) } - const result: ListResult = await r.json(); + const result: SummitLog[] = await r.json(); - return result.items; + return result; } \ No newline at end of file diff --git a/web/src/routes/api/v1/profile/[handle]/stats/+server.ts b/web/src/routes/api/v1/profile/[handle]/stats/+server.ts index 4559a66a..0e238860 100644 --- a/web/src/routes/api/v1/profile/[handle]/stats/+server.ts +++ b/web/src/routes/api/v1/profile/[handle]/stats/+server.ts @@ -16,10 +16,16 @@ export async function GET(event: RequestEvent) { const searchParams = Object.fromEntries(event.url.searchParams); const safeSearchParams = RecordListOptionsSchema.parse(searchParams); - let summitLogs: ListResult; + if(safeSearchParams.filter?.length) { + safeSearchParams.filter = safeSearchParams.filter + `&&author='${actor.id}'` + }else { + safeSearchParams.filter = `author='${actor.id}'` + } + + let summitLogs: SummitLog[]; if (actor.isLocal) { summitLogs = await event.locals.pb.collection(Collection.summit_logs) - .getList(safeSearchParams.page, safeSearchParams.perPage, { ...safeSearchParams, filter: `author='${actor.id}'` }) + .getFullList(safeSearchParams.page, { ...safeSearchParams }) } else { const origin = new URL(actor.iri).origin const summitLogURL = `${origin}/api/v1/profile/${actor.preferred_username}/stats?` + event.url.searchParams @@ -30,7 +36,7 @@ export async function GET(event: RequestEvent) { } summitLogs = await response.json() - summitLogs.items.forEach(i => { + summitLogs.forEach(i => { i.photos = i.photos.map(p => `${origin}/api/v1/files/summit_logs/${i.id}/${p}` )