feat(trpc): add getBookingStats query procedure#6
Open
AdamWalkerQodo wants to merge 1 commit into
Open
Conversation
Returns booking counts grouped by status (accepted, pending, cancelled, rejected, awaiting_host) for the authenticated user, with optional date range filtering.
Review Summary by QodoAdd getBookingStats query procedure for booking statistics
WalkthroughsDescription• Adds getBookingStats tRPC query procedure to retrieve booking counts grouped by status • Supports optional date range filtering via startDate and endDate ISO string parameters • Returns booking counts for all statuses (accepted, pending, cancelled, rejected, awaiting_host) with zero defaults • Follows existing handler + schema pattern for consistency with other procedures Diagramflowchart LR
A["User Request"] -->|"getBookingStats query"| B["Schema Validation"]
B -->|"Input validation"| C["Handler Logic"]
C -->|"Filter by userId & dates"| D["Prisma groupBy"]
D -->|"Count by status"| E["Response Object"]
E -->|"Return stats"| F["Client Data"]
File Changes1. packages/trpc/server/routers/loggedInViewer/getBookingStats.handler.ts
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
getBookingStatstRPC query onloggedInViewerRoutertotal,accepted,pending,cancelled,rejected,awaiting_hoststartDate/endDateISO string filter for scoping the query to a date rangemarkNoShowand other proceduresChanged files
packages/trpc/server/routers/loggedInViewer/getBookingStats.schema.ts(new)packages/trpc/server/routers/loggedInViewer/getBookingStats.handler.ts(new)packages/trpc/server/routers/loggedInViewer/_router.tsx(register procedure)Usage
Test plan
0rather thanundefined🤖 Generated with Claude Code