hngprojects / hng_boilerplate_nestjs

Description
Apache License 2.0
181 stars 105 forks source link

[FEAT] Implement Endpoints for Updating user Language #1060

Open B-Beth opened 3 weeks ago

B-Beth commented 3 weeks ago

Description

Creating an API endpoint that allows users to update their preferred language in their profiles.

Acceptance Criteria

  1. The system updates the user’s preferred language in the database.
  2. A request containing an incorrect or missing user id and returns a User Not Found error.
  3. The system returns a Bad Request error indicating that the language is not supported.
  4. The system returns an OK or Successful status with a confirmation message showing the updated language.

Purpose

Allow users to update the details of an existing language, such as the name or code, by its unique ID.

Requirements

  1. Create a PUT API endpoint for updating a user's preferred language.
  2. Requires a unique identifier for the user and a new language code that the user wants to set
  3. Verify that the user id exists in the system and the new language code is among the supported languages of the app.
  4. Update the user's profile in the database with the new language preference and a notification for a successful and invalid status.

Expected Outcome

  1. Users can successfully update their preferred language.

  2. The user’s language preference is updated in the database and confirmed in the response.

Bethislearning commented 3 weeks ago

https://github.com/hngprojects/hng_boilerplate_csharp_web/pull/345