feat/ add API contract for impersonation session feature#244
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Summary by CodeRabbit
WalkthroughA new API endpoint, Changes
Sequence Diagram(s)sequenceDiagram
participant SuperUser
participant API
participant ImpersonationSession
SuperUser->>API: PATCH /impersonation/:id?action=START&dev=true
API->>ImpersonationSession: Start session for :id
ImpersonationSession-->>API: Session started (details)
API-->>SuperUser: Success response with session data
SuperUser->>API: PATCH /impersonation/:id?action=STOP&dev=true
API->>ImpersonationSession: Stop session for :id
ImpersonationSession-->>API: Session stopped (details)
API-->>SuperUser: Success response with session data
Possibly related PRs
Suggested reviewers
Poem
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 (
|
There was a problem hiding this comment.
Actionable comments posted: 6
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
impersonation/README.md(1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: Suvidh-kaushik
PR: Real-Dev-Squad/website-api-contracts#242
File: impersonation/README.md:119-122
Timestamp: 2025-06-23T17:43:25.779Z
Learning: In the impersonation API documentation, the `dev` flag description in the POST method is incorrect and will be fixed in a separate GET PR. The PATCH method's `dev` flag behavior should follow the pattern of other update contracts in the project.
Learnt from: Suvidh-kaushik
PR: Real-Dev-Squad/website-api-contracts#240
File: impersonation/README.md:117-127
Timestamp: 2025-06-22T16:30:06.385Z
Learning: In the GET /impersonation/requests API endpoint, the `dev` query parameter is required. Without this parameter, the API returns a 404 not found error, so it's not just for enabling a developer view but is necessary for the endpoint to work at all.
Learnt from: Suvidh-kaushik
PR: Real-Dev-Squad/website-api-contracts#240
File: impersonation/README.md:181-190
Timestamp: 2025-06-22T16:28:01.053Z
Learning: In the impersonation API, a 204 No Content response is returned when filter criteria don't match any impersonation requests, rather than returning an empty array with 200 status.
Learnt from: Suvidh-kaushik
PR: Real-Dev-Squad/website-api-contracts#240
File: impersonation/README.md:137-180
Timestamp: 2025-06-22T16:26:40.204Z
Learning: The impersonation API uses cursor-based pagination by default with `next` and `prev` fields, not page-based pagination with `nextPage`.
impersonation/README.md (2)
Learnt from: Suvidh-kaushik
PR: Real-Dev-Squad/website-api-contracts#242
File: impersonation/README.md:119-122
Timestamp: 2025-06-23T17:43:25.779Z
Learning: In the impersonation API documentation, the `dev` flag description in the POST method is incorrect and will be fixed in a separate GET PR. The PATCH method's `dev` flag behavior should follow the pattern of other update contracts in the project.
Learnt from: Suvidh-kaushik
PR: Real-Dev-Squad/website-api-contracts#240
File: impersonation/README.md:117-127
Timestamp: 2025-06-22T16:30:06.385Z
Learning: In the GET /impersonation/requests API endpoint, the `dev` query parameter is required. Without this parameter, the API returns a 404 not found error, so it's not just for enabling a developer view but is necessary for the endpoint to work at all.
🪛 LanguageTool
impersonation/README.md
[uncategorized] ~362-~362: Loose punctuation mark.
Context: ...ted. - Query Parameters: - dev: Required boolean feature flag to update...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~363-~363: Loose punctuation mark.
Context: ...g to update request status. - action: Required string to start or stop the im...
(UNLIKELY_OPENING_PUNCTUATION)
🪛 markdownlint-cli2 (0.17.2)
impersonation/README.md
375-375: Multiple consecutive blank lines
Expected: 1; Actual: 2
(MD012, no-multiple-blanks)
435-435: Heading levels should only increment by one level at a time
Expected: h3; Actual: h4
(MD001, heading-increment)
6e1e3ac to
18936cf
Compare
18936cf to
4af32d9
Compare
4af32d9 to
f0d8e3c
Compare
f0d8e3c to
bc1e895
Compare
bc0011d to
1398040
Compare
Date: 29/06/2025
Developer Name: Suvidh Kaushik
Issue Ticket Number
Description
Documentation Updated?
Under Feature Flag
Database Changes
Breaking Changes
Development Tested?
Screenshots
Screenshot 1
Test Coverage
Screenshot 1
Additional Notes
Description by Korbit AI
What change is being made?
Add API contract documentation for the PATCH /impersonation/:id endpoint to start and stop impersonation sessions.
Why are these changes being made?
This change is made to provide clear API documentation for a new feature allowing super-users to manage impersonation sessions. This ensures developers understand the endpoint requirements, parameters, responses, authentication, and authorization details needed to implement and interact with the feature effectively.