hngprojects / hng_boilerplate_csharp_web

https://api-csharp.boilerplate.hng.tech
Apache License 2.0
79 stars 42 forks source link

feat(waitlist): Add create, get all and delete waitlist by id #373

Closed Reliable25 closed 2 weeks ago

Reliable25 commented 2 weeks ago

Description

This PR introduces endpoints for managing waitlists, including creating a new waitlist entry, retrieving all waitlist entries, and deleting a waitlist entry by ID.

Features Implemented:

  1. Create Waitlist: Allows users to create a new waitlist entry by providing an email address.
  2. Get All Waitlists: Retrieves all waitlist entries.
  3. Delete Waitlist: Deletes a specific waitlist entry by its ID.
  4. Error Handling: Manages errors for invalid requests, existing entries, and unauthorized access. Closes #issue_number_here

Changes proposed

  1. Create Waitlist

Request Body:

{
  "name": "john"
  "email": "new@example.com"
}

Successful Response:

Status Code: 201 Created Response:

{
  "message": "Waitlist entry created successfully",
  "data": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
     "name": "user1",
    "email": "user1@example.com"
  }
}

Error Responses:

Conflict: Status Code: 400 Bad Request Response:

{
  "error": "Conflict",
  "message": "Email already exists in the waitlist",
  "data": false
}
  1. Get All Waitlists

Bad Request: Status Code: 400 Bad Request Response:

{
  "error": "Bad Request",
  "message": "Error retrieving waitlists",
  "data": false
}
  1. Delete Waitlist by ID

What did you do?

Check List (Check all the applicable boxes)

🚨Please review the contribution guideline for this repository.

Screenshots/Videos