Refactor team member lookups to use service helper#2061
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the codebase to centralize team member lookups by extending the existing getTeamMember service helper to support typed select/include options and consistent error handling, then updating all route handlers to use this shared helper instead of direct Prisma queries.
- Extends
getTeamMemberwith TypeScript overloads for select/include options and improves error handling - Updates route handlers to replace direct
db.teamMember.findUniquecalls with the centralized service - Adjusts test mocks to mock the service helper instead of direct database calls
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
app/modules/team-member/service.server.ts |
Extended getTeamMember with TypeScript overloads for select/include support and improved error handling |
app/routes/_layout+/assets.$assetId.overview.assign-custody.tsx |
Replaced direct database query with getTeamMember service call |
app/routes/_layout+/bookings.new.tsx |
Replaced direct database query with getTeamMember service call and removed unused db import |
app/routes/_layout+/kits.$kitId.assets.assign-custody.tsx |
Replaced direct database query with getTeamMember service call |
app/routes/api+/assets.bulk-assign-custody.ts |
Replaced direct database query with getTeamMember service call and removed unused db import |
app/routes/api+/kits.bulk-actions.ts |
Replaced direct database query with getTeamMember service call |
test/routes-tests/api.assets.bulk-assign-custody.test.ts |
Updated test mocks to use service helper instead of direct database mocks |
test/routes-tests/api.kits.bulk-actions.test.ts |
Updated test mocks to use service helper instead of direct database mocks |
test/routes-tests/assets.$assetId.overview.assign-custody.test.tsx |
Updated test mocks to use service helper instead of direct database mocks |
test/routes-tests/bookings.new.test.tsx |
Updated test mocks to use service helper instead of direct database mocks |
test/routes-tests/kits.$kitId.assets.assign-custody.test.tsx |
Updated test mocks to use service helper instead of direct database mocks |
- Add comprehensive JSDoc comments to getTeamMember overloads with usage examples - Create unit test suite for team member service with 12 test cases covering: - Basic functionality and organization validation - Select parameter functionality - Include parameter functionality - Parameter validation (select + include error handling) - Error handling scenarios (ShelfError re-throwing and generic error wrapping) - All tests passing with full coverage of the enhanced service functionality
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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
getTeamMemberto support typed select/include options and consistent error handlingTesting
https://chatgpt.com/codex/tasks/task_b_68d3beb864b483209fede1542bf4b1e0