mirror of
https://github.com/KevinMidboe/planetposen.git
synced 2025-10-29 17:50:32 +00:00
Api endpoints for fetching shema for product and variation.
This commit is contained in:
@@ -46,8 +46,14 @@ const addNewProduct = (req, res) => {
|
||||
.then(resp => res.send(resp))
|
||||
}
|
||||
|
||||
const getProductSchema = (req, res) => {
|
||||
return products.productSchema()
|
||||
.then(schema => res.json(schema))
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
allProducts,
|
||||
productBySlug,
|
||||
addNewProduct
|
||||
addNewProduct,
|
||||
getProductSchema
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const { saveNewVariation } = require('src/variation.js')
|
||||
const { saveNewVariation, variationSchema } = require('src/variation.js')
|
||||
const Products = require('src/products');
|
||||
const products = new Products();
|
||||
|
||||
@@ -35,6 +35,13 @@ const addNewVariationToProduct = async (req, res) => {
|
||||
.catch(err => handleError(err, res))
|
||||
}
|
||||
|
||||
|
||||
const getVariationSchema = (req, res) => {
|
||||
return variationSchema()
|
||||
.then(schema => res.json(schema))
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
addNewVariationToProduct
|
||||
addNewVariationToProduct,
|
||||
getVariationSchema
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user