-
Notifications
You must be signed in to change notification settings - Fork 71
fix: Minimize data while creating connection request #1486
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Ankita Patidar <[email protected]>
WalkthroughRepository method getInvitationDidByOrgId now returns a single agent_invitations record via findFirst with ordering, instead of an array via findMany. Service createConnectionInvitation aligns to consume a single object, simplifying variable naming and logging to debug. Other calls are reformatted without behavioral changes. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Client
participant Service as ConnectionService
participant Repo as ConnectionRepository
participant DB as Database
Client->>Service: createConnectionInvitation(orgId, ...)
Service->>Repo: getInvitationDidByOrgId(orgId)
Repo->>DB: findFirst(agent_invitations where orgId) + orderBy
DB-->>Repo: agent_invitations (single record)
Repo-->>Service: agent_invitations
Service->>Service: Resolve connectionInvitationDid (invitationDid || legacyInvitationDid)
Service-->>Client: Return invitation details
note over Service: Logging reduced to debug
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
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. Comment |
|
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: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/connection/src/connection.repository.ts (1)
376-387: Unify getInvitationDidByOrgId to return only invitationDid with null-safety
- In apps/connection/src/connection.repository.ts, apps/verification/src/repositories/verification.repository.ts and apps/issuance/src/issuance.repository.ts: change the method to
async getInvitationDidByOrgId(orgId: string): Promise<{ invitationDid: string } | null> { return this.prisma.agent_invitations.findFirst({ where: { orgId }, select: { invitationDid: true }, orderBy: { createDateTime: 'desc' } // verify: newest vs oldest }); }- Update all callers to handle a null return before dereferencing.
- Confirm with the business whether ordering should be
'desc'(newest) or'asc'(oldest).
🧹 Nitpick comments (1)
apps/connection/src/connection.service.ts (1)
538-541: Use template strings for debug logs.Second arg is treated as Logger context, not value. Interpolate values instead.
- this.logger.debug('connectionInvitationDid:', connectionInvitationDid); + this.logger.debug(`connectionInvitationDid: ${connectionInvitationDid}`); - - this.logger.debug(`logoUrl:::, ${organisation.logoUrl}`); + this.logger.debug(`logoUrl: ${organisation.logoUrl}`);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
apps/connection/src/connection.repository.ts(2 hunks)apps/connection/src/connection.service.ts(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
apps/connection/src/connection.repository.ts (2)
apps/connection/src/connection.service.ts (2)
getConnectionRecords(103-112)deleteConnectionRecords(662-703)apps/connection/src/connection.controller.ts (1)
deleteConnectionRecords(100-103)
🔇 Additional comments (1)
apps/connection/src/connection.repository.ts (1)
348-360: Good optimization: selecting only required fields.Limiting fields in findMany aligns with the PR goal and reduces payload/IO. LGTM.
Signed-off-by: Ankita Patidar <[email protected]>
|



This is linked to the reported bug #1485
Fetched only relevant data from table to optimize the performance
Summary by CodeRabbit