From 6a46ee3fc7ef91288812d9f959659e4ca9a3c947 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 24 Feb 2026 02:49:40 +0000 Subject: [PATCH] Add 'Has Legislation' filter to committee search page Adds a new filter option to the committee search page that lets users show only committees with at least one associated piece of legislation. The filter uses the legislation_committee_association relation in Prisma. https://claude.ai/code/session_011Hj5qzy97tPv9TqMs5nuXX --- hillstack/src/app/congress/committees/layout.tsx | 9 +++++++++ hillstack/src/server/api/routers/committee.ts | 6 +++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/hillstack/src/app/congress/committees/layout.tsx b/hillstack/src/app/congress/committees/layout.tsx index 465846f..aad259f 100644 --- a/hillstack/src/app/congress/committees/layout.tsx +++ b/hillstack/src/app/congress/committees/layout.tsx @@ -15,6 +15,10 @@ const CHAMBERS: ToolbarFilterOption[] = [ { value: 'Senate', label: 'Senate' }, ]; +const HAS_LEGISLATION: ToolbarFilterOption[] = [ + { value: true, label: 'Has Legislation' }, +]; + // const TYPES: ToolbarFilterOption[] = [ // { value: 'Standing', label: 'Standing' }, // { value: 'Joint', label: 'Joint' }, @@ -33,6 +37,11 @@ const filterConfig = { options: CHAMBERS, multiSelect: true as const, }, + hasLegislation: { + title: 'Legislation', + options: HAS_LEGISLATION, + multiSelect: true as const, + }, // committeeType: { // title: 'Type', // options: TYPES, diff --git a/hillstack/src/server/api/routers/committee.ts b/hillstack/src/server/api/routers/committee.ts index 2c55b76..dd8c087 100644 --- a/hillstack/src/server/api/routers/committee.ts +++ b/hillstack/src/server/api/routers/committee.ts @@ -87,12 +87,13 @@ export const committeeRouter = createTRPCRouter({ congress: z.optional(z.array(z.number())), chamber: z.optional(z.array(z.nativeEnum(legislationchamber))), committeeType: z.optional(z.array(z.string())), + hasLegislation: z.optional(z.array(z.boolean())), page: z.number(), pageSize: z.number(), }), ) .query(async ({ input, ctx }) => { - const { query, congress, chamber, committeeType, page, pageSize } = + const { query, congress, chamber, committeeType, hasLegislation, page, pageSize } = input; const where = { @@ -104,6 +105,9 @@ export const committeeRouter = createTRPCRouter({ ? { congress: { session_number: { in: congress } } } : {}), ...(chamber ? { chamber: { in: chamber } } : {}), + ...(hasLegislation?.includes(true) + ? { legislation_committee_association: { some: {} } } + : {}), ...(query ? { name: {