Skip to content
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

[Feat] Implement Endpoint to Update User Region #232

Open
5 tasks
dorisjenny27 opened this issue Aug 8, 2024 · 0 comments
Open
5 tasks

[Feat] Implement Endpoint to Update User Region #232

dorisjenny27 opened this issue Aug 8, 2024 · 0 comments

Comments

@dorisjenny27
Copy link
Contributor

Description

This issue involves creating an endpoint to update the region preference for a specific user in the system.

Endpoint

Method: PUT
URL: /api/v1/users/{userId}/region

Request Body

Content-Type: application/json
Body:

{
  "region_code": "string"
}

Success Response

Status Code: 200
Body:

{
  "status_code": 200,
  "message": "User region updated successfully"
}

Error Responses

  • Unauthorized (401)
    Body:

    {
      "status_code": 401,
      "message": "Unauthorized"
    }
  • Forbidden (403)
    Body:

    {
      "status_code": 403,
      "message": "Forbidden"
    }
  • Not Found (404)
    Body:

    {
      "status_code": 404,
      "message": "User not found"
    }
  • Bad Request (400)
    Body:

    {
      "status_code": 400,
      "message": "Invalid region code"
    }

Checklist

  • Implement PUT /api/v1/users/{userId}/region endpoint.
  • Ensure endpoint requires valid Authorization token.
  • Validate the provided region code.
  • Create unit tests for the endpoint.
  • Update API documentation.

Error Handling

  • Invalid request parameters (400 Bad Request)
  • Authentication failure (401 Unauthorized)
  • Authorization failure (403 Forbidden)
  • User not found (404 Not Found)
  • Internal server errors (500 Internal Server Error)

Security Measures

  1. Use HTTPS for all API communications.
  2. Implement rate limiting to prevent abuse.
  3. Validate and sanitize all input parameters.
  4. Use environment variables for storing sensitive data.
  5. Implement proper authentication and authorization checks.

Tasks

  1. Create UpdateUserRegionCommand and handler.
  2. Implement controller action for the endpoint.
  3. Implement authorization checks.
  4. Implement error handling and logging.
  5. Write unit and integration tests.
  6. Add Swagger documentation for the API endpoint.
  7. Perform security review and penetration testing.
  8. Deploy to staging environment for testing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant