-
Notifications
You must be signed in to change notification settings - Fork 11.6k
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: [email protected] <[email protected]>
🤖 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 learningsapps/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: [email protected] <[email protected]>
|
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:includeviolates our Prisma-query guideline – switch toselectCoding-guidelines mandate: “never use
include, always useselect”.
Replace theincludewith an equivalent nestedselectto 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
findAllByOrgIdWithOptionsalso 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:includehere breaches the “no-include” ruleSwitch to a nested
selectto 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 alloptionsfields – narrow the projection
options: truepulls 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
Repositorysuffix, prefix with technology if applicable (e.g.,PrismaAppRepository.ts), and use PascalCase matching the exported class
Files:
packages/lib/server/repository/PrismaAttributeToUserRepository.tspackages/lib/server/repository/PrismaAttributeRepository.tspackages/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.keyfield is never returned from tRPC endpoints or APIs
Files:
packages/lib/server/repository/PrismaAttributeToUserRepository.tspackages/lib/server/repository/PrismaAttributeRepository.tspackages/lib/server/repository/PrismaAttributeOptionRepository.tspackages/trpc/server/routers/viewer/attributes/list.handler.tspackages/lib/service/attribute/server/getAttributes.tspackages/lib/service/attribute/server/assignValueToUser.tspackages/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.tspackages/lib/server/repository/PrismaAttributeRepository.tspackages/lib/server/repository/PrismaAttributeOptionRepository.tspackages/trpc/server/routers/viewer/attributes/list.handler.tsapps/web/app/(use-page-wrapper)/settings/organizations/(org-user-only)/members/page.tsxpackages/lib/service/attribute/server/getAttributes.tspackages/lib/service/attribute/server/assignValueToUser.tspackages/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
Prismaprefix +Repositorysuffix 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 usesincludein 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
findManyByNamesAndOrgIdIncludeOptionsin the repository file to ensure it follows theselectpattern 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: [email protected] <[email protected]>
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.tsattributeOption.ts→PrismaAttributeOptionRepository.tsattributeToUser.ts→PrismaAttributeToUserRepository.tsAdditionally updated the class names to match:
AttributeRepository→PrismaAttributeRepositoryAttributeOptionRepository→PrismaAttributeOptionRepositoryAttributeToUserRepository→PrismaAttributeToUserRepositoryUpdated all import statements and class references across 5 files in the web app, TRPC handlers, and service layer.
Review & Testing Checklist for Human
PrismaAttributeRepository.tspaths and class namesAttributeRepository,AttributeOptionRepository,AttributeToUserRepository)membership.ts,selectedCalendar.ts, andteam.tsare unrelated to these changesRecommended Test Plan
/settings/organizations/membersin the Cal.com appDiagram
%%{ init : { "theme" : "default" }}%% graph TD PrismaAttrRepo["PrismaAttributeRepository.ts"]:::major-edit PrismaAttrOptRepo["PrismaAttributeOptionRepository.ts"]:::major-edit PrismaAttrToUserRepo["PrismaAttributeToUserRepository.ts"]:::major-edit MembersPage["members/page.tsx"]:::minor-edit AssignValueToUser["assignValueToUser.ts"]:::minor-edit GetAttributes["getAttributes.ts"]:::minor-edit Utils["utils.ts"]:::minor-edit ListHandler["list.handler.ts"]:::minor-edit PrismaAttrRepo --> MembersPage PrismaAttrRepo --> AssignValueToUser PrismaAttrRepo --> GetAttributes PrismaAttrRepo --> ListHandler PrismaAttrOptRepo --> AssignValueToUser PrismaAttrToUserRepo --> GetAttributes PrismaAttrToUserRepo --> Utils 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:#FFFFFFNotes
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