Hack-The-Tunnels-8 / hack-the-tunnels-dell

hack-the-tunnels-dell created by GitHub Classroom
1 stars 1 forks source link

Update Product Endpoint #27

Closed hackthetunnelsbot[bot] closed 1 year ago

hackthetunnelsbot[bot] commented 1 year ago

Description:

Create an admin only accesible endpoint for updating one or many attributes of a product. (PUT /products/:id)

You will need to edit the following files:

Add a new PUT /products/:id route on service/src/infrastructure/api/routes/products.ts

You will need to create a new update function on service/src/services/Product.ts which your new route on products.ts will call.

You will also need to stop non admins from using this endpoint. Checkout the createProduct function on service/src/infrastructure/api/routes/products.ts for an example of how to verify a user has authorization to products.

Acceptance Criteria:

There is a new endpoint that allows you to update a product under PUT /api/v1/products/:id that is only accesible when the Authorization header is properly set.

The endpoint should update all the attributes present in the request body.

Ex: Will just update the product's title

{
    "title": "test",
}

Ex: Will update both the product's description and price

{
    "description": "test",
    "price": 1.99
}
TEMtheLEM commented 1 year ago

!review

TEMtheLEM commented 1 year ago

!complete

hackthetunnelsbot[bot] commented 1 year ago

Solved Challenges for dell

add-404-page: 2 add-deleted-column-to-products: 2 add-font-style: 1 add-footer-component: 2 add-navbar-component: 3 hello-client: 1 hello-service: 1 improve-product-preview-card-component: 2 style-page-component: 2 update-checkout-page: 2 update-favicon: 1 update-page-title: 1

winters21 commented 1 year ago

!approve

hackthetunnelsbot[bot] commented 1 year ago

Approved by @winters21

hackthetunnelsbot[bot] commented 1 year ago

This challenge did not unlock any other challenges