chore(oas): fixed oas for product category endpoints and model (#3014)

This commit is contained in:
Shahed Nasser
2023-01-12 21:35:13 +02:00
committed by GitHub
parent b2839e2e4d
commit 5d769ccad2
6 changed files with 10 additions and 60 deletions

View File

@@ -21,18 +21,6 @@ import { FindParams } from "../../../../types/common"
* schema:
* $ref: "#/components/schemas/AdminPostProductCategoriesReq"
* x-codeSamples:
* - lang: JavaScript
* label: JS Client
* source: |
* import Medusa from "@medusajs/medusa-js"
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
* // must be previously logged in or use api token
* medusa.admin.productCategories.create({
* name: 'Jeans',
* })
* .then(({ productCategory }) => {
* console.log(productCategory.id);
* });
* - lang: Shell
* label: cURL
* source: |
@@ -55,7 +43,7 @@ import { FindParams } from "../../../../types/common"
* schema:
* type: object
* properties:
* productCategory:
* product_category:
* $ref: "#/components/schemas/ProductCategory"
* "400":
* $ref: "#/components/responses/400_error"

View File

@@ -12,16 +12,6 @@ import { ProductCategoryService } from "../../../../services"
* parameters:
* - (path) id=* {string} The ID of the Product Category
* x-codeSamples:
* - lang: JavaScript
* label: JS Client
* source: |
* import Medusa from "@medusajs/medusa-js"
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
* // must be previously logged in or use api token
* medusa.admin.productCategories.delete(product_category_id)
* .then(({ id, object, deleted }) => {
* console.log(id);
* });
* - lang: Shell
* label: cURL
* source: |

View File

@@ -13,16 +13,6 @@ import { defaultAdminProductCategoryRelations } from "."
* parameters:
* - (path) id=* {string} The ID of the Product Category
* x-codeSamples:
* - lang: JavaScript
* label: JS Client
* source: |
* import Medusa from "@medusajs/medusa-js"
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
* // must be previously logged in or use api token
* medusa.admin.productCategories.retrieve("pcat-id")
* .then(({ productCategory }) => {
* console.log(productCategory.id);
* });
* - lang: Shell
* label: cURL
* source: |
@@ -32,7 +22,7 @@ import { defaultAdminProductCategoryRelations } from "."
* - api_token: []
* - cookie_auth: []
* tags:
* - Category
* - Product Category
* responses:
* "200":
* description: OK
@@ -41,7 +31,7 @@ import { defaultAdminProductCategoryRelations } from "."
* schema:
* type: object
* properties:
* productCategory:
* product_category:
* $ref: "#/components/schemas/ProductCategory"
* "400":
* $ref: "#/components/responses/400_error"

View File

@@ -19,16 +19,6 @@ import { extendedFindParamsMixin } from "../../../../types/common"
* - (query) offset=0 {integer} How many product categories to skip in the result.
* - (query) limit=100 {integer} Limit the number of product categories returned.
* x-codeSamples:
* - lang: JavaScript
* label: JS Client
* source: |
* import Medusa from "@medusajs/medusa-js"
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
* // must be previously logged in or use api token
* medusa.admin.productCategories.list()
* .then(({ product_category, limit, offset, count }) => {
* console.log(product_category.length);
* });
* - lang: Shell
* label: cURL
* source: |
@@ -38,7 +28,7 @@ import { extendedFindParamsMixin } from "../../../../types/common"
* - api_token: []
* - cookie_auth: []
* tags:
* - Product Categories
* - Product Category
* responses:
* 200:
* description: OK
@@ -47,7 +37,7 @@ import { extendedFindParamsMixin } from "../../../../types/common"
* schema:
* type: object
* properties:
* product_category:
* product_categories:
* type: array
* items:
* $ref: "#/components/schemas/ProductCategory"

View File

@@ -21,18 +21,6 @@ import { FindParams } from "../../../../types/common"
* schema:
* $ref: "#/components/schemas/AdminPostProductCategoriesCategoryReq"
* x-codeSamples:
* - lang: JavaScript
* label: JS Client
* source: |
* import Medusa from "@medusajs/medusa-js"
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
* // must be previously logged in or use api token
* medusa.admin.productCategories.update(categoryId, {
* name: 'Skinny Jeans'
* })
* .then(({ productCategory }) => {
* console.log(productCategory.id);
* });
* - lang: Shell
* label: cURL
* source: |
@@ -55,7 +43,7 @@ import { FindParams } from "../../../../types/common"
* schema:
* type: object
* properties:
* productCategory:
* product_category:
* $ref: "#/components/schemas/ProductCategory"
* "400":
* $ref: "#/components/responses/400_error"

View File

@@ -96,6 +96,10 @@ export class ProductCategory extends SoftDeletableEntity {
* items:
* type: object
* description: A product category object.
* parent_category_id:
* description: The ID of the parent category.
* type: string
* default: null
* parent_category:
* description: A product category object. Available if the relation `parent_category` is expanded.
* type: object