-
Notifications
You must be signed in to change notification settings - Fork 10.2k
refactor: rename repository files to include Repository suffix #22717
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
Conversation
- Rename attribute.ts -> attributeRepository.ts - Rename attributeOption.ts -> attributeOptionRepository.ts - Rename attributeToUser.ts -> attributeToUserRepository.ts - Update all import statements throughout codebase Co-Authored-By: eunjae@cal.com <hey@eunjae.dev>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
WalkthroughThis change set systematically replaces the usage of generic repository classes ( Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Complexity label: Simple 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (2)**/*.tsx📄 CodeRabbit Inference Engine (.cursor/rules/review.mdc)
Files:
**/*.{ts,tsx}📄 CodeRabbit Inference Engine (.cursor/rules/review.mdc)
Files:
🧠 Learnings (2)📓 Common learnings
apps/web/app/(use-page-wrapper)/settings/(settings-layout)/teams/[id]/members/page.tsx (1)Learnt from: CR 🧬 Code Graph Analysis (1)apps/web/app/(use-page-wrapper)/settings/(settings-layout)/teams/[id]/members/page.tsx (1)
⏰ 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)
🔇 Additional comments (3)
✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
- Rename attribute.ts -> PrismaAttributeRepository.ts - Rename attributeOption.ts -> PrismaAttributeOptionRepository.ts - Rename attributeToUser.ts -> PrismaAttributeToUserRepository.ts - Update class names to PrismaAttributeRepository, PrismaAttributeOptionRepository, PrismaAttributeToUserRepository - Update all import statements and references throughout codebase Co-Authored-By: eunjae@cal.com <hey@eunjae.dev>
The latest updates on your projects. Learn more about Vercel for Git ↗︎ |
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. |
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: 0
🔭 Outside diff range comments (3)
packages/lib/server/repository/PrismaAttributeRepository.ts (2)
16-24
:include
violates our Prisma-query guideline – switch toselect
Coding-guidelines mandate: “never use
include
, always useselect
”.
Replace theinclude
with an equivalent nestedselect
to avoid fetching unused columns.- include: { - options: { - select: { - id: true, - value: true, - slug: true, - }, - }, - }, + select: { + id: true, + name: true, + type: true, + slug: true, + options: { + select: { + id: true, + value: true, + slug: true, + }, + }, + },
51-53
: Second occurrence ofinclude
– same fix needed
findAllByOrgIdWithOptions
also usesinclude
. Mirror the earlier diff to comply with guidelines.- include: { - options: true, - }, + select: { + id: true, + name: true, + type: true, + slug: true, + options: { + select: { + id: true, + value: true, + slug: true, + }, + }, + },packages/lib/server/repository/PrismaAttributeToUserRepository.ts (1)
20-29
:include
here breaches the “no-include” ruleSwitch to a nested
select
to stay within the Prisma query standard and avoid over-fetching.- include: { - attributeOption: { - select: { - attribute: true, - value: true, - slug: true, - }, - }, - }, + select: { + id: true, + memberId: true, + attributeOption: { + select: { + attribute: true, + value: true, + slug: true, + }, + }, + },
🧹 Nitpick comments (2)
packages/lib/server/repository/PrismaAttributeRepository.ts (1)
30-41
: Select alloptions
fields – narrow the projection
options: true
pulls every column ofAttributeOption
. If you only need a subset (id/value/slug), list them explicitly to keep responses lean and avoid accidental PII leakage.packages/trpc/server/routers/viewer/attributes/list.handler.ts (1)
17-20
: Nit: typo in error message“apart of” → “a part of”.
- message: "You need to be apart of an organization to use this feature", + message: "You need to be a part of an organization to use this feature",
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (8)
apps/web/app/(use-page-wrapper)/settings/organizations/(org-user-only)/members/page.tsx
(2 hunks)packages/lib/server/repository/PrismaAttributeOptionRepository.ts
(1 hunks)packages/lib/server/repository/PrismaAttributeRepository.ts
(1 hunks)packages/lib/server/repository/PrismaAttributeToUserRepository.ts
(1 hunks)packages/lib/service/attribute/server/assignValueToUser.ts
(3 hunks)packages/lib/service/attribute/server/getAttributes.ts
(2 hunks)packages/lib/service/attribute/server/utils.ts
(2 hunks)packages/trpc/server/routers/viewer/attributes/list.handler.ts
(2 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/*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/PrismaAttributeToUserRepository.ts
packages/lib/server/repository/PrismaAttributeRepository.ts
packages/lib/server/repository/PrismaAttributeOptionRepository.ts
**/*.ts
📄 CodeRabbit Inference Engine (.cursor/rules/review.mdc)
**/*.ts
: For Prisma queries, only select data you need; never useinclude
, always useselect
Ensure thecredential.key
field is never returned from tRPC endpoints or APIs
Files:
packages/lib/server/repository/PrismaAttributeToUserRepository.ts
packages/lib/server/repository/PrismaAttributeRepository.ts
packages/lib/server/repository/PrismaAttributeOptionRepository.ts
packages/trpc/server/routers/viewer/attributes/list.handler.ts
packages/lib/service/attribute/server/getAttributes.ts
packages/lib/service/attribute/server/assignValueToUser.ts
packages/lib/service/attribute/server/utils.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/PrismaAttributeToUserRepository.ts
packages/lib/server/repository/PrismaAttributeRepository.ts
packages/lib/server/repository/PrismaAttributeOptionRepository.ts
packages/trpc/server/routers/viewer/attributes/list.handler.ts
apps/web/app/(use-page-wrapper)/settings/organizations/(org-user-only)/members/page.tsx
packages/lib/service/attribute/server/getAttributes.ts
packages/lib/service/attribute/server/assignValueToUser.ts
packages/lib/service/attribute/server/utils.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/organizations/(org-user-only)/members/page.tsx
🧠 Learnings (9)
📓 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/PrismaAttributeToUserRepository.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/PrismaAttributeRepository.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 : For Prisma queries, only select data you need; never use include
, always use select
packages/lib/server/repository/PrismaAttributeOptionRepository.ts (3)
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 **/*.{service,repository}.ts : Avoid dot-suffixes like .service.ts
or .repository.ts
for new files; reserve .test.ts
, .spec.ts
, .types.ts
for their specific purposes
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 : For Prisma queries, only select data you need; never use include
, always use select
packages/trpc/server/routers/viewer/attributes/list.handler.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
apps/web/app/(use-page-wrapper)/settings/organizations/(org-user-only)/members/page.tsx (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/service/attribute/server/getAttributes.ts (3)
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 **/*.{service,repository}.ts : Avoid dot-suffixes like .service.ts
or .repository.ts
for new files; reserve .test.ts
, .spec.ts
, .types.ts
for their specific purposes
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 : For Prisma queries, only select data you need; never use include
, always use select
packages/lib/service/attribute/server/assignValueToUser.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 : For Prisma queries, only select data you need; never use include
, always use select
packages/lib/service/attribute/server/utils.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 : For Prisma queries, only select data you need; never use include
, always use select
🧬 Code Graph Analysis (5)
packages/trpc/server/routers/viewer/attributes/list.handler.ts (1)
packages/lib/server/repository/PrismaAttributeRepository.ts (1)
PrismaAttributeRepository
(3-56)
apps/web/app/(use-page-wrapper)/settings/organizations/(org-user-only)/members/page.tsx (1)
packages/lib/server/repository/PrismaAttributeRepository.ts (1)
PrismaAttributeRepository
(3-56)
packages/lib/service/attribute/server/getAttributes.ts (2)
packages/lib/server/repository/PrismaAttributeRepository.ts (1)
PrismaAttributeRepository
(3-56)packages/lib/server/repository/PrismaAttributeToUserRepository.ts (1)
PrismaAttributeToUserRepository
(5-47)
packages/lib/service/attribute/server/assignValueToUser.ts (2)
packages/lib/server/repository/PrismaAttributeRepository.ts (1)
PrismaAttributeRepository
(3-56)packages/lib/server/repository/PrismaAttributeOptionRepository.ts (1)
PrismaAttributeOptionRepository
(5-31)
packages/lib/service/attribute/server/utils.ts (1)
packages/lib/server/repository/PrismaAttributeToUserRepository.ts (1)
PrismaAttributeToUserRepository
(5-47)
⏰ 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). (10)
- GitHub Check: Install dependencies / Yarn install & cache
- GitHub Check: Install dependencies / Yarn install & cache
- GitHub Check: Install dependencies / Yarn install & cache
- GitHub Check: Install dependencies / Yarn install & cache
- GitHub Check: Install dependencies / Yarn install & cache
- GitHub Check: Install dependencies / Yarn install & cache
- GitHub Check: Install dependencies / Yarn install & cache
- GitHub Check: Install dependencies / Yarn install & cache
- GitHub Check: Install dependencies / Yarn install & cache
- GitHub Check: Install dependencies / Yarn install & cache
🔇 Additional comments (13)
packages/lib/server/repository/PrismaAttributeRepository.ts (1)
3-3
: Naming now complies with repository conventions – good job
Prisma
prefix +Repository
suffix matches the agreed guidelines.packages/lib/server/repository/PrismaAttributeOptionRepository.ts (1)
5-30
: Repository is clean and guideline-compliantUses
select
, projections are tight, and naming aligns with conventions.packages/lib/server/repository/PrismaAttributeToUserRepository.ts (1)
10-15
: Good defensive check before mass deleteEmpty-where guard prevents catastrophic deletes – nice.
apps/web/app/(use-page-wrapper)/settings/organizations/(org-user-only)/members/page.tsx (1)
20-26
: Caching looks correct with new repository – nothing to flagpackages/lib/service/attribute/server/getAttributes.ts (3)
8-9
: LGTM! Repository import statements updated correctly.The import statements have been properly updated to use the Prisma-specific repository classes, aligning with the naming convention improvements outlined in the PR objectives.
221-221
: LGTM! Repository method call updated correctly.The method call has been properly updated to use
PrismaAttributeRepository.findManyByOrgId
, maintaining the same functionality while using the renamed class.
227-228
: LGTM! Repository method call updated correctly.The method call has been properly updated to use
PrismaAttributeToUserRepository.findManyByOrgMembershipIds
, maintaining the same functionality while using the renamed class.packages/lib/service/attribute/server/assignValueToUser.ts (4)
5-6
: LGTM! Repository import statements updated correctly.The import statements have been properly updated to use the Prisma-specific repository classes, maintaining consistency with the refactoring objectives.
40-43
: Repository method call updated correctly, but consider reviewing the underlying query.The method call has been properly updated to use
PrismaAttributeRepository.findManyByNamesAndOrgIdIncludeOptions
. However, note that this method usesinclude
in its implementation, which may violate the coding guideline that states "For Prisma queries, only select data you need; never useinclude
, always useselect
".Consider reviewing the implementation of
findManyByNamesAndOrgIdIncludeOptions
in the repository file to ensure it follows theselect
pattern instead ofinclude
.
328-330
: LGTM! Repository method call updated correctly.The method call has been properly updated to use
PrismaAttributeOptionRepository.createMany
, maintaining the same functionality.
334-336
: LGTM! Repository method call updated correctly.The method call has been properly updated to use
PrismaAttributeOptionRepository.findMany
, maintaining the same functionality.packages/lib/service/attribute/server/utils.ts (2)
1-1
: LGTM! Repository import statement updated correctly.The import statement has been properly updated to use the Prisma-specific repository class, maintaining consistency with the refactoring objectives.
13-13
: LGTM! Repository method call updated correctly.The method call has been properly updated to use
PrismaAttributeToUserRepository.findManyIncludeAttribute
, maintaining the same functionality while using the renamed class.
…itory in teams members page Co-Authored-By: eunjae@cal.com <hey@eunjae.dev>
E2E results are ready! |
refactor: rename repository files and classes with Prisma prefix
Summary
Renamed three repository files in
packages/lib/server/repository/
to include the "Prisma" prefix for better naming consistency and updated all references throughout the codebase:attribute.ts
→PrismaAttributeRepository.ts
attributeOption.ts
→PrismaAttributeOptionRepository.ts
attributeToUser.ts
→PrismaAttributeToUserRepository.ts
Additionally updated the class names to match:
AttributeRepository
→PrismaAttributeRepository
AttributeOptionRepository
→PrismaAttributeOptionRepository
AttributeToUserRepository
→PrismaAttributeToUserRepository
Updated all import statements and class references across 5 files in the web app, TRPC handlers, and service layer.
Review & Testing Checklist for Human
PrismaAttributeRepository.ts
paths and class namesAttributeRepository
,AttributeOptionRepository
,AttributeToUserRepository
)membership.ts
,selectedCalendar.ts
, andteam.ts
are unrelated to these changesRecommended Test Plan
/settings/organizations/members
in the Cal.com appDiagram
Notes
membership.ts
,selectedCalendar.ts
,team.ts
) - these existed on main branch and are not caused by this PRLink to Devin run: https://app.devin.ai/sessions/7af52643b815492487430a899a99ed2f
Requested by: @eunjae-lee