diff --git a/api/categories.js b/api/categories.js index fc10d85..52e6b74 100644 --- a/api/categories.js +++ b/api/categories.js @@ -10,6 +10,12 @@ router.get('/', async (req, res) => { res.json(categories) }) +router.get('/by-slug/:slug', async (req, res) => { + const category = await db.category.findBySlug(req.params.slug) + + res.json(category) +}) + const newCategoryValidators = [ validate.validUrlSlug('urlslug'), validate.requiredString('name'), @@ -35,3 +41,8 @@ router.delete('/:category_uuid/items/:item_uuid', async (req, res) => { const category = await db.category.removeItem(req.params.category_uuid, req.params.item_uuid); res.json(category) }) + +router.put('/:parent_uuid/children/:child_uuid', async (req, res) => { + const category = await db.category.addCategory(req.params.parent_uuid, req.params.child_uuid); + res.json(category) +}) diff --git a/components/card/card.js b/components/card/card.js index 6a6bfc9..db40cd3 100644 --- a/components/card/card.js +++ b/components/card/card.js @@ -10,9 +10,11 @@ export default function Card({item, numberInCart}) { return (

{item.name}

-
- {featuredImage && } -
+ {featuredImage && ( +
+ +
+ )}
{item.description}