hngprojects / hng_boilerplate_golang_web

Apache License 2.0
77 stars 49 forks source link

Feat: Create Squeeze Endpoint #282

Open Iretoms opened 1 month ago

Iretoms commented 1 month ago

Description

This PR adds a new endpoint for creating squeeze in the application. The new feature includes the implementation of the SqueezeController, SqueezeService, and necessary DTOs, entities, and a unit test.

How should this be manually tested?

  1. Open Postman.
  2. Set the request to POST.
  3. Enter the URL for your API endpoint, e.g., http://localhost:3008/api/v1/squeeze.
  4. Go to the Body tab and select raw. Then set the format to JSON and enter the JSON body with the required fields.

Example:

{
 "email": "user@example.com",
  "first_name": "John",
  "last_name": "Doe",
  "phone": "08098761234",
  "location": "Lagos, Nigeria",
  "job_title": "Software Engineer",
  "company": "X-Corp",
  "interests": ["Web Development", "Cloud Computing"],
  "referral_source": "LinkedIn"
}
  1. Click Send. You'll get a response depending on the request body.

Success Response:

{
  "status": "success",
  "message": "Your request has been received. You will get a template shortly.",
  "data": {
     "id": "uuid",
     "email": "user@example.com",
    "first_name": "John",
    "last_name": "Doe",
    "phone": "08098761234",
    "location": "Lagos, Nigeria",
    "job_title": "Software Engineer",
    "company": "X-Corp",
    "interests": ["Web Development", "Cloud Computing"],
    "referral_source": "LinkedIn"
    "created_at": "12-03-2024",
    "updated_at": "12-03-2024"
  }
}

Failure Response:

{
  "status": "error",
  "message": "Failed to submit your request",
  "status_code": 400
}

Tasks

Task: