Exercise 1: The Parent Picker — Possible Solution ==================================================================== // src/pages/api/pages/candidates.ts export const GET: APIRoute = async ({ url }) => { const excludeId = Number(url.searchParams.get('exclude')); const candidates = await db .select({ id: pages.id, fullPath: pages.fullPath }) .from(pages) .where(ne(pages.id, excludeId)); return new Response(JSON.stringify(candidates), { headers: { 'Content-Type': 'application/json' }, }); }; // admin page (excerpt) - a plain filtering a WHY THIS WORKS AS AN ANSWER ------------------------------ It correctly excludes the page being edited from its own candidate list via ne(pages.id, excludeId) - reparenting a page under itself would corrupt the tree - and correctly implements simple client-side filtering over the resulting flat list, matching the same searchable-flat-list convention every sibling course already used.