diff --git a/packages/medusa/src/api/routes/admin/apps/authorize-app.ts b/packages/medusa/src/api/routes/admin/apps/authorize-app.ts index 75c928c1c1..e516043b3d 100644 --- a/packages/medusa/src/api/routes/admin/apps/authorize-app.ts +++ b/packages/medusa/src/api/routes/admin/apps/authorize-app.ts @@ -37,10 +37,7 @@ import { validator } from "../../../../utils/validator" * content: * application/json: * schema: - * type: object - * properties: - * apps: - * $ref: "#/components/schemas/OAuth" + * $ref: "#/components/schemas/AdminAppsRes" * "400": * $ref: "#/components/responses/400_error" * "401": diff --git a/packages/medusa/src/api/routes/admin/apps/index.ts b/packages/medusa/src/api/routes/admin/apps/index.ts index 8ed85f82f1..2068a770de 100644 --- a/packages/medusa/src/api/routes/admin/apps/index.ts +++ b/packages/medusa/src/api/routes/admin/apps/index.ts @@ -16,10 +16,26 @@ export default (app) => { return app } +/** + * @schema AdminAppsRes + * type: object + * properties: + * apps: + * $ref: "#/components/schemas/OAuth" + */ export type AdminAppsRes = { apps: Oauth } +/** + * @schema AdminAppsListRes + * type: object + * properties: + * apps: + * type: array + * items: + * $ref: "#/components/schemas/OAuth" + */ export type AdminAppsListRes = { apps: Oauth[] } diff --git a/packages/medusa/src/api/routes/admin/apps/list.ts b/packages/medusa/src/api/routes/admin/apps/list.ts index 9dbae39aea..2ba191832d 100644 --- a/packages/medusa/src/api/routes/admin/apps/list.ts +++ b/packages/medusa/src/api/routes/admin/apps/list.ts @@ -23,12 +23,7 @@ import { OauthService } from "../../../../services" * content: * application/json: * schema: - * type: object - * properties: - * apps: - * type: array - * items: - * $ref: "#/components/schemas/OAuth" + * $ref: "#/components/schemas/AdminAppsListRes" * "400": * $ref: "#/components/responses/400_error" * "401": diff --git a/packages/medusa/src/api/routes/admin/auth/create-session.ts b/packages/medusa/src/api/routes/admin/auth/create-session.ts index 7d9e664c3d..948ea3a5bb 100644 --- a/packages/medusa/src/api/routes/admin/auth/create-session.ts +++ b/packages/medusa/src/api/routes/admin/auth/create-session.ts @@ -50,10 +50,7 @@ import { validator } from "../../../../utils/validator" * content: * application/json: * schema: - * type: object - * properties: - * user: - * $ref: "#/components/schemas/User" + * $ref: "#/components/schemas/AdminAuthRes" * "400": * $ref: "#/components/responses/400_error" * "401": diff --git a/packages/medusa/src/api/routes/admin/auth/get-session.ts b/packages/medusa/src/api/routes/admin/auth/get-session.ts index c317076d83..417996af2d 100644 --- a/packages/medusa/src/api/routes/admin/auth/get-session.ts +++ b/packages/medusa/src/api/routes/admin/auth/get-session.ts @@ -34,10 +34,7 @@ import _ from "lodash" * content: * application/json: * schema: - * type: object - * properties: - * user: - * $ref: "#/components/schemas/User" + * $ref: "#/components/schemas/AdminAuthRes" * "400": * $ref: "#/components/responses/400_error" * "401": diff --git a/packages/medusa/src/api/routes/admin/auth/index.ts b/packages/medusa/src/api/routes/admin/auth/index.ts index da53e84125..272aeb81f3 100644 --- a/packages/medusa/src/api/routes/admin/auth/index.ts +++ b/packages/medusa/src/api/routes/admin/auth/index.ts @@ -23,6 +23,13 @@ export default (app) => { return app } +/** + * @schema AdminAuthRes + * type: object + * properties: + * user: + * $ref: "#/components/schemas/User" + */ export type AdminAuthRes = { user: Omit } diff --git a/packages/medusa/src/api/routes/admin/batch/cancel-batch-job.ts b/packages/medusa/src/api/routes/admin/batch/cancel-batch-job.ts index 20aa04559e..71eb2e447f 100644 --- a/packages/medusa/src/api/routes/admin/batch/cancel-batch-job.ts +++ b/packages/medusa/src/api/routes/admin/batch/cancel-batch-job.ts @@ -36,10 +36,7 @@ import { EntityManager } from "typeorm" * content: * application/json: * schema: - * type: object - * properties: - * batch_job: - * $ref: "#/components/schemas/BatchJob" + * $ref: "#/components/schemas/AdminBatchJobRes" * "400": * $ref: "#/components/responses/400_error" * "401": diff --git a/packages/medusa/src/api/routes/admin/batch/confirm-batch-job.ts b/packages/medusa/src/api/routes/admin/batch/confirm-batch-job.ts index c39295e6e8..98b8c6d811 100644 --- a/packages/medusa/src/api/routes/admin/batch/confirm-batch-job.ts +++ b/packages/medusa/src/api/routes/admin/batch/confirm-batch-job.ts @@ -36,10 +36,7 @@ import { EntityManager } from "typeorm" * content: * application/json: * schema: - * type: object - * properties: - * batch_job: - * $ref: "#/components/schemas/BatchJob" + * $ref: "#/components/schemas/AdminBatchJobRes" * "400": * $ref: "#/components/responses/400_error" * "401": diff --git a/packages/medusa/src/api/routes/admin/batch/create-batch-job.ts b/packages/medusa/src/api/routes/admin/batch/create-batch-job.ts index 783334101b..b289606821 100644 --- a/packages/medusa/src/api/routes/admin/batch/create-batch-job.ts +++ b/packages/medusa/src/api/routes/admin/batch/create-batch-job.ts @@ -51,10 +51,7 @@ import { validator } from "../../../../utils/validator" * content: * application/json: * schema: - * type: object - * properties: - * batch_job: - * $ref: "#/components/schemas/BatchJob" + * $ref: "#/components/schemas/AdminBatchJobRes" * "400": * $ref: "#/components/responses/400_error" * "401": diff --git a/packages/medusa/src/api/routes/admin/batch/get-batch-job.ts b/packages/medusa/src/api/routes/admin/batch/get-batch-job.ts index 06ae5e3015..b3fe0c2d3a 100644 --- a/packages/medusa/src/api/routes/admin/batch/get-batch-job.ts +++ b/packages/medusa/src/api/routes/admin/batch/get-batch-job.ts @@ -33,10 +33,7 @@ * content: * application/json: * schema: - * type: object - * properties: - * batch_job: - * $ref: "#/components/schemas/BatchJob" + * $ref: "#/components/schemas/AdminBatchJobRes" * "400": * $ref: "#/components/responses/400_error" * "401": diff --git a/packages/medusa/src/api/routes/admin/batch/index.ts b/packages/medusa/src/api/routes/admin/batch/index.ts index 49ebc99a53..d408023f91 100644 --- a/packages/medusa/src/api/routes/admin/batch/index.ts +++ b/packages/medusa/src/api/routes/admin/batch/index.ts @@ -42,12 +42,35 @@ export default (app) => { return app } +/** + * @schema AdminBatchJobRes + * type: object + * properties: + * batch_job: + * $ref: "#/components/schemas/BatchJob" + */ export type AdminBatchJobRes = { batch_job: BatchJob } -export type AdminBatchJobDeleteRes = DeleteResponse - +/** + * @schema AdminBatchJobListRes + * type: object + * properties: + * batch_jobs: + * type: array + * items: + * $ref: "#/components/schemas/BatchJob" + * count: + * type: integer + * description: The total number of items available + * offset: + * type: integer + * description: The number of items skipped before these items + * limit: + * type: integer + * description: The number of items per page + */ export type AdminBatchJobListRes = PaginatedResponse & { batch_jobs: BatchJob[] } diff --git a/packages/medusa/src/api/routes/admin/batch/list-batch-jobs.ts b/packages/medusa/src/api/routes/admin/batch/list-batch-jobs.ts index 32094e4de4..f36ed50ddc 100644 --- a/packages/medusa/src/api/routes/admin/batch/list-batch-jobs.ts +++ b/packages/medusa/src/api/routes/admin/batch/list-batch-jobs.ts @@ -237,21 +237,7 @@ import { isDefined } from "medusa-core-utils" * content: * application/json: * schema: - * type: object - * properties: - * batch_jobs: - * type: array - * items: - * $ref: "#/components/schemas/BatchJob" - * count: - * type: integer - * description: The total number of items available - * offset: - * type: integer - * description: The number of items skipped before these items - * limit: - * type: integer - * description: The number of items per page + * $ref: "#/components/schemas/AdminBatchJobListRes" * "400": * $ref: "#/components/responses/400_error" * "401": diff --git a/packages/medusa/src/api/routes/admin/collections/add-products.ts b/packages/medusa/src/api/routes/admin/collections/add-products.ts index 678d3deddf..2da41a60f2 100644 --- a/packages/medusa/src/api/routes/admin/collections/add-products.ts +++ b/packages/medusa/src/api/routes/admin/collections/add-products.ts @@ -40,10 +40,7 @@ import ProductCollectionService from "../../../../services/product-collection" * content: * application/json: * schema: - * type: object - * properties: - * collection: - * $ref: "#/components/schemas/ProductCollection" + * $ref: "#/components/schemas/AdminCollectionsRes" * "400": * $ref: "#/components/responses/400_error" * "401": diff --git a/packages/medusa/src/api/routes/admin/collections/create-collection.ts b/packages/medusa/src/api/routes/admin/collections/create-collection.ts index b2e9b8afb7..498f1525a2 100644 --- a/packages/medusa/src/api/routes/admin/collections/create-collection.ts +++ b/packages/medusa/src/api/routes/admin/collections/create-collection.ts @@ -47,10 +47,7 @@ import { EntityManager } from "typeorm" * content: * application/json: * schema: - * type: object - * properties: - * collection: - * $ref: "#/components/schemas/ProductCollection" + * $ref: "#/components/schemas/AdminCollectionsRes" * "400": * $ref: "#/components/responses/400_error" * "401": diff --git a/packages/medusa/src/api/routes/admin/collections/delete-collection.ts b/packages/medusa/src/api/routes/admin/collections/delete-collection.ts index e90547f0cf..cd47a31ca9 100644 --- a/packages/medusa/src/api/routes/admin/collections/delete-collection.ts +++ b/packages/medusa/src/api/routes/admin/collections/delete-collection.ts @@ -38,19 +38,7 @@ import ProductCollectionService from "../../../../services/product-collection" * content: * application/json: * schema: - * type: object - * properties: - * id: - * type: string - * description: The ID of the deleted Collection - * object: - * type: string - * description: The type of the object that was deleted. - * default: product-collection - * deleted: - * type: boolean - * description: Whether the collection was deleted successfully or not. - * default: true + * $ref: "#/components/schemas/AdminCollectionsDeleteRes" * "400": * $ref: "#/components/responses/400_error" * "401": diff --git a/packages/medusa/src/api/routes/admin/collections/get-collection.ts b/packages/medusa/src/api/routes/admin/collections/get-collection.ts index 300928f025..aed4dd1b77 100644 --- a/packages/medusa/src/api/routes/admin/collections/get-collection.ts +++ b/packages/medusa/src/api/routes/admin/collections/get-collection.ts @@ -38,10 +38,7 @@ import { defaultAdminCollectionsRelations } from "." * content: * application/json: * schema: - * type: object - * properties: - * collection: - * $ref: "#/components/schemas/ProductCollection" + * $ref: "#/components/schemas/AdminCollectionsRes" * "400": * $ref: "#/components/responses/400_error" * "401": diff --git a/packages/medusa/src/api/routes/admin/collections/index.ts b/packages/medusa/src/api/routes/admin/collections/index.ts index 28814bc2f0..60fcfbb504 100644 --- a/packages/medusa/src/api/routes/admin/collections/index.ts +++ b/packages/medusa/src/api/routes/admin/collections/index.ts @@ -69,12 +69,77 @@ export const defaultAdminCollectionsFields = [ ] export const defaultAdminCollectionsRelations = ["products"] +/** + * @schema AdminCollectionsListRes + * type: object + * properties: + * collections: + * type: array + * items: + * $ref: "#/components/schemas/ProductCollection" + * count: + * type: integer + * description: The total number of items available + * offset: + * type: integer + * description: The number of items skipped before these items + * limit: + * type: integer + * description: The number of items per page + */ export type AdminCollectionsListRes = PaginatedResponse & { collections: ProductCollection[] } +/** + * @schema AdminCollectionsDeleteRes + * type: object + * properties: + * id: + * type: string + * description: The ID of the deleted Collection + * object: + * type: string + * description: The type of the object that was deleted. + * default: product-collection + * deleted: + * type: boolean + * description: Whether the collection was deleted successfully or not. + * default: true + */ export type AdminCollectionsDeleteRes = DeleteResponse +/** + * @schema AdminDeleteProductsFromCollectionRes + * type: object + * properties: + * id: + * type: string + * description: "The ID of the collection" + * object: + * type: string + * description: "The type of object the removal was executed on" + * default: product-collection + * removed_products: + * description: "The IDs of the products removed from the collection" + * type: array + * items: + * description: "The ID of a Product to add to the Product Collection." + * type: string + */ +export type AdminDeleteProductsFromCollectionRes = { + id: string + object: string + removed_products: string[] +} + +/** + * @schema AdminCollectionsRes + * type: object + * properties: + * collection: + * $ref: "#/components/schemas/ProductCollection" + */ export type AdminCollectionsRes = { collection: ProductCollection } diff --git a/packages/medusa/src/api/routes/admin/collections/list-collections.ts b/packages/medusa/src/api/routes/admin/collections/list-collections.ts index a44ae23df1..ea0ed5fb10 100644 --- a/packages/medusa/src/api/routes/admin/collections/list-collections.ts +++ b/packages/medusa/src/api/routes/admin/collections/list-collections.ts @@ -111,21 +111,7 @@ import { Type } from "class-transformer" * content: * application/json: * schema: - * type: object - * properties: - * collections: - * type: array - * items: - * $ref: "#/components/schemas/ProductCollection" - * count: - * type: integer - * description: The total number of items available - * offset: - * type: integer - * description: The number of items skipped before these items - * limit: - * type: integer - * description: The number of items per page + * $ref: "#/components/schemas/AdminCollectionsListRes" * "400": * $ref: "#/components/responses/400_error" * "401": diff --git a/packages/medusa/src/api/routes/admin/collections/remove-products.ts b/packages/medusa/src/api/routes/admin/collections/remove-products.ts index 3f75f60951..8e9c75a409 100644 --- a/packages/medusa/src/api/routes/admin/collections/remove-products.ts +++ b/packages/medusa/src/api/routes/admin/collections/remove-products.ts @@ -40,21 +40,7 @@ import ProductCollectionService from "../../../../services/product-collection" * content: * application/json: * schema: - * type: object - * properties: - * id: - * type: string - * description: "The ID of the collection" - * object: - * type: string - * description: "The type of object the removal was executed on" - * default: product-collection - * removed_products: - * description: "The IDs of the products removed from the collection" - * type: array - * items: - * description: "The ID of a Product to add to the Product Collection." - * type: string + * $ref: "#/components/schemas/AdminDeleteProductsFromCollectionRes" * "400": * $ref: "#/components/responses/400_error" * "401": diff --git a/packages/medusa/src/api/routes/admin/collections/update-collection.ts b/packages/medusa/src/api/routes/admin/collections/update-collection.ts index 485879abe3..f6b572fb75 100644 --- a/packages/medusa/src/api/routes/admin/collections/update-collection.ts +++ b/packages/medusa/src/api/routes/admin/collections/update-collection.ts @@ -49,10 +49,7 @@ import ProductCollectionService from "../../../../services/product-collection" * content: * application/json: * schema: - * type: object - * properties: - * collection: - * $ref: "#/components/schemas/ProductCollection" + * $ref: "#/components/schemas/AdminCollectionsRes" * "400": * $ref: "#/components/responses/400_error" * "401": diff --git a/packages/medusa/src/api/routes/admin/currencies/index.ts b/packages/medusa/src/api/routes/admin/currencies/index.ts index 9bfb597f2d..8d7d342daf 100644 --- a/packages/medusa/src/api/routes/admin/currencies/index.ts +++ b/packages/medusa/src/api/routes/admin/currencies/index.ts @@ -32,10 +32,35 @@ export default (app) => { return app } +/** + * @schema AdminCurrenciesListRes + * type: object + * properties: + * currencies: + * type: array + * items: + * $ref: "#/components/schemas/Currency" + * count: + * type: integer + * description: The total number of items available + * offset: + * type: integer + * description: The number of items skipped before these items + * limit: + * type: integer + * description: The number of items per page + */ export type AdminCurrenciesListRes = PaginatedResponse & { currencies: Currency[] } +/** + * @schema AdminCurrenciesRes + * type: object + * properties: + * currency: + * $ref: "#/components/schemas/Currency" + */ export type AdminCurrenciesRes = { currency: Currency } diff --git a/packages/medusa/src/api/routes/admin/currencies/list-currencies.ts b/packages/medusa/src/api/routes/admin/currencies/list-currencies.ts index 2921525879..aad9d4ea49 100644 --- a/packages/medusa/src/api/routes/admin/currencies/list-currencies.ts +++ b/packages/medusa/src/api/routes/admin/currencies/list-currencies.ts @@ -42,21 +42,7 @@ import { FeatureFlagDecorators } from "../../../../utils/feature-flag-decorators * content: * application/json: * schema: - * type: object - * properties: - * currencies: - * type: array - * items: - * $ref: "#/components/schemas/Currency" - * count: - * type: integer - * description: The total number of items available - * offset: - * type: integer - * description: The number of items skipped before these items - * limit: - * type: integer - * description: The number of items per page + * $ref: "#/components/schemas/AdminCurrenciesListRes" */ export default async (req: ExtendedRequest, res) => { const currencyService: CurrencyService = req.scope.resolve("currencyService") diff --git a/packages/medusa/src/api/routes/admin/currencies/update-currency.ts b/packages/medusa/src/api/routes/admin/currencies/update-currency.ts index 871c466d95..4d16a78573 100644 --- a/packages/medusa/src/api/routes/admin/currencies/update-currency.ts +++ b/packages/medusa/src/api/routes/admin/currencies/update-currency.ts @@ -48,10 +48,7 @@ import TaxInclusivePricingFeatureFlag from "../../../../loaders/feature-flags/ta * content: * application/json: * schema: - * type: object - * properties: - * currency: - * $ref: "#/components/schemas/Currency" + * $ref: "#/components/schemas/AdminCurrenciesRes" */ export default async (req: ExtendedRequest, res) => { const code = req.params.code as string diff --git a/packages/medusa/src/api/routes/admin/customer-groups/add-customers-batch.ts b/packages/medusa/src/api/routes/admin/customer-groups/add-customers-batch.ts index afe7a951be..4b5152a214 100644 --- a/packages/medusa/src/api/routes/admin/customer-groups/add-customers-batch.ts +++ b/packages/medusa/src/api/routes/admin/customer-groups/add-customers-batch.ts @@ -61,10 +61,7 @@ import { validator } from "../../../../utils/validator" * content: * application/json: * schema: - * type: object - * properties: - * customer_group: - * $ref: "#/components/schemas/CustomerGroup" + * $ref: "#/components/schemas/AdminCustomerGroupsRes" * "400": * $ref: "#/components/responses/400_error" * "401": diff --git a/packages/medusa/src/api/routes/admin/customer-groups/create-customer-group.ts b/packages/medusa/src/api/routes/admin/customer-groups/create-customer-group.ts index 2f4c488d84..4653f50b94 100644 --- a/packages/medusa/src/api/routes/admin/customer-groups/create-customer-group.ts +++ b/packages/medusa/src/api/routes/admin/customer-groups/create-customer-group.ts @@ -47,10 +47,7 @@ import { validator } from "../../../../utils/validator" * content: * application/json: * schema: - * type: object - * properties: - * customer_group: - * $ref: "#/components/schemas/CustomerGroup" + * $ref: "#/components/schemas/AdminCustomerGroupsRes" * "400": * $ref: "#/components/responses/400_error" * "401": diff --git a/packages/medusa/src/api/routes/admin/customer-groups/delete-customer-group.ts b/packages/medusa/src/api/routes/admin/customer-groups/delete-customer-group.ts index 140a2724aa..8c166b8e3e 100644 --- a/packages/medusa/src/api/routes/admin/customer-groups/delete-customer-group.ts +++ b/packages/medusa/src/api/routes/admin/customer-groups/delete-customer-group.ts @@ -38,19 +38,7 @@ import { EntityManager } from "typeorm" * content: * application/json: * schema: - * type: object - * properties: - * id: - * type: string - * description: The ID of the deleted customer group. - * object: - * type: string - * description: The type of the object that was deleted. - * default: customer_group - * deleted: - * type: boolean - * description: Whether the customer group was deleted successfully or not. - * default: true + * $ref: "#/components/schemas/AdminCustomerGroupsDeleteRes" * "400": * $ref: "#/components/responses/400_error" * "401": diff --git a/packages/medusa/src/api/routes/admin/customer-groups/delete-customers-batch.ts b/packages/medusa/src/api/routes/admin/customer-groups/delete-customers-batch.ts index 1983ce568b..8d32efec43 100644 --- a/packages/medusa/src/api/routes/admin/customer-groups/delete-customers-batch.ts +++ b/packages/medusa/src/api/routes/admin/customer-groups/delete-customers-batch.ts @@ -61,10 +61,7 @@ import { validator } from "../../../../utils/validator" * content: * application/json: * schema: - * type: object - * properties: - * customer_group: - * $ref: "#/components/schemas/CustomerGroup" + * $ref: "#/components/schemas/AdminCustomerGroupsRes" * "400": * $ref: "#/components/responses/400_error" * "401": diff --git a/packages/medusa/src/api/routes/admin/customer-groups/get-customer-group-customers.ts b/packages/medusa/src/api/routes/admin/customer-groups/get-customer-group-customers.ts index f387093871..d76530e0e3 100644 --- a/packages/medusa/src/api/routes/admin/customer-groups/get-customer-group-customers.ts +++ b/packages/medusa/src/api/routes/admin/customer-groups/get-customer-group-customers.ts @@ -37,21 +37,7 @@ import CustomerController from "../../../../controllers/customers" * content: * application/json: * schema: - * type: object - * properties: - * customers: - * type: array - * items: - * $ref: "#/components/schemas/Customer" - * count: - * type: integer - * description: The total number of items available - * offset: - * type: integer - * description: The number of items skipped before these items - * limit: - * type: integer - * description: The number of items per page + * $ref: "#/components/schemas/AdminCustomersListRes" * "400": * $ref: "#/components/responses/400_error" * "401": diff --git a/packages/medusa/src/api/routes/admin/customer-groups/get-customer-group.ts b/packages/medusa/src/api/routes/admin/customer-groups/get-customer-group.ts index ba379a83e9..d82777cca4 100644 --- a/packages/medusa/src/api/routes/admin/customer-groups/get-customer-group.ts +++ b/packages/medusa/src/api/routes/admin/customer-groups/get-customer-group.ts @@ -40,10 +40,7 @@ import { FindParams } from "../../../../types/common" * content: * application/json: * schema: - * type: object - * properties: - * customer_group: - * $ref: "#/components/schemas/CustomerGroup" + * $ref: "#/components/schemas/AdminCustomerGroupsRes" * "400": * $ref: "#/components/responses/400_error" * "401": diff --git a/packages/medusa/src/api/routes/admin/customer-groups/index.ts b/packages/medusa/src/api/routes/admin/customer-groups/index.ts index a01bfd42b0..5c26a6e794 100644 --- a/packages/medusa/src/api/routes/admin/customer-groups/index.ts +++ b/packages/medusa/src/api/routes/admin/customer-groups/index.ts @@ -56,13 +56,53 @@ export default (app) => { /* ************************************** */ /* ******** EXPORT API CLIENT TYPES ***** */ /* ************************************** */ - +/** + * @schema AdminCustomerGroupsRes + * type: object + * properties: + * customer_group: + * $ref: "#/components/schemas/CustomerGroup" + */ export type AdminCustomerGroupsRes = { customer_group: CustomerGroup } +/** + * @schema AdminCustomerGroupsDeleteRes + * type: object + * properties: + * id: + * type: string + * description: The ID of the deleted customer group. + * object: + * type: string + * description: The type of the object that was deleted. + * default: customer_group + * deleted: + * type: boolean + * description: Whether the customer group was deleted successfully or not. + * default: true + */ export type AdminCustomerGroupsDeleteRes = DeleteResponse +/** + * @schema AdminCustomerGroupsListRes + * type: object + * properties: + * customer_groups: + * type: array + * items: + * $ref: "#/components/schemas/CustomerGroup" + * count: + * type: integer + * description: The total number of items available + * offset: + * type: integer + * description: The number of items skipped before these items + * limit: + * type: integer + * description: The number of items per page + */ export type AdminCustomerGroupsListRes = PaginatedResponse & { customer_groups: CustomerGroup[] } diff --git a/packages/medusa/src/api/routes/admin/customer-groups/list-customer-groups.ts b/packages/medusa/src/api/routes/admin/customer-groups/list-customer-groups.ts index f4693bd165..a40c41f3e7 100644 --- a/packages/medusa/src/api/routes/admin/customer-groups/list-customer-groups.ts +++ b/packages/medusa/src/api/routes/admin/customer-groups/list-customer-groups.ts @@ -127,21 +127,7 @@ import { Type } from "class-transformer" * content: * application/json: * schema: - * type: object - * properties: - * customer_groups: - * type: array - * items: - * $ref: "#/components/schemas/CustomerGroup" - * count: - * type: integer - * description: The total number of items available - * offset: - * type: integer - * description: The number of items skipped before these items - * limit: - * type: integer - * description: The number of items per page + * $ref: "#/components/schemas/AdminCustomerGroupsListRes" * "400": * $ref: "#/components/responses/400_error" * "401": diff --git a/packages/medusa/src/api/routes/admin/customer-groups/update-customer-group.ts b/packages/medusa/src/api/routes/admin/customer-groups/update-customer-group.ts index f7376c6235..474f78acfb 100644 --- a/packages/medusa/src/api/routes/admin/customer-groups/update-customer-group.ts +++ b/packages/medusa/src/api/routes/admin/customer-groups/update-customer-group.ts @@ -53,10 +53,7 @@ import { validator } from "../../../../utils/validator" * content: * application/json: * schema: - * type: object - * properties: - * customer_group: - * $ref: "#/components/schemas/CustomerGroup" + * $ref: "#/components/schemas/AdminCustomerGroupsRes" * "400": * $ref: "#/components/responses/400_error" * "401": diff --git a/packages/medusa/src/api/routes/admin/customers/create-customer.ts b/packages/medusa/src/api/routes/admin/customers/create-customer.ts index 3803c93554..d12155f385 100644 --- a/packages/medusa/src/api/routes/admin/customers/create-customer.ts +++ b/packages/medusa/src/api/routes/admin/customers/create-customer.ts @@ -54,10 +54,7 @@ import { EntityManager } from "typeorm" * content: * application/json: * schema: - * type: object - * properties: - * customer: - * $ref: "#/components/schemas/Customer" + * $ref: "#/components/schemas/AdminCustomersRes" * "400": * $ref: "#/components/responses/400_error" * "401": diff --git a/packages/medusa/src/api/routes/admin/customers/get-customer.ts b/packages/medusa/src/api/routes/admin/customers/get-customer.ts index 0f32df245e..80adc494b2 100644 --- a/packages/medusa/src/api/routes/admin/customers/get-customer.ts +++ b/packages/medusa/src/api/routes/admin/customers/get-customer.ts @@ -40,10 +40,7 @@ import { validator } from "../../../../utils/validator" * content: * application/json: * schema: - * type: object - * properties: - * customer: - * $ref: "#/components/schemas/Customer" + * $ref: "#/components/schemas/AdminCustomersRes" * "400": * $ref: "#/components/responses/400_error" * "401": diff --git a/packages/medusa/src/api/routes/admin/customers/index.ts b/packages/medusa/src/api/routes/admin/customers/index.ts index 955c40ccb5..92e41865e3 100644 --- a/packages/medusa/src/api/routes/admin/customers/index.ts +++ b/packages/medusa/src/api/routes/admin/customers/index.ts @@ -1,6 +1,6 @@ import { Router } from "express" import { Customer } from "../../../.." -import { DeleteResponse, PaginatedResponse } from "../../../../types/common" +import { PaginatedResponse } from "../../../../types/common" import middlewares from "../../../middlewares" const route = Router() @@ -20,12 +20,35 @@ export default (app) => { return app } +/** + * @schema AdminCustomersRes + * type: object + * properties: + * customer: + * $ref: "#/components/schemas/Customer" + */ export type AdminCustomersRes = { customer: Customer } -export type AdminCustomersDeleteRes = DeleteResponse - +/** + * @schema AdminCustomersListRes + * type: object + * properties: + * customers: + * type: array + * items: + * $ref: "#/components/schemas/Customer" + * count: + * type: integer + * description: The total number of items available + * offset: + * type: integer + * description: The number of items skipped before these items + * limit: + * type: integer + * description: The number of items per page + */ export type AdminCustomersListRes = PaginatedResponse & { customers: Customer[] } diff --git a/packages/medusa/src/api/routes/admin/customers/list-customers.ts b/packages/medusa/src/api/routes/admin/customers/list-customers.ts index bcc3438970..775b76189e 100644 --- a/packages/medusa/src/api/routes/admin/customers/list-customers.ts +++ b/packages/medusa/src/api/routes/admin/customers/list-customers.ts @@ -43,21 +43,7 @@ import customerController from "../../../../controllers/customers" * content: * application/json: * schema: - * type: object - * properties: - * customers: - * type: array - * items: - * $ref: "#/components/schemas/Customer" - * count: - * type: integer - * description: The total number of items available - * offset: - * type: integer - * description: The number of items skipped before these items - * limit: - * type: integer - * description: The number of items per page + * $ref: "#/components/schemas/AdminCustomersListRes" * "400": * $ref: "#/components/responses/400_error" * "401": diff --git a/packages/medusa/src/api/routes/admin/customers/update-customer.ts b/packages/medusa/src/api/routes/admin/customers/update-customer.ts index 0e8ec3c0fc..f57a56bbc4 100644 --- a/packages/medusa/src/api/routes/admin/customers/update-customer.ts +++ b/packages/medusa/src/api/routes/admin/customers/update-customer.ts @@ -63,10 +63,7 @@ import { validator } from "../../../../utils/validator" * content: * application/json: * schema: - * type: object - * properties: - * customer: - * $ref: "#/components/schemas/Customer" + * $ref: "#/components/schemas/AdminCustomersRes" * "400": * $ref: "#/components/responses/400_error" * "401":