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 09:52:33 +02:00
committed by GitHub
parent 52b39896e2
commit 0b84bd5764
2 changed files with 26 additions and 7 deletions
@@ -7,7 +7,7 @@ export interface StorePostSearchReq {
/** /**
* The query to run the search with. * The query to run the search with.
*/ */
q: string q?: string
/** /**
* How many products to skip in the result. * How many products to skip in the result.
*/ */
@@ -16,4 +16,8 @@ export interface StorePostSearchReq {
* Limit the number of products returned. * Limit the number of products returned.
*/ */
limit?: number limit?: number
/**
* Filter based on the search engine.
*/
filter?: any
} }
@@ -10,14 +10,13 @@ import { validator } from "../../../../utils/validator"
* operationId: PostProductsSearch * operationId: PostProductsSearch
* summary: Search Products * summary: Search Products
* description: "Run a search query on products using the search engine installed on Medusa" * description: "Run a search query on products using the search engine installed on Medusa"
* parameters: * requestBody:
* - (query) q=* {string} The query to run the search with. * content:
* - (query) offset {integer} How many products to skip in the result. * application/json:
* - (query) limit {integer} Limit the number of products returned. * schema:
* - (query) filter {} Filter based on the search engine. * $ref: "#/components/schemas/StorePostSearchReq"
* x-codegen: * x-codegen:
* method: search * method: search
* queryParams: StorePostSearchReq
* x-codeSamples: * x-codeSamples:
* - lang: JavaScript * - lang: JavaScript
* label: JS Client * label: JS Client
@@ -76,6 +75,22 @@ export default async (req, res) => {
res.status(200).send(results) 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 { export class StorePostSearchReq {
@IsOptional() @IsOptional()
@IsString() @IsString()