Skip to content

feat: rename repository files to include Repository suffix #22716

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

Merged
merged 3 commits into from
Jul 30, 2025

Conversation

eunjae-lee
Copy link
Contributor

@eunjae-lee eunjae-lee commented Jul 24, 2025

feat: rename repository files to PrismaRepository with Prisma prefix

Summary

Renamed two repository files to include "Prisma" prefix in both filename and class name for better consistency with the codebase naming conventions:

  • packages/lib/server/repository/apiKey.tspackages/lib/server/repository/PrismaApiKeyRepository.ts
  • packages/lib/server/repository/assignmentReason.tspackages/lib/server/repository/PrismaAssignmentReasonRepository.ts

Updated corresponding class names:

  • ApiKeyRepositoryPrismaApiKeyRepository
  • AssignmentReasonRepositoryPrismaAssignmentReasonRepository

All import statements and usages have been updated across 3 consuming files to maintain functionality.

Review & Testing Checklist for Human

  • End-to-end test API keys functionality - Navigate to /settings/developer/api-keys, create/list/delete API keys to ensure the renamed repository works correctly
  • Global search for missed references - Search codebase for any remaining references to ApiKeyRepository or AssignmentReasonRepository (excluding this PR)
  • Test Salesforce integration - If possible, test booking flows that trigger Salesforce CRM integration to verify PrismaAssignmentReasonRepository works
  • Verify naming convention alignment - Confirm the "Prisma" prefix naming matches your intended convention for repository classes

Diagram

%%{ init : { "theme" : "default" }}%%
graph TD
    A["packages/lib/server/repository/<br/>PrismaApiKeyRepository.ts"]:::major-edit
    B["packages/lib/server/repository/<br/>PrismaAssignmentReasonRepository.ts"]:::major-edit
    C["apps/web/.../api-keys/page.tsx"]:::minor-edit
    D["packages/trpc/.../list.handler.ts"]:::minor-edit
    E["packages/app-store/salesforce/<br/>lib/CrmService.ts"]:::minor-edit
    
    A -->|"imports PrismaApiKeyRepository"| C
    A -->|"imports PrismaApiKeyRepository"| D
    B -->|"imports PrismaAssignmentReasonRepository"| E
    
    subgraph Legend
        L1[Major Edit]:::major-edit
        L2[Minor Edit]:::minor-edit
        L3[Context/No Edit]:::context
    end
    
    classDef major-edit fill:#90EE90
    classDef minor-edit fill:#87CEEB
    classDef context fill:#FFFFFF
Loading

Notes

  • Type checking passes locally (yarn type-check:ci completed successfully)
  • This change maintains backward compatibility in terms of functionality - only file/class names changed
  • The repositories use static methods, so no instantiation changes required
  • Requested by @eunjae-lee via Slack
  • Link to Devin session: https://app.devin.ai/sessions/42d6f0a1c3054ec8844de46a400e372a

- Rename apiKey.ts to apiKeyRepository.ts
- Rename assignmentReason.ts to assignmentReasonRepository.ts
- Update all import statements to use new file names

Co-Authored-By: eunjae@cal.com <hey@eunjae.dev>
Copy link
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Copy link
Contributor

coderabbitai bot commented Jul 24, 2025

Walkthrough

This change set systematically renames two repository classes from ApiKeyRepository to PrismaApiKeyRepository and from AssignmentReasonRepository to PrismaAssignmentReasonRepository across the codebase. All related import statements and internal method calls are updated to reference the new class names. The logic, method signatures, and control flow within the affected files remain unchanged, with the modifications limited to class renaming and corresponding import adjustments. No exported or public entity signatures are altered except for the class names themselves.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~7 minutes

  • The changes are straightforward, involving class renaming and import updates without logic modification.
  • The review mainly requires verifying consistency of renaming and ensuring no missed references.
  • No complex or high-risk logic is introduced.

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6c93647 and 0d2fbfc.

📒 Files selected for processing (5)
  • apps/web/app/(use-page-wrapper)/settings/(settings-layout)/developer/api-keys/page.tsx (2 hunks)
  • packages/app-store/salesforce/lib/CrmService.ts (2 hunks)
  • packages/lib/server/repository/PrismaApiKeyRepository.ts (1 hunks)
  • packages/lib/server/repository/PrismaAssignmentReasonRepository.ts (1 hunks)
  • packages/trpc/server/routers/viewer/apiKeys/list.handler.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
**/*Repository.ts

📄 CodeRabbit Inference Engine (.cursor/rules/review.mdc)

Repository files must include Repository suffix, prefix with technology if applicable (e.g., PrismaAppRepository.ts), and use PascalCase matching the exported class

Files:

  • packages/lib/server/repository/PrismaApiKeyRepository.ts
  • packages/lib/server/repository/PrismaAssignmentReasonRepository.ts
**/*.ts

📄 CodeRabbit Inference Engine (.cursor/rules/review.mdc)

**/*.ts: For Prisma queries, only select data you need; never use include, always use select
Ensure the credential.key field is never returned from tRPC endpoints or APIs

Files:

  • packages/lib/server/repository/PrismaApiKeyRepository.ts
  • packages/lib/server/repository/PrismaAssignmentReasonRepository.ts
  • packages/trpc/server/routers/viewer/apiKeys/list.handler.ts
  • packages/app-store/salesforce/lib/CrmService.ts
**/*.{ts,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/review.mdc)

Flag excessive Day.js use in performance-critical code; prefer native Date or Day.js .utc() in hot paths like loops

Files:

  • packages/lib/server/repository/PrismaApiKeyRepository.ts
  • packages/lib/server/repository/PrismaAssignmentReasonRepository.ts
  • packages/trpc/server/routers/viewer/apiKeys/list.handler.ts
  • packages/app-store/salesforce/lib/CrmService.ts
  • apps/web/app/(use-page-wrapper)/settings/(settings-layout)/developer/api-keys/page.tsx
**/*Service.ts

📄 CodeRabbit Inference Engine (.cursor/rules/review.mdc)

Service files must include Service suffix, use PascalCase matching exported class, and avoid generic names (e.g., MembershipService.ts)

Files:

  • packages/app-store/salesforce/lib/CrmService.ts
**/*.tsx

📄 CodeRabbit Inference Engine (.cursor/rules/review.mdc)

Always use t() for text localization in frontend code; direct text embedding should trigger a warning

Files:

  • apps/web/app/(use-page-wrapper)/settings/(settings-layout)/developer/api-keys/page.tsx
🧠 Learnings (6)
📓 Common learnings
Learnt from: CR
PR: calcom/cal.com#0
File: .cursor/rules/review.mdc:0-0
Timestamp: 2025-07-28T11:50:23.946Z
Learning: Applies to **/*Repository.ts : Repository files must include `Repository` suffix, prefix with technology if applicable (e.g., `PrismaAppRepository.ts`), and use PascalCase matching the exported class
Learnt from: CR
PR: calcom/cal.com#0
File: .cursor/rules/review.mdc:0-0
Timestamp: 2025-07-28T11:50:23.946Z
Learning: For large pull requests (>500 lines changed or >10 files touched), advise splitting into smaller, focused PRs by feature, layer, dependency chain, or file/module
packages/lib/server/repository/PrismaApiKeyRepository.ts (1)

Learnt from: CR
PR: calcom/cal.com#0
File: .cursor/rules/review.mdc:0-0
Timestamp: 2025-07-28T11:50:23.946Z
Learning: Applies to **/*Repository.ts : Repository files must include Repository suffix, prefix with technology if applicable (e.g., PrismaAppRepository.ts), and use PascalCase matching the exported class

packages/lib/server/repository/PrismaAssignmentReasonRepository.ts (1)

Learnt from: CR
PR: calcom/cal.com#0
File: .cursor/rules/review.mdc:0-0
Timestamp: 2025-07-28T11:50:23.946Z
Learning: Applies to **/*Repository.ts : Repository files must include Repository suffix, prefix with technology if applicable (e.g., PrismaAppRepository.ts), and use PascalCase matching the exported class

packages/trpc/server/routers/viewer/apiKeys/list.handler.ts (2)

Learnt from: CR
PR: calcom/cal.com#0
File: .cursor/rules/review.mdc:0-0
Timestamp: 2025-07-28T11:50:23.946Z
Learning: Applies to **/*Repository.ts : Repository files must include Repository suffix, prefix with technology if applicable (e.g., PrismaAppRepository.ts), and use PascalCase matching the exported class

Learnt from: CR
PR: calcom/cal.com#0
File: .cursor/rules/review.mdc:0-0
Timestamp: 2025-07-28T11:50:23.946Z
Learning: Applies to **/*.ts : Ensure the credential.key field is never returned from tRPC endpoints or APIs

packages/app-store/salesforce/lib/CrmService.ts (2)

Learnt from: CR
PR: calcom/cal.com#0
File: .cursor/rules/review.mdc:0-0
Timestamp: 2025-07-28T11:50:23.946Z
Learning: Applies to **/*Repository.ts : Repository files must include Repository suffix, prefix with technology if applicable (e.g., PrismaAppRepository.ts), and use PascalCase matching the exported class

Learnt from: eunjae-lee
PR: #22106
File: packages/features/insights/components/FailedBookingsByField.tsx:65-71
Timestamp: 2025-07-15T12:59:34.389Z
Learning: In the FailedBookingsByField component (packages/features/insights/components/FailedBookingsByField.tsx), although routingFormId is typed as optional in useInsightsParameters, the system automatically enforces a routing form filter, so routingFormId is always present in practice. This means the data always contains only one entry, making the single-entry destructuring approach safe.

apps/web/app/(use-page-wrapper)/settings/(settings-layout)/developer/api-keys/page.tsx (2)

Learnt from: CR
PR: calcom/cal.com#0
File: .cursor/rules/review.mdc:0-0
Timestamp: 2025-07-28T11:50:23.946Z
Learning: Applies to **/*.ts : Ensure the credential.key field is never returned from tRPC endpoints or APIs

Learnt from: CR
PR: calcom/cal.com#0
File: .cursor/rules/review.mdc:0-0
Timestamp: 2025-07-28T11:50:23.946Z
Learning: Applies to **/*Repository.ts : Repository files must include Repository suffix, prefix with technology if applicable (e.g., PrismaAppRepository.ts), and use PascalCase matching the exported class

🧬 Code Graph Analysis (3)
packages/trpc/server/routers/viewer/apiKeys/list.handler.ts (1)
packages/lib/server/repository/PrismaApiKeyRepository.ts (1)
  • PrismaApiKeyRepository (3-22)
packages/app-store/salesforce/lib/CrmService.ts (1)
packages/lib/server/repository/PrismaAssignmentReasonRepository.ts (1)
  • PrismaAssignmentReasonRepository (3-16)
apps/web/app/(use-page-wrapper)/settings/(settings-layout)/developer/api-keys/page.tsx (1)
packages/lib/server/repository/PrismaApiKeyRepository.ts (1)
  • PrismaApiKeyRepository (3-22)
⏰ 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). (1)
  • GitHub Check: Install dependencies / Yarn install & cache
🔇 Additional comments (8)
packages/lib/server/repository/PrismaApiKeyRepository.ts (1)

3-3: LGTM! Excellent adherence to naming conventions.

The class rename to PrismaApiKeyRepository perfectly follows the coding guidelines for repository files, which require the Repository suffix and technology prefix. This improves code clarity by explicitly indicating the Prisma-based implementation.

packages/lib/server/repository/PrismaAssignmentReasonRepository.ts (1)

3-3: LGTM! Consistent naming convention implementation.

The class rename to PrismaAssignmentReasonRepository correctly follows the established pattern from the coding guidelines, maintaining consistency with other repository files by including the technology prefix and Repository suffix.

packages/app-store/salesforce/lib/CrmService.ts (2)

12-12: LGTM! Import updated to reflect repository renaming.

The import correctly references the renamed PrismaAssignmentReasonRepository class, maintaining consistency with the repository file changes.


1345-1345: LGTM! Method call properly updated.

The method call correctly uses the renamed class while preserving the same functionality - fetching the latest assignment reason from the booking UID.

apps/web/app/(use-page-wrapper)/settings/(settings-layout)/developer/api-keys/page.tsx (2)

8-8: LGTM! Import correctly updated for repository renaming.

The import statement properly references the renamed PrismaApiKeyRepository class, maintaining consistency across the codebase.


25-25: LGTM! Method call properly updated in cached function.

The method call correctly uses the renamed class while preserving the same functionality within the cached API key retrieval function.

packages/trpc/server/routers/viewer/apiKeys/list.handler.ts (2)

1-1: LGTM! Import statement correctly updated.

The import properly references the renamed PrismaApiKeyRepository class, ensuring consistency with the repository changes.


12-12: LGTM! tRPC handler method call properly updated.

The method call correctly uses the renamed class while maintaining the same functionality in the tRPC list handler.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch devin/rename-repository-files-1753364141

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

- Rename apiKeyRepository.ts to PrismaApiKeyRepository.ts
- Rename assignmentReasonRepository.ts to PrismaAssignmentReasonRepository.ts
- Update class names to PrismaApiKeyRepository and PrismaAssignmentReasonRepository
- Update all import statements and usages across 3 files

Co-Authored-By: eunjae@cal.com <hey@eunjae.dev>
Copy link

vercel bot commented Jul 24, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
cal ⬜️ Ignored (Inspect) Jul 29, 2025 9:16am
cal-eu ⬜️ Ignored (Inspect) Jul 29, 2025 9:16am

@eunjae-lee eunjae-lee marked this pull request as ready for review July 29, 2025 09:16
@graphite-app graphite-app bot requested a review from a team July 29, 2025 09:16
Copy link

graphite-app bot commented Jul 29, 2025

Graphite Automations

"Add consumer team as reviewer" took an action on this PR • (07/29/25)

1 reviewer was added to this PR based on Keith Williams's automation.

"Add ready-for-e2e label" took an action on this PR • (07/30/25)

1 label was added to this PR based on Keith Williams's automation.

Copy link
Contributor

E2E results are ready!

@eunjae-lee eunjae-lee merged commit 84bc330 into main Jul 30, 2025
62 of 63 checks passed
@eunjae-lee eunjae-lee deleted the devin/rename-repository-files-1753364141 branch July 30, 2025 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
consumer core area: core, team members only ready-for-e2e
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants