Issue #000000 Fix: Fix about cohort member API response code and error message#504
Issue #000000 Fix: Fix about cohort member API response code and error message#504vaibhavsTekdi wants to merge 2 commits intotekdi:aspire-leadersfrom
Conversation
WalkthroughUpdates the cohort member search to return USER_NOT_MEMBER_OF_COHORT with NOT_FOUND when a user is absent, and introduces the corresponding response key and message in the shared response mappings. No exported API signatures changed. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant C as Client
participant A as CohortMembersAdapter
participant DB as Postgres
participant R as ResponseMessages
C->>A: searchCohortMember(userId)
A->>DB: SELECT member WHERE userId=?
alt Member found
DB-->>A: Row
A-->>C: 200 OK + member data
else Member not found (updated)
DB-->>A: No rows
A->>R: API_RESPONSES.USER_NOT_MEMBER_OF_COHORT
A-->>C: 404 NOT_FOUND + USER_NOT_MEMBER_OF_COHORT
end
note over A,R: Previously returned 200 OK + USER_NOTFOUND
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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.
Actionable comments posted: 1
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge base: Disabled due to data retention organization setting
📒 Files selected for processing (2)
src/adapters/postgres/cohortMembers-adapter.ts(1 hunks)src/common/utils/response.messages.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.ts
⚙️ CodeRabbit configuration file
**/*.ts: "Review the JavaScript code for conformity with the Google JavaScript style guide, highlighting any deviations. Ensure that:
- The code adheres to best practices associated with nodejs.
- The code adheres to best practices associated with nestjs framework.
- The code adheres to best practices recommended for performance.
- The code adheres to similar naming conventions for controllers, models, services, methods, variables."
Files:
src/common/utils/response.messages.tssrc/adapters/postgres/cohortMembers-adapter.ts
🔇 Additional comments (1)
src/common/utils/response.messages.ts (1)
51-51: LGTM! Clear and specific error message.The new
USER_NOT_MEMBER_OF_COHORTconstant provides a clear, context-specific message for cohort membership scenarios, which is more precise than the genericUSER_NOTFOUNDmessage.



Summary by CodeRabbit