Files
medusa-store/packages/medusa/src/api/routes/admin/collections/get-collection.js
T
Sebastian Rindom 8edb32c742 docs: oas (#197)
Adds OpenAPI specification of Storefront and Admin APIs.
Updates docs project.
2021-03-10 11:51:54 +01:00

34 lines
816 B
JavaScript

/**
* @oas [get] /collections/{id}
* operationId: "GetCollectionsCollection"
* summary: "Retrieve a Product Collection"
* description: "Retrieves a Product Collection."
* parameters:
* - (path) id=* {string} The id of the Product Collection
* tags:
* - Collection
* responses:
* "200":
* description: OK
* content:
* application/json:
* schema:
* properties:
* collection:
* $ref: "#/components/schemas/product_collection"
*/
export default async (req, res) => {
const { id } = req.params
try {
const productCollectionService = req.scope.resolve(
"productCollectionService"
)
const collection = await productCollectionService.retrieve(id)
res.status(200).json({ collection })
} catch (err) {
throw err
}
}