Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions hillstack/src/app/congress/committees/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ const CHAMBERS: ToolbarFilterOption<legislationchamber>[] = [
{ value: 'Senate', label: 'Senate' },
];

const HAS_LEGISLATION: ToolbarFilterOption<boolean>[] = [
{ value: true, label: 'Has Legislation' },
];

// const TYPES: ToolbarFilterOption<string>[] = [
// { value: 'Standing', label: 'Standing' },
// { value: 'Joint', label: 'Joint' },
Expand All @@ -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,
Expand Down
6 changes: 5 additions & 1 deletion hillstack/src/server/api/routers/committee.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -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: {
Expand Down