-
Notifications
You must be signed in to change notification settings - Fork 1k
#15028 Add validation for API route format #15097
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for care-ohc ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
WalkthroughAPI route parsing in Changes
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (11)**/*.{ts,tsx}📄 CodeRabbit inference engine (.cursorrules)
Files:
**/*.{ts,tsx,js,jsx}📄 CodeRabbit inference engine (.cursorrules)
Files:
src/**/*.{ts,tsx}📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
src/**/*.{ts,tsx,css}📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
src/{Utils,types,providers}/**/*.{ts,tsx}📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
src/**/*.{tsx,ts}📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
src/Utils/**/*.{ts,tsx}📄 CodeRabbit inference engine (.github/instructions/utils.instructions.md)
Files:
**/*📄 CodeRabbit inference engine (CLAUDE.md)
Files:
**/*.ts📄 CodeRabbit inference engine (.cursor/rules/02-coding-standards.mdc)
Files:
**/*.{tsx,ts}📄 CodeRabbit inference engine (.cursor/rules/04-ui-components.mdc)
Files:
**/*.{ts,tsx,js,jsx,json,css,scss,html}📄 CodeRabbit inference engine (AGENTS.md)
Files:
🧠 Learnings (17)📓 Common learnings📚 Learning: 2025-11-25T13:53:40.623ZApplied to files:
📚 Learning: 2025-11-25T13:54:24.075ZApplied to files:
📚 Learning: 2025-11-25T13:53:40.623ZApplied to files:
📚 Learning: 2025-11-25T13:54:24.075ZApplied to files:
📚 Learning: 2025-11-25T13:53:40.623ZApplied to files:
📚 Learning: 2025-11-25T13:53:40.623ZApplied to files:
📚 Learning: 2025-11-25T13:53:40.623ZApplied to files:
📚 Learning: 2025-11-25T13:52:19.758ZApplied to files:
📚 Learning: 2025-11-25T13:53:40.623ZApplied to files:
📚 Learning: 2024-11-14T08:07:32.427ZApplied to files:
📚 Learning: 2025-11-25T13:53:40.623ZApplied to files:
📚 Learning: 2025-11-25T13:49:43.065ZApplied to files:
📚 Learning: 2025-11-25T13:53:40.623ZApplied to files:
📚 Learning: 2024-11-20T23:25:06.602ZApplied to files:
📚 Learning: 2025-01-11T06:18:13.844ZApplied to files:
📚 Learning: 2025-11-25T13:49:43.065ZApplied to files:
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
🔇 Additional comments (3)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
PR opened: #15028 |
🚀 Preview Deployment Ready!
This preview will be automatically updated when you push new commits to this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In @src/Utils/request/utils.ts:
- Around line 24-32: The duplicate whitespace handling is unnecessary: remove
the redundant path.trim() call in the empty-path check and just test the raw
path string (e.g. if (!path || path.length === 0) throw ...), leaving the later
startsWith("/") validation unchanged; update the error message uses of
route/path as needed and ensure you reference the same variables ('path' and
'route') in the thrown Error.
📜 Review details
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
src/Utils/request/utils.ts
🧰 Additional context used
📓 Path-based instructions (11)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursorrules)
**/*.{ts,tsx}: Write concise, technical TypeScript code with accurate examples
Use TypeScript for all code; prefer interfaces over types
Avoid enums; use maps instead
Use TanStack Query for data fetching from the API along with query and mutate utilities for the queryFn and mutationFn
Use raviger for routing
**/*.{ts,tsx}: Use TypeScript with strict mode and ES2022 target
Useinterfacefor defining object types in TypeScript
Avoid explicitanytype in TypeScript
Use proper nullability annotations in TypeScript types
Use dedicated error handlers and TypeScript strict null checks
**/*.{ts,tsx}: Use TypeScript for all new code
Prefer interfaces over types for object definitions in TypeScript
Avoid usinganytype; use proper type definitions in TypeScript
Use type inference where possible in TypeScript
Use TanStack Query for API data management
Prefer React Context for global state management
**/*.{ts,tsx}: Use TanStack Query with thequeryandmutateutilities from@/Utils/request/
Use appropriate query keys following the resource pattern for TanStack Query
Leverage TanStack Query built-in features for pagination and debouncing
Implement proper error handling using the global error handler for TanStack Query operations
UseuseQueryhook withqueryKeyandqueryFnparameters, wherequeryFnwraps the API route with thequery()utility
UseuseMutationhook withmutationFnparameter wrapping API routes with themutate()utility, and implementonSuccesscallbacks to invalidate related queries
Support path parameters in TanStack Query using thepathParamsoption in query/mutate utilities
Support query parameters in TanStack Query using thequeryParamsoption in query/mutate utilities
Use thesilent: trueoption to suppress global error notifications when custom error handling is needed
**/*.{ts,tsx}: Use TypeScript with strict mode and ES2022 target
Useinterfacefor defining object types
Avoid explicitanytypes and maint...
Files:
src/Utils/request/utils.ts
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.cursorrules)
**/*.{ts,tsx,js,jsx}: Use functional and declarative programming patterns; avoid classes
Prefer iteration and modularization over code duplication
Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError)
Use the "function" keyword for pure functions
Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements
**/*.{ts,tsx,js,jsx}: Use path aliases for imports from src (@/*)
Use double quotes for strings
Semicolons are required at end of statements
Order imports as: 3rd-party → library → CAREUI → UI → components → hooks → utils → relative
Use PascalCase for component and class names
Use camelCase for variable and function names
**/*.{ts,tsx,js,jsx}: Use path aliases@/*for imports from src directory
Use double quotes for strings
Require semicolons at end of statements
Order imports: 3rd-party → library → CAREUI → UI → components → hooks → utils → relative
Use PascalCase for component and class names
Use camelCase for variable and function names
Files:
src/Utils/request/utils.ts
src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
src/**/*.{ts,tsx}: Use strict TypeScript configuration for medical data safety in all TypeScript source files
All literal strings must use i18next for multi-language support in healthcare interfaces
Use comprehensive error boundaries and user-friendly error messages for medical workflow debugging without exposing PHI
Follow ESLint configured rules for React hooks, accessibility, and code quality
Use @tanstack/react-query for server state management in API client code
Localize date and time formats for medical timestamps using locale-aware formatting functions
Use date-fns for date handling and manipulation with locale awareness for medical timestamps
Files:
src/Utils/request/utils.ts
src/**/*.{ts,tsx,css}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use Prettier for consistent code formatting across the healthcare application
Files:
src/Utils/request/utils.ts
src/{Utils,types,providers}/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Document medical data flows, validation requirements, and healthcare workflows with clinical reasoning in API and utility code comments
Files:
src/Utils/request/utils.ts
src/**/*.{tsx,ts}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
src/**/*.{tsx,ts}: Use React 19.1.1 features and patterns following React 19 Documentation for healthcare application development
Use shadcn/ui as primary component system and CAREUI for healthcare-specific components
Use framer-motion for animations in healthcare UI interfaces
Files:
src/Utils/request/utils.ts
src/Utils/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/instructions/utils.instructions.md)
src/Utils/**/*.{ts,tsx}: Keep utilities organized by functionality insrc/Utils/with descriptive file names that indicate the utility's purpose
Export functions with clear, self-documenting names and group related utilities in the same file
Always provide proper TypeScript types for parameters and return values in utility functions
Use generic types where appropriate for reusability in utility functions
Avoidanytype; useunknownor proper type assertions in utility code
Export interfaces and types alongside utility functions in the same file
Prefer pure functions that don't have side effects; functions should be predictable and testable
Avoid modifying input parameters; return new objects/arrays using immutable data patterns
Implement proper error handling with try-catch blocks in utility functions
Return meaningful error messages or throw specific error types in utilities
Use TypeScript's strict null checks in utility code
Validate input parameters in utility functions when necessary
Use consistent patterns for API request handling in API utility functions
Implement proper error handling for network requests with appropriate HTTP status code handling
Include retry logic for transient failures in API utilities when appropriate
Usedate-fnslibrary for date manipulations in date and time utility functions
Handle timezone considerations properly in date and time utilities
Format dates consistently across the application using utility functions
Consider internationalization (i18n) for date formatting in utility functions
Usezodfor schema validation in validation utility functions
Create reusable validation schemas in validation utilities
Provide clear validation error messages in validation utilities
Handle both synchronous and asynchronous validation in validation utilities
Create helpers for common string operations in string utility functions
Implement proper text sanitization and formatting in string utilities
Handle Unicode and internationalizatio...
Files:
src/Utils/request/utils.ts
**/*
📄 CodeRabbit inference engine (CLAUDE.md)
Use 2-space indentation
Files:
src/Utils/request/utils.ts
**/*.ts
📄 CodeRabbit inference engine (.cursor/rules/02-coding-standards.mdc)
Use camelCase for utility file names (e.g.,
useAuth.ts)
Files:
src/Utils/request/utils.ts
**/*.{tsx,ts}
📄 CodeRabbit inference engine (.cursor/rules/04-ui-components.mdc)
**/*.{tsx,ts}: Use Shadcn UI components as the primary component library
Follow the component documentation for proper usage
Customize components using Tailwind CSS
UsenavigateanduseRedirectfrom raviger for navigation and redirects
Use Tailwind's responsive classes and follow mobile-first approach
Implement proper ARIA attributes for accessibility
Ensure keyboard navigation works in components
Define component props using TypeScript interfaces
Use translation keys fromsrc/Locale/for internationalization
Support RTL languages in components
Use proper date/time formatting for multiple language support
Files:
src/Utils/request/utils.ts
**/*.{ts,tsx,js,jsx,json,css,scss,html}
📄 CodeRabbit inference engine (AGENTS.md)
Use 2-space indentation
Files:
src/Utils/request/utils.ts
🧠 Learnings (10)
📓 Common learnings
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursor/rules/03-data-fetching.mdc:0-0
Timestamp: 2025-11-25T13:54:24.075Z
Learning: Applies to src/Utils/api.tsx : Use legacy API route definitions only in `src/Utils/api.tsx` with the `ApiRoute` type annotation for path-based route configuration
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Use consistent patterns for API request handling in API utility functions
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Validate input parameters in utility functions when necessary
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Provide clear validation error messages in validation utilities
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/pages.instructions.md:0-0
Timestamp: 2025-11-25T13:52:19.758Z
Learning: Applies to src/pages/**/*.{ts,tsx} : Implement proper route parameters and query string handling
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Handle both synchronous and asynchronous validation in validation utilities
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Implement proper error handling for network requests with appropriate HTTP status code handling
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursor/rules/03-data-fetching.mdc:0-0
Timestamp: 2025-11-25T13:54:24.075Z
Learning: Applies to **/types/**/*Api.ts : Define modern API routes in dedicated API files (`*Api.ts`) within the corresponding type directory using the pattern with `path`, `method`, `TRes`, and optional `TBody` properties
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Return meaningful error messages or throw specific error types in utilities
📚 Learning: 2025-11-25T13:53:40.623Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Use consistent patterns for API request handling in API utility functions
Applied to files:
src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:54:24.075Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursor/rules/03-data-fetching.mdc:0-0
Timestamp: 2025-11-25T13:54:24.075Z
Learning: Applies to src/Utils/api.tsx : Use legacy API route definitions only in `src/Utils/api.tsx` with the `ApiRoute` type annotation for path-based route configuration
Applied to files:
src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:54:24.075Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursor/rules/03-data-fetching.mdc:0-0
Timestamp: 2025-11-25T13:54:24.075Z
Learning: Applies to **/types/**/*Api.ts : Define modern API routes in dedicated API files (`*Api.ts`) within the corresponding type directory using the pattern with `path`, `method`, `TRes`, and optional `TBody` properties
Applied to files:
src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:53:40.623Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Validate input parameters in utility functions when necessary
Applied to files:
src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:52:19.758Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/pages.instructions.md:0-0
Timestamp: 2025-11-25T13:52:19.758Z
Learning: Applies to src/pages/**/*.{ts,tsx} : Implement proper route parameters and query string handling
Applied to files:
src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:53:40.623Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Provide clear validation error messages in validation utilities
Applied to files:
src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:53:40.623Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Implement proper error handling for network requests with appropriate HTTP status code handling
Applied to files:
src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:53:40.623Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Handle both synchronous and asynchronous validation in validation utilities
Applied to files:
src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:53:40.623Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Create helpers for common string operations in string utility functions
Applied to files:
src/Utils/request/utils.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: Redirect rules - care-ohc
- GitHub Check: Header rules - care-ohc
- GitHub Check: Pages changed - care-ohc
- GitHub Check: deploy-preview
🔇 Additional comments (4)
src/Utils/request/utils.ts (4)
8-14: LGTM! Route format validation is correctly implemented.The trim and regex-based split properly handles multiple whitespace characters, and the error message clearly describes the expected format.
36-36: Type assertion is safe and maintains type correctness.The cast to
HttpMethodis valid because the validation at lines 20-22 ensures the method is one of the allowed values.
18-22: The code works correctly at runtime.HttpMethodis a TypeScript enum, which generates a runtime object, soObject.values(HttpMethod)successfully retrieves the valid HTTP methods for validation.However, the coding guidelines state "Avoid enums; use maps instead." Consider refactoring
HttpMethodfrom an enum to a const map object (e.g.,const HttpMethod = { GET: "GET", POST: "POST", ... }) to comply with project conventions.Likely an incorrect or invalid review comment.
5-40: All existing API route definitions comply with the new validation rules.Verification confirms that the single implementation using the
API()function (plugConfigApi.ts) adheres to the required "METHOD PATH" format with proper leading slashes and valid HTTP methods. No existing routes would fail the new validation.
|
PR opened: #15028 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In @src/Utils/request/utils.ts:
- Around line 24-26: The check `if (!path || path.length === 0)` is redundant
because `path` is guaranteed to be non-empty by the prior split and `/\s+/`
usage; simplify it to a single, clear condition such as `if (!path)` (or remove
the guard entirely if you prefer relying on earlier validation) in the block
that throws `new Error(\`API route path cannot be empty in "${route}".\`)`,
referencing the existing `path` and `route` variables so the logic remains
readable and maintainable.
- Around line 18-22: The check recreates Object.values(HttpMethod) on each API()
call; move that array to a module-level cached constant (e.g.,
VALID_HTTP_METHODS = Object.values(HttpMethod)) and replace the inline call in
the API() function so the if-statement uses the cached
VALID_HTTP_METHODS.includes(method as HttpMethod) instead of
Object.values(HttpMethod) to avoid reallocating the array repeatedly.
📜 Review details
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
src/Utils/request/utils.ts
🧰 Additional context used
📓 Path-based instructions (11)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursorrules)
**/*.{ts,tsx}: Write concise, technical TypeScript code with accurate examples
Use TypeScript for all code; prefer interfaces over types
Avoid enums; use maps instead
Use TanStack Query for data fetching from the API along with query and mutate utilities for the queryFn and mutationFn
Use raviger for routing
**/*.{ts,tsx}: Use TypeScript with strict mode and ES2022 target
Useinterfacefor defining object types in TypeScript
Avoid explicitanytype in TypeScript
Use proper nullability annotations in TypeScript types
Use dedicated error handlers and TypeScript strict null checks
**/*.{ts,tsx}: Use TypeScript for all new code
Prefer interfaces over types for object definitions in TypeScript
Avoid usinganytype; use proper type definitions in TypeScript
Use type inference where possible in TypeScript
Use TanStack Query for API data management
Prefer React Context for global state management
**/*.{ts,tsx}: Use TanStack Query with thequeryandmutateutilities from@/Utils/request/
Use appropriate query keys following the resource pattern for TanStack Query
Leverage TanStack Query built-in features for pagination and debouncing
Implement proper error handling using the global error handler for TanStack Query operations
UseuseQueryhook withqueryKeyandqueryFnparameters, wherequeryFnwraps the API route with thequery()utility
UseuseMutationhook withmutationFnparameter wrapping API routes with themutate()utility, and implementonSuccesscallbacks to invalidate related queries
Support path parameters in TanStack Query using thepathParamsoption in query/mutate utilities
Support query parameters in TanStack Query using thequeryParamsoption in query/mutate utilities
Use thesilent: trueoption to suppress global error notifications when custom error handling is needed
**/*.{ts,tsx}: Use TypeScript with strict mode and ES2022 target
Useinterfacefor defining object types
Avoid explicitanytypes and maint...
Files:
src/Utils/request/utils.ts
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.cursorrules)
**/*.{ts,tsx,js,jsx}: Use functional and declarative programming patterns; avoid classes
Prefer iteration and modularization over code duplication
Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError)
Use the "function" keyword for pure functions
Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements
**/*.{ts,tsx,js,jsx}: Use path aliases for imports from src (@/*)
Use double quotes for strings
Semicolons are required at end of statements
Order imports as: 3rd-party → library → CAREUI → UI → components → hooks → utils → relative
Use PascalCase for component and class names
Use camelCase for variable and function names
**/*.{ts,tsx,js,jsx}: Use path aliases@/*for imports from src directory
Use double quotes for strings
Require semicolons at end of statements
Order imports: 3rd-party → library → CAREUI → UI → components → hooks → utils → relative
Use PascalCase for component and class names
Use camelCase for variable and function names
Files:
src/Utils/request/utils.ts
src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
src/**/*.{ts,tsx}: Use strict TypeScript configuration for medical data safety in all TypeScript source files
All literal strings must use i18next for multi-language support in healthcare interfaces
Use comprehensive error boundaries and user-friendly error messages for medical workflow debugging without exposing PHI
Follow ESLint configured rules for React hooks, accessibility, and code quality
Use @tanstack/react-query for server state management in API client code
Localize date and time formats for medical timestamps using locale-aware formatting functions
Use date-fns for date handling and manipulation with locale awareness for medical timestamps
Files:
src/Utils/request/utils.ts
src/**/*.{ts,tsx,css}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use Prettier for consistent code formatting across the healthcare application
Files:
src/Utils/request/utils.ts
src/{Utils,types,providers}/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Document medical data flows, validation requirements, and healthcare workflows with clinical reasoning in API and utility code comments
Files:
src/Utils/request/utils.ts
src/**/*.{tsx,ts}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
src/**/*.{tsx,ts}: Use React 19.1.1 features and patterns following React 19 Documentation for healthcare application development
Use shadcn/ui as primary component system and CAREUI for healthcare-specific components
Use framer-motion for animations in healthcare UI interfaces
Files:
src/Utils/request/utils.ts
src/Utils/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/instructions/utils.instructions.md)
src/Utils/**/*.{ts,tsx}: Keep utilities organized by functionality insrc/Utils/with descriptive file names that indicate the utility's purpose
Export functions with clear, self-documenting names and group related utilities in the same file
Always provide proper TypeScript types for parameters and return values in utility functions
Use generic types where appropriate for reusability in utility functions
Avoidanytype; useunknownor proper type assertions in utility code
Export interfaces and types alongside utility functions in the same file
Prefer pure functions that don't have side effects; functions should be predictable and testable
Avoid modifying input parameters; return new objects/arrays using immutable data patterns
Implement proper error handling with try-catch blocks in utility functions
Return meaningful error messages or throw specific error types in utilities
Use TypeScript's strict null checks in utility code
Validate input parameters in utility functions when necessary
Use consistent patterns for API request handling in API utility functions
Implement proper error handling for network requests with appropriate HTTP status code handling
Include retry logic for transient failures in API utilities when appropriate
Usedate-fnslibrary for date manipulations in date and time utility functions
Handle timezone considerations properly in date and time utilities
Format dates consistently across the application using utility functions
Consider internationalization (i18n) for date formatting in utility functions
Usezodfor schema validation in validation utility functions
Create reusable validation schemas in validation utilities
Provide clear validation error messages in validation utilities
Handle both synchronous and asynchronous validation in validation utilities
Create helpers for common string operations in string utility functions
Implement proper text sanitization and formatting in string utilities
Handle Unicode and internationalizatio...
Files:
src/Utils/request/utils.ts
**/*
📄 CodeRabbit inference engine (CLAUDE.md)
Use 2-space indentation
Files:
src/Utils/request/utils.ts
**/*.ts
📄 CodeRabbit inference engine (.cursor/rules/02-coding-standards.mdc)
Use camelCase for utility file names (e.g.,
useAuth.ts)
Files:
src/Utils/request/utils.ts
**/*.{tsx,ts}
📄 CodeRabbit inference engine (.cursor/rules/04-ui-components.mdc)
**/*.{tsx,ts}: Use Shadcn UI components as the primary component library
Follow the component documentation for proper usage
Customize components using Tailwind CSS
UsenavigateanduseRedirectfrom raviger for navigation and redirects
Use Tailwind's responsive classes and follow mobile-first approach
Implement proper ARIA attributes for accessibility
Ensure keyboard navigation works in components
Define component props using TypeScript interfaces
Use translation keys fromsrc/Locale/for internationalization
Support RTL languages in components
Use proper date/time formatting for multiple language support
Files:
src/Utils/request/utils.ts
**/*.{ts,tsx,js,jsx,json,css,scss,html}
📄 CodeRabbit inference engine (AGENTS.md)
Use 2-space indentation
Files:
src/Utils/request/utils.ts
🧠 Learnings (11)
📓 Common learnings
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Use consistent patterns for API request handling in API utility functions
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursor/rules/03-data-fetching.mdc:0-0
Timestamp: 2025-11-25T13:54:24.075Z
Learning: Applies to src/Utils/api.tsx : Use legacy API route definitions only in `src/Utils/api.tsx` with the `ApiRoute` type annotation for path-based route configuration
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Validate input parameters in utility functions when necessary
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Provide clear validation error messages in validation utilities
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursor/rules/03-data-fetching.mdc:0-0
Timestamp: 2025-11-25T13:54:24.075Z
Learning: Applies to **/types/**/*Api.ts : Define modern API routes in dedicated API files (`*Api.ts`) within the corresponding type directory using the pattern with `path`, `method`, `TRes`, and optional `TBody` properties
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Implement proper error handling for network requests with appropriate HTTP status code handling
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Handle both synchronous and asynchronous validation in validation utilities
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/pages.instructions.md:0-0
Timestamp: 2025-11-25T13:52:19.758Z
Learning: Applies to src/pages/**/*.{ts,tsx} : Implement proper route parameters and query string handling
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Return meaningful error messages or throw specific error types in utilities
📚 Learning: 2025-11-25T13:53:40.623Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Use consistent patterns for API request handling in API utility functions
Applied to files:
src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:54:24.075Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursor/rules/03-data-fetching.mdc:0-0
Timestamp: 2025-11-25T13:54:24.075Z
Learning: Applies to src/Utils/api.tsx : Use legacy API route definitions only in `src/Utils/api.tsx` with the `ApiRoute` type annotation for path-based route configuration
Applied to files:
src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:53:40.623Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Validate input parameters in utility functions when necessary
Applied to files:
src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:54:24.075Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursor/rules/03-data-fetching.mdc:0-0
Timestamp: 2025-11-25T13:54:24.075Z
Learning: Applies to **/types/**/*Api.ts : Define modern API routes in dedicated API files (`*Api.ts`) within the corresponding type directory using the pattern with `path`, `method`, `TRes`, and optional `TBody` properties
Applied to files:
src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:52:19.758Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/pages.instructions.md:0-0
Timestamp: 2025-11-25T13:52:19.758Z
Learning: Applies to src/pages/**/*.{ts,tsx} : Implement proper route parameters and query string handling
Applied to files:
src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:53:40.623Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Provide clear validation error messages in validation utilities
Applied to files:
src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:53:40.623Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Use appropriate data transformation patterns in string and data manipulation utilities
Applied to files:
src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:53:40.623Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Implement proper error handling for network requests with appropriate HTTP status code handling
Applied to files:
src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:53:40.623Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Handle both synchronous and asynchronous validation in validation utilities
Applied to files:
src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:53:40.623Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Implement proper text sanitization and formatting in string utilities
Applied to files:
src/Utils/request/utils.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: Redirect rules - care-ohc
- GitHub Check: Header rules - care-ohc
- GitHub Check: Pages changed - care-ohc
- GitHub Check: deploy-preview
🔇 Additional comments (3)
src/Utils/request/utils.ts (3)
8-14: LGTM! Robust route parsing with clear error messaging.Using
/\s+/to split handles edge cases like multiple spaces or tabs between method and path. The error message includes the original route, aiding debuggability. Based on learnings, this aligns with providing clear validation error messages in validation utilities.
28-32: LGTM! Appropriate path format validation.Enforcing that API paths start with
/is a sensible convention for REST routes. The error message clearly indicates the issue and expected format.
34-39: LGTM! Type cast is safe after validation.The cast
method as HttpMethodis justified since the preceding validation confirmsmethodis a validHttpMethodvalue. The return shape remains consistent with the expected API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
🤖 Fix all issues with AI agents
In @src/Utils/request/utils.ts:
- Around line 8-30: The validation currently allows network-path references like
"//evil.com" and logs the original untrimmed route; change the function to use a
trimmed route value for all checks and error messages (e.g., assign const
trimmed = route.trim() and split that), and add a guard that rejects paths that
start with "//" (e.g., if (path.startsWith("//")) throw new Error(...)). Update
all thrown errors to reference the trimmed route/value and keep existing checks
for VALID_HTTP_METHODS, parts, empty path, and leading "/" using the trimmed
inputs.
- Around line 32-37: The return currently casts method repeatedly as HttpMethod;
instead narrow it once into a local variable (e.g., const httpMethod = method as
HttpMethod) after you validate it and then use httpMethod in the returned object
(replace all occurrences of method as HttpMethod with httpMethod) so the
narrowing is centralized and safer to refactor; update the return in the
function that constructs the object (the code building { path, method: ...,
TRes: Type<TResponse>(), TBody: Type<TBody>() }) to use that local narrowed
variable.
- Line 4: VALID_HTTP_METHODS should be made resilient to enum reverse-mapping by
constructing it as a Set of only the string-valued members of HttpMethod (filter
Object.values(HttpMethod) for typeof value === 'string' and wrap in new
Set(...)), and update any callers that use Array.includes to use Set.has; adjust
the symbol VALID_HTTP_METHODS and lookups where HttpMethod is validated so only
string enum entries are considered and lookups use the Set for O(1) checks.
📜 Review details
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
src/Utils/request/utils.ts
🧰 Additional context used
📓 Path-based instructions (11)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursorrules)
**/*.{ts,tsx}: Write concise, technical TypeScript code with accurate examples
Use TypeScript for all code; prefer interfaces over types
Avoid enums; use maps instead
Use TanStack Query for data fetching from the API along with query and mutate utilities for the queryFn and mutationFn
Use raviger for routing
**/*.{ts,tsx}: Use TypeScript with strict mode and ES2022 target
Useinterfacefor defining object types in TypeScript
Avoid explicitanytype in TypeScript
Use proper nullability annotations in TypeScript types
Use dedicated error handlers and TypeScript strict null checks
**/*.{ts,tsx}: Use TypeScript for all new code
Prefer interfaces over types for object definitions in TypeScript
Avoid usinganytype; use proper type definitions in TypeScript
Use type inference where possible in TypeScript
Use TanStack Query for API data management
Prefer React Context for global state management
**/*.{ts,tsx}: Use TanStack Query with thequeryandmutateutilities from@/Utils/request/
Use appropriate query keys following the resource pattern for TanStack Query
Leverage TanStack Query built-in features for pagination and debouncing
Implement proper error handling using the global error handler for TanStack Query operations
UseuseQueryhook withqueryKeyandqueryFnparameters, wherequeryFnwraps the API route with thequery()utility
UseuseMutationhook withmutationFnparameter wrapping API routes with themutate()utility, and implementonSuccesscallbacks to invalidate related queries
Support path parameters in TanStack Query using thepathParamsoption in query/mutate utilities
Support query parameters in TanStack Query using thequeryParamsoption in query/mutate utilities
Use thesilent: trueoption to suppress global error notifications when custom error handling is needed
**/*.{ts,tsx}: Use TypeScript with strict mode and ES2022 target
Useinterfacefor defining object types
Avoid explicitanytypes and maint...
Files:
src/Utils/request/utils.ts
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.cursorrules)
**/*.{ts,tsx,js,jsx}: Use functional and declarative programming patterns; avoid classes
Prefer iteration and modularization over code duplication
Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError)
Use the "function" keyword for pure functions
Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements
**/*.{ts,tsx,js,jsx}: Use path aliases for imports from src (@/*)
Use double quotes for strings
Semicolons are required at end of statements
Order imports as: 3rd-party → library → CAREUI → UI → components → hooks → utils → relative
Use PascalCase for component and class names
Use camelCase for variable and function names
**/*.{ts,tsx,js,jsx}: Use path aliases@/*for imports from src directory
Use double quotes for strings
Require semicolons at end of statements
Order imports: 3rd-party → library → CAREUI → UI → components → hooks → utils → relative
Use PascalCase for component and class names
Use camelCase for variable and function names
Files:
src/Utils/request/utils.ts
src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
src/**/*.{ts,tsx}: Use strict TypeScript configuration for medical data safety in all TypeScript source files
All literal strings must use i18next for multi-language support in healthcare interfaces
Use comprehensive error boundaries and user-friendly error messages for medical workflow debugging without exposing PHI
Follow ESLint configured rules for React hooks, accessibility, and code quality
Use @tanstack/react-query for server state management in API client code
Localize date and time formats for medical timestamps using locale-aware formatting functions
Use date-fns for date handling and manipulation with locale awareness for medical timestamps
Files:
src/Utils/request/utils.ts
src/**/*.{ts,tsx,css}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use Prettier for consistent code formatting across the healthcare application
Files:
src/Utils/request/utils.ts
src/{Utils,types,providers}/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Document medical data flows, validation requirements, and healthcare workflows with clinical reasoning in API and utility code comments
Files:
src/Utils/request/utils.ts
src/**/*.{tsx,ts}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
src/**/*.{tsx,ts}: Use React 19.1.1 features and patterns following React 19 Documentation for healthcare application development
Use shadcn/ui as primary component system and CAREUI for healthcare-specific components
Use framer-motion for animations in healthcare UI interfaces
Files:
src/Utils/request/utils.ts
src/Utils/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/instructions/utils.instructions.md)
src/Utils/**/*.{ts,tsx}: Keep utilities organized by functionality insrc/Utils/with descriptive file names that indicate the utility's purpose
Export functions with clear, self-documenting names and group related utilities in the same file
Always provide proper TypeScript types for parameters and return values in utility functions
Use generic types where appropriate for reusability in utility functions
Avoidanytype; useunknownor proper type assertions in utility code
Export interfaces and types alongside utility functions in the same file
Prefer pure functions that don't have side effects; functions should be predictable and testable
Avoid modifying input parameters; return new objects/arrays using immutable data patterns
Implement proper error handling with try-catch blocks in utility functions
Return meaningful error messages or throw specific error types in utilities
Use TypeScript's strict null checks in utility code
Validate input parameters in utility functions when necessary
Use consistent patterns for API request handling in API utility functions
Implement proper error handling for network requests with appropriate HTTP status code handling
Include retry logic for transient failures in API utilities when appropriate
Usedate-fnslibrary for date manipulations in date and time utility functions
Handle timezone considerations properly in date and time utilities
Format dates consistently across the application using utility functions
Consider internationalization (i18n) for date formatting in utility functions
Usezodfor schema validation in validation utility functions
Create reusable validation schemas in validation utilities
Provide clear validation error messages in validation utilities
Handle both synchronous and asynchronous validation in validation utilities
Create helpers for common string operations in string utility functions
Implement proper text sanitization and formatting in string utilities
Handle Unicode and internationalizatio...
Files:
src/Utils/request/utils.ts
**/*
📄 CodeRabbit inference engine (CLAUDE.md)
Use 2-space indentation
Files:
src/Utils/request/utils.ts
**/*.ts
📄 CodeRabbit inference engine (.cursor/rules/02-coding-standards.mdc)
Use camelCase for utility file names (e.g.,
useAuth.ts)
Files:
src/Utils/request/utils.ts
**/*.{tsx,ts}
📄 CodeRabbit inference engine (.cursor/rules/04-ui-components.mdc)
**/*.{tsx,ts}: Use Shadcn UI components as the primary component library
Follow the component documentation for proper usage
Customize components using Tailwind CSS
UsenavigateanduseRedirectfrom raviger for navigation and redirects
Use Tailwind's responsive classes and follow mobile-first approach
Implement proper ARIA attributes for accessibility
Ensure keyboard navigation works in components
Define component props using TypeScript interfaces
Use translation keys fromsrc/Locale/for internationalization
Support RTL languages in components
Use proper date/time formatting for multiple language support
Files:
src/Utils/request/utils.ts
**/*.{ts,tsx,js,jsx,json,css,scss,html}
📄 CodeRabbit inference engine (AGENTS.md)
Use 2-space indentation
Files:
src/Utils/request/utils.ts
🧠 Learnings (15)
📓 Common learnings
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Use consistent patterns for API request handling in API utility functions
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursor/rules/03-data-fetching.mdc:0-0
Timestamp: 2025-11-25T13:54:24.075Z
Learning: Applies to src/Utils/api.tsx : Use legacy API route definitions only in `src/Utils/api.tsx` with the `ApiRoute` type annotation for path-based route configuration
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Validate input parameters in utility functions when necessary
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursor/rules/03-data-fetching.mdc:0-0
Timestamp: 2025-11-25T13:54:24.075Z
Learning: Applies to **/types/**/*Api.ts : Define modern API routes in dedicated API files (`*Api.ts`) within the corresponding type directory using the pattern with `path`, `method`, `TRes`, and optional `TBody` properties
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Provide clear validation error messages in validation utilities
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Implement proper error handling for network requests with appropriate HTTP status code handling
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Handle both synchronous and asynchronous validation in validation utilities
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Return meaningful error messages or throw specific error types in utilities
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/pages.instructions.md:0-0
Timestamp: 2025-11-25T13:52:19.758Z
Learning: Applies to src/pages/**/*.{ts,tsx} : Implement proper route parameters and query string handling
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Create reusable validation schemas in validation utilities
📚 Learning: 2025-11-25T13:53:40.623Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Use consistent patterns for API request handling in API utility functions
Applied to files:
src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:54:24.075Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursor/rules/03-data-fetching.mdc:0-0
Timestamp: 2025-11-25T13:54:24.075Z
Learning: Applies to **/types/**/*Api.ts : Define modern API routes in dedicated API files (`*Api.ts`) within the corresponding type directory using the pattern with `path`, `method`, `TRes`, and optional `TBody` properties
Applied to files:
src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:54:24.075Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursor/rules/03-data-fetching.mdc:0-0
Timestamp: 2025-11-25T13:54:24.075Z
Learning: Applies to src/Utils/api.tsx : Use legacy API route definitions only in `src/Utils/api.tsx` with the `ApiRoute` type annotation for path-based route configuration
Applied to files:
src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:53:40.623Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Implement proper error handling for network requests with appropriate HTTP status code handling
Applied to files:
src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:53:40.623Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Validate input parameters in utility functions when necessary
Applied to files:
src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:53:40.623Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Handle both synchronous and asynchronous validation in validation utilities
Applied to files:
src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:53:40.623Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Provide clear validation error messages in validation utilities
Applied to files:
src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:52:19.758Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/pages.instructions.md:0-0
Timestamp: 2025-11-25T13:52:19.758Z
Learning: Applies to src/pages/**/*.{ts,tsx} : Implement proper route parameters and query string handling
Applied to files:
src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:54:24.075Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursor/rules/03-data-fetching.mdc:0-0
Timestamp: 2025-11-25T13:54:24.075Z
Learning: Applies to **/*.{ts,tsx} : Support path parameters in TanStack Query using the `pathParams` option in query/mutate utilities
Applied to files:
src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:53:40.623Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Use appropriate data transformation patterns in string and data manipulation utilities
Applied to files:
src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:53:40.623Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Avoid unnecessary object creation in frequently called utility functions
Applied to files:
src/Utils/request/utils.ts
📚 Learning: 2024-11-14T08:07:32.427Z
Learnt from: Jacobjeevan
Repo: ohcnetwork/care_fe PR: 9080
File: src/Utils/permissions.ts:37-50
Timestamp: 2024-11-14T08:07:32.427Z
Learning: In the `showUserPasswordReset` function within `src/Utils/permissions.ts`, both `authUser` and `targetUser` are guaranteed to be provided. Therefore, null or undefined checks for these parameters are unnecessary.
Applied to files:
src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:50:54.683Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/common.instructions.md:0-0
Timestamp: 2025-11-25T13:50:54.683Z
Learning: Applies to src/common/**/constants.tsx : Maintain LocalStorageKeys constants for secure browser storage in constants.tsx
Applied to files:
src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:49:43.065Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursorrules:0-0
Timestamp: 2025-11-25T13:49:43.065Z
Learning: Applies to api.tsx : APIs are defined in the api.tsx file
Applied to files:
src/Utils/request/utils.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: Redirect rules - care-ohc
- GitHub Check: Header rules - care-ohc
- GitHub Check: Pages changed - care-ohc
- GitHub Check: deploy-preview
What does this PR do?
Why?
This change prevents silent failures caused by malformed route strings and improves debuggability.
Testing
Related Issue
Closes #15028
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.