From 69fb15276c14b8455b1db64212ee4dca5e6d2164 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Wed, 29 Jul 2020 12:19:07 -0400 Subject: [PATCH] fix: tests --- public/openapi/read.yaml | 37 ++++++++++++++++++++++++++++- src/controllers/admin/categories.js | 2 +- src/socket.io/admin/categories.js | 2 +- 3 files changed, 38 insertions(+), 3 deletions(-) diff --git a/public/openapi/read.yaml b/public/openapi/read.yaml index 33708891a9f4..4a795a05396e 100644 --- a/public/openapi/read.yaml +++ b/public/openapi/read.yaml @@ -634,7 +634,42 @@ paths: content: application/json: schema: - $ref: components/schemas/CommonProps.yaml#/CommonProps + allOf: + - type : object + properties: + categories: + type: array + items: + type: object + properties: + cid: + type: number + description: A category identifier + name: + type: string + disabled: + type: number + icon: + type: string + link: + type: string + parentCid: + type: number + description: The category identifier for the category that is the immediate + ancestor of the current category + color: + type: string + bgColor: + type: string + backgroundImage: + type: string + nullable: true + imageClass: + type: string + children: + type: array + description: Array of children categories + - $ref: components/schemas/CommonProps.yaml#/CommonProps "/api/admin/manage/categories/{category_id}": get: tags: diff --git a/src/controllers/admin/categories.js b/src/controllers/admin/categories.js index bbe2104c8ab4..f6b6ab7fae93 100644 --- a/src/controllers/admin/categories.js +++ b/src/controllers/admin/categories.js @@ -47,7 +47,7 @@ categoriesController.getAll = async function (req, res) { // Categories list will be rendered on client side with recursion, etc. const cids = await categories.getAllCidsFromSet('categories:cid'); const fields = [ - 'cid', 'name', 'level', 'icon', 'parentCid', 'disabled', 'link', + 'cid', 'name', 'icon', 'parentCid', 'disabled', 'link', 'color', 'bgColor', 'backgroundImage', 'imageClass', ]; const categoriesData = await categories.getCategoriesFields(cids, fields); diff --git a/src/socket.io/admin/categories.js b/src/socket.io/admin/categories.js index 7c621c9fa92e..483a82c956c3 100644 --- a/src/socket.io/admin/categories.js +++ b/src/socket.io/admin/categories.js @@ -23,7 +23,7 @@ Categories.getAll = async function () { winston.warn('[deprecated] admin.categories.getAll deprecated, data is returned in the api route'); const cids = await categories.getAllCidsFromSet('categories:cid'); const fields = [ - 'cid', 'name', 'level', 'icon', 'parentCid', 'disabled', 'link', + 'cid', 'name', 'icon', 'parentCid', 'disabled', 'link', 'color', 'bgColor', 'backgroundImage', 'imageClass', ]; const categoriesData = await categories.getCategoriesFields(cids, fields);