chore: fix OAS for product search endpoint (#4490)

* chore: fix OAS for product search endpoint

* added build files
This commit is contained in:
Shahed Nasser
2023-07-12 10:52:33 +03:00
committed by GitHub
parent 52b39896e2
commit 0b84bd5764
2 changed files with 26 additions and 7 deletions

View File

@@ -7,7 +7,7 @@ export interface StorePostSearchReq {
/**
* The query to run the search with.
*/
q: string
q?: string
/**
* How many products to skip in the result.
*/
@@ -16,4 +16,8 @@ export interface StorePostSearchReq {
* Limit the number of products returned.
*/
limit?: number
/**
* Filter based on the search engine.
*/
filter?: any
}

View File

@@ -10,14 +10,13 @@ import { validator } from "../../../../utils/validator"
* operationId: PostProductsSearch
* summary: Search Products
* description: "Run a search query on products using the search engine installed on Medusa"
* parameters:
* - (query) q=* {string} The query to run the search with.
* - (query) offset {integer} How many products to skip in the result.
* - (query) limit {integer} Limit the number of products returned.
* - (query) filter {} Filter based on the search engine.
* requestBody:
* content:
* application/json:
* schema:
* $ref: "#/components/schemas/StorePostSearchReq"
* x-codegen:
* method: search
* queryParams: StorePostSearchReq
* x-codeSamples:
* - lang: JavaScript
* label: JS Client
@@ -76,6 +75,22 @@ export default async (req, res) => {
res.status(200).send(results)
}
/**
* @schema StorePostSearchReq
* type: object
* properties:
* q:
* type: string
* description: The query to run the search with.
* offset:
* type: number
* description: How many products to skip in the result.
* limit:
* type: number
* description: Limit the number of products returned.
* filter:
* description: Filter based on the search engine.
*/
export class StorePostSearchReq {
@IsOptional()
@IsString()