-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Description
Implement backend functionality to support storing session or user cookies, ensuring they are securely stored and applied correctly across the application.
Acceptance Criteria
Database Schema Update
- Update the database schema to include user session details (userId, sessionId, expiry).
- Ensure the schema can accommodate future additions.
API Endpoints Implementation
- Create an endpoint to store session cookies.
- Implement an endpoint to retrieve the user's current session details.
Session Management
- Validate inputs for userId and sessionId.
- Store session details securely in the database.
- Ensure session details are applied consistently across user sessions.
Security and Performance
- Implement proper authentication and authorization for updates to the user's session details.
Documentation
- Create comprehensive API documentation for all new endpoints.
- Include examples of request/response payloads in the documentation.
Purpose
Provide backend infrastructure to manage and store user session details, enabling a secure user experience.
Requirements
- Create API endpoints for:
- Setting user session details.
- Getting user session details.
- Implement server-side validation for session inputs.
- Ensure session details are applied to all user-facing content.
- Write unit tests for new endpoints and logic.
- Update API documentation to include new session-related endpoints.
Expected Outcome
Successfully store and apply user-selected session details across the different parts of the application.
Endpoints
Store User Session
- Description: Store session details for a user.
- POST /api/v1/session
Request Body:
{
"userId": "user123",
"sessionId": "session456",
"expiry": "2024-12-31T23:59:59.000Z"
}Response (Success):
{
"status": "success",
"message": "Session details stored successfully.",
"data": {
"userId": "user123",
"sessionId": "session456",
"expiry": "2024-12-31T23:59:59.000Z"
}
}Response (Error):
{
"status": "error",
"message": "Invalid session details passed.",
"statusCode": 422
}{
"status": "error",
"message": "You are not authorised for this action",
"statusCode": 401
}Get User Session
- Description: Get the current session details for a user.
- GET /api/v1/session
Response (Success):
{
"status": "success",
"data": {
"userId": "user123",
"sessionId": "session456",
"expiry": "2024-12-31T23:59:59.000Z"
}
}Response (Error):
{
"status": "error",
"message": "You are not authorised for this action",
"statusCode": 401
}Testing
- Develop unit tests for all new endpoints and database interactions.
- Implement integration tests to ensure session details are stored and retrieved correctly across the application.
Metadata
Metadata
Assignees
Labels
No labels