Extract shared pagination type and refactor response types#127
Conversation
Extract inline object types into properly named, reusable types across the codebase to improve readability and enable safer refactoring. Shared package: - PaginationInfo: consolidates pagination fields from EncounterListResponse and CollectiveListResponse into packages/shared/src/pagination.ts - CollectiveTypeSummary: type summary in collective list items - RelationshipTypeSummary: relationship type metadata in preview items - FriendPreview: friend object within upcoming dates - CircleReorderItem: extracted from inline CircleReorderSchema Auth types: - UserWithPreferencesResponse: GET /api/auth/me response - PreferencesResponse: PATCH /api/auth/preferences response - ForgotPasswordResponse: POST /api/auth/forgot-password response - HealthCheckResponse: GET /api/health response Frontend: - UpcomingDatesOptions: parameters for upcoming dates queries - Replace duplicate PaginationState interfaces in encounters and collectives stores with shared PaginationInfo Backend: - Update auth routes to use shared response types - Update health route to use HealthCheckResponse Closes #126 https://claude.ai/code/session_01Ggmu9YzZBUq3ETBuiyXcXV
🔍 Automated Code Review
Findings
AGENTS.md Compliance
SummaryClean, well-scoped refactoring that eliminates duplicated inline type definitions. Extracting One minor suggestion: 🤖 Automated review by Claude Code • View CI Run |
|
🎉 This PR is included in version 2.65.9 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Summary
This PR extracts pagination metadata into a shared type and refactors response types across the codebase for better type reusability and consistency. The changes improve type safety and reduce duplication in API response definitions.
Key Changes
PaginationInfointerface inpackages/shared/src/pagination.tsto standardize pagination metadata across paginated API responsesUserWithPreferencesResponse,PreferencesResponse,ForgotPasswordResponse,HealthCheckResponse) inpackages/shared/src/auth.tsfor better API documentation and type safetyCollectiveTypeSummaryandRelationshipTypeSummaryinterfaces to reduce inline type definitions and improve reusabilityFriendPreviewinterface for use in dashboard and summary viewsCircleReorderItemSchemato avoid inline schema duplication in circle reorder requestsauth.tsandhealth.tsroutesPaginationStateinterfaces with sharedPaginationInfotype in collectives and encounters storesUpcomingDatesOptionsinterface for better API function documentationImplementation Details
PaginationInfotype from the shared packageCollectiveTypeSummary,RelationshipTypeSummary) follow a consistent naming patternhttps://claude.ai/code/session_01Ggmu9YzZBUq3ETBuiyXcXV