Open hackthetunnelsbot[bot] opened 1 year ago
Modify the GET /products endpoint to optionally take a query parameter called searchTerm.
GET /products
searchTerm
Ex: GET /products?searchTerm=example.
GET /products?searchTerm=example
Modify the getProducts function on service/src/infrastructure/api/routes/products.ts to account for this new query parameter.
getProducts
service/src/infrastructure/api/routes/products.ts
Additionally, add a new function to service/src/services/Product.ts called search that will be invoked if the searchTerm query parameter is present.
service/src/services/Product.ts
search
To implement the search function, read the following guide that details how query prisma using a search string.
If a searchTerm is present in the query parameters, the GET /products endpoint returns products relevant to the searchTerm.
Ex: GET /products?searchTerm=example could potentially return products with the title example.
example
Description:
Modify the
GET /products
endpoint to optionally take a query parameter calledsearchTerm
.Ex:
GET /products?searchTerm=example
.Modify the
getProducts
function onservice/src/infrastructure/api/routes/products.ts
to account for this new query parameter.Additionally, add a new function to
service/src/services/Product.ts
calledsearch
that will be invoked if thesearchTerm
query parameter is present.To implement the
search
function, read the following guide that details how query prisma using a search string.Acceptance Criteria:
If a searchTerm is present in the query parameters, the
GET /products
endpoint returns products relevant to the searchTerm.Ex:
GET /products?searchTerm=example
could potentially return products with the titleexample
.