hngprojects / hng_boilerplate_python_fastapi_web

Apache License 2.0
155 stars 136 forks source link

[FEAT]: Single Products API #62

Open JoshuaOloton opened 3 months ago

JoshuaOloton commented 3 months ago

Description

Acceptance Criteria

Purpose

Requirements

Expected Outcome

Tasks

Database Schema

Table products {
  id int [pk, increment]
  name varchar(255) [not null]
  description text
  price decimal(10,2) [not null]
  available boolean [default: true]
  category varchar(255)
  created_at timestamp [default: current_timestamp]
  updated_at timestamp [default: current_timestamp]
}

Endpoint URL: GET /api/v1/products/{product-id}

Responses

Success Response

{
  "product": {
    "id": "string",
    "name": "string",
    "description": "string",
    "price": "number",
    "available": "boolean",
    "category": "string",
    "created_at": "string",
    "updated_at": "string"
  }
}

Error Responses

{
  "error": "Invalid product ID"
}
{
  "error": "Product not found"
}
{
  "errors": {
    "field": "<field>",
    "message": "<message>"
  }
}
{
  "error": "An unexpected error occurred"
}

Example Request

Fetch Single Product By ID

curl -X GET "https:/<base-url>/api/v1/products/12345

JoshuaOloton commented 3 months ago

This is the link to the approved ticket

theijhay commented 3 months ago

@Laban254 this is a duplicated issue ticket. one of the mentor has dropped it. you can ask @zxenonx about it. Thanks

Laban254 commented 3 months ago

@theijhay I just confirmed and the issue has not been dropped https://github.com/hngprojects/hng_boilerplate_nestjs/issues/181 and there is no mention in the comments that it is a duplicate. The issue i checked is the one refenced by @JoshuaOloton in the comments of this issue.

Laban254 commented 3 months ago

Hello @JoshuaOloton , if this is a duplicate, kindly follow the mentor's request.

JoshuaOloton commented 3 months ago

Hello @Laban254, this issue is not the duplicate

JoshuaOloton commented 3 months ago

The https://github.com/hngprojects/hng_boilerplate_nestjs/issues/152 which was supposedly created first was identified by Mark as a duplicate of another issue, the issue was then edited multiple times only to end up duplicating my issue https://github.com/hngprojects/hng_boilerplate_nestjs/issues/181. Pls confirm under the issue's activity section It has already been settled by a mentor, @Leona is a member of my team on the issue https://hng11.slack.com/archives/C07C462K430/p1721413390208469?thread_ts=1721412668.971629&cid=C07C462K430

theijhay commented 3 months ago

@JoshuaOloton Are you sure of what you are saying? I have nothing more to say. Goodluck!

JoshuaOloton commented 3 months ago

Pls lets avoid unnecessary banter @theijhay, this was already settled by @NdubuisiJr who gave ownership of the ticket to my team. The proofs are there, I fail to see why you're still dragging it here now with me on this repo.