Node.js based forum software built for the modern web
docs: openapi schema fixes for auto-categorization commits
Julian Lamc0248ca52b93
diff --git a/public/openapi/components/schemas/admin/rulesObject.yaml b/public/openapi/components/schemas/admin/rulesObject.yamlnew file mode 100644index 0000000000..6b8db905ff--- /dev/null+++ b/public/openapi/components/schemas/admin/rulesObject.yaml@@ -0,0 +1,21 @@+RulesObject:+ type: array+ items:+ type: object+ properties:+ rid:+ type: string+ description: a valid rule ID+ example: 4eb506f8-a173-4693-a41b-e23604bc973a+ type:+ type: string+ description: The auto-categorization rule type+ example: hashtag+ value:+ type: string+ description: The value that incoming content will be matched against (used alongside `type`)+ example: 'example'+ cid:+ type: number+ description: The category ID of a local category+ example: 1\ No newline at end of filediff --git a/public/openapi/read/admin/manage/categories.yaml b/public/openapi/read/admin/manage/categories.yamlindex b4e6102ac1..bbf8efb8fe 100644--- a/public/openapi/read/admin/manage/categories.yaml+++ b/public/openapi/read/admin/manage/categories.yaml@@ -48,6 +48,8 @@ get:type: stringorder:type: number+ isLocal:+ type: booleansubCategoriesPerPage:type: numberchildren:diff --git a/public/openapi/read/admin/settings/activitypub.yaml b/public/openapi/read/admin/settings/activitypub.yamlindex b0871999b6..892c56030f 100644--- a/public/openapi/read/admin/settings/activitypub.yaml+++ b/public/openapi/read/admin/settings/activitypub.yaml@@ -16,4 +16,25 @@ get:instanceCount:type: numberdescription: The number of ActivityPub-enabled instances that this forum knows about.+ rules:+ type: array+ items:+ type: object+ properties:+ rid:+ type: string+ description: a valid rule ID+ example: 4eb506f8-a173-4693-a41b-e23604bc973a+ type:+ type: string+ description: The auto-categorization rule type+ example: hashtag+ value:+ type: string+ description: The value that incoming content will be matched against (used alongside `type`)+ example: 'example'+ cid:+ type: number+ description: The category ID of a local category+ example: 1- $ref: ../../../components/schemas/CommonProps.yaml#/CommonProps\ No newline at end of filediff --git a/public/openapi/write/admin/activitypub/rules.yaml b/public/openapi/write/admin/activitypub/rules.yamlnew file mode 100644index 0000000000..46473530a8--- /dev/null+++ b/public/openapi/write/admin/activitypub/rules.yaml@@ -0,0 +1,36 @@+post:+ tags:+ - admin+ summary: create auto-categorization rule+ description: This operation creates a new auto-categorization rule that is applied to new remote content received via ActivityPub.+ requestBody:+ required: true+ content:+ application/json:+ schema:+ type: object+ properties:+ type:+ type: string+ description: The auto-categorization rule type+ example: hashtag+ value:+ type: string+ description: The value that incoming content will be matched against (used alongside `type`)+ example: 'example'+ cid:+ type: number+ description: The category ID of a local category+ example: 1+ responses:+ '200':+ description: rule successfully created+ content:+ application/json:+ schema:+ type: object+ properties:+ status:+ $ref: ../../components/schemas/Status.yaml#/Status+ response:+ $ref: ../../components/schemas/admin/rulesObject.yaml#/RulesObjectdiff --git a/public/openapi/write/admin/activitypub/rules/rid.yaml b/public/openapi/write/admin/activitypub/rules/rid.yamlnew file mode 100644index 0000000000..72f71149da--- /dev/null+++ b/public/openapi/write/admin/activitypub/rules/rid.yaml@@ -0,0 +1,25 @@+delete:+ tags:+ - admin+ summary: delete auto-categorization rule+ description: This operation deletes a previously set-up auto-categorization rule+ parameters:+ - in: path+ name: rid+ schema:+ type: string+ required: true+ description: a valid rule ID+ example: 4eb506f8-a173-4693-a41b-e23604bc973a+ responses:+ '200':+ description: rule successfully deleted+ content:+ application/json:+ schema:+ type: object+ properties:+ status:+ $ref: ../../../components/schemas/Status.yaml#/Status+ response:+ $ref: ../../components/schemas/admin/rulesObject.yaml#/RulesObjectdiff --git a/src/controllers/admin/categories.js b/src/controllers/admin/categories.jsindex 95d8376882..e6bb7aaa41 100644--- a/src/controllers/admin/categories.js+++ b/src/controllers/admin/categories.js@@ -72,7 +72,6 @@ categoriesController.getAll = async function (req, res) {let categoriesData = await categories.getCategoriesFields(cids, fields);({ categories: categoriesData } = await plugins.hooks.fire('filter:admin.categories.get', { categories: categoriesData, fields: fields }));- // Append remote categoriescategoriesData = categoriesData.map((category) => {category.isLocal = utils.isNumber(category.cid);return category;