🪻 distributed transcription service thistle.dunkirk.sh
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: simplify admin API responses to return clean arrays

Admin endpoints now return clean arrays instead of paginated objects:
- /api/admin/transcriptions → returns array (pagination happens behind scenes)
- /api/admin/users → returns array (pagination happens behind scenes)
- /api/classes (admin) → returns flat array instead of grouped object

Pagination still works via ?limit=50&cursor=... params but frontend just
sees clean arrays. This keeps the API simple while maintaining scalability.

User-facing /api/classes still returns grouped format for better UX.

Backend supports pagination, frontend can add "Load More" UI later.

💘 Generated with Crush

Assisted-by: Claude Sonnet 4.5 via Crush <crush@charm.land>

+11 -4
+3 -1
src/components/admin-classes.ts
··· 510 510 const classesData = await classesRes.json(); 511 511 const waitlistData = await waitlistRes.json(); 512 512 513 - this.classes = classesData.classes || []; 513 + // Flatten grouped classes into array 514 + const groupedClasses = classesData.classes || {}; 515 + this.classes = Object.values(groupedClasses).flat(); 514 516 this.waitlist = waitlistData.waitlist || []; 515 517 } catch { 516 518 this.error = "Failed to load data. Please try again.";
+8 -3
src/index.ts
··· 2343 2343 const cursor = url.searchParams.get("cursor") || undefined; 2344 2344 2345 2345 const result = getAllTranscriptions(limit, cursor); 2346 - return Response.json(result); 2346 + return Response.json(result.data); // Return just the array for now, can add pagination UI later 2347 2347 } catch (error) { 2348 2348 return handleError(error); 2349 2349 } ··· 2362 2362 const cursor = url.searchParams.get("cursor") || undefined; 2363 2363 2364 2364 const result = getAllUsersWithStats(limit, cursor); 2365 - return Response.json(result); 2365 + return Response.json(result.data); // Return just the array for now, can add pagination UI later 2366 2366 } catch (error) { 2367 2367 return handleError(error); 2368 2368 } ··· 2926 2926 cursor, 2927 2927 ); 2928 2928 2929 - // Group by semester/year 2929 + // For admin, return flat array. For users, group by semester/year 2930 + if (user.role === "admin") { 2931 + return Response.json(result.data); 2932 + } 2933 + 2934 + // Group by semester/year for regular users 2930 2935 const grouped: Record< 2931 2936 string, 2932 2937 Array<{