Skip to content

Refactor team member lookups to use service helper#2061

Merged
DonKoko merged 5 commits intomainfrom
codex/refactor-team-member-retrieval-to-use-service
Sep 24, 2025
Merged

Refactor team member lookups to use service helper#2061
DonKoko merged 5 commits intomainfrom
codex/refactor-team-member-retrieval-to-use-service

Conversation

@DonKoko
Copy link
Copy Markdown
Contributor

@DonKoko DonKoko commented Sep 24, 2025

Summary

  • extend getTeamMember to support typed select/include options and consistent error handling
  • update routes that fetch team members to rely on the shared helper instead of direct Prisma queries
  • adjust related Vitest route tests to mock the service helper

Testing

  • npm run test

https://chatgpt.com/codex/tasks/task_b_68d3beb864b483209fede1542bf4b1e0

@vercel
Copy link
Copy Markdown

vercel bot commented Sep 24, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
shelf-docs Ignored Ignored Preview Sep 24, 2025 11:49am

@DonKoko DonKoko requested a review from Copilot September 24, 2025 10:41
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 getTeamMember with TypeScript overloads for select/include options and improves error handling
  • Updates route handlers to replace direct db.teamMember.findUnique calls 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

Comment thread app/modules/team-member/service.server.ts
Comment thread app/modules/team-member/service.server.ts Outdated
DonKoko and others added 4 commits September 24, 2025 14:41
- 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>
@DonKoko DonKoko merged commit b0751d3 into main Sep 24, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants