Skip to content

Node.js based forum software built for the modern web

feat: add missing schema for category update and deletion

Julian Lamd6de925348e2
diff --git a/public/openapi/components/schemas/CategoryObj.yaml b/public/openapi/components/schemas/CategoryObj.yaml
deleted file mode 100644
index 7c3ac6a83f..0000000000
--- a/public/openapi/components/schemas/CategoryObj.yaml
+++ /dev/null
@@ -1,72 +0,0 @@
-CategoryObj:
- properties:
- cid:
- type: number
- example: 1
- name:
- type: string
- example: My New Category
- description:
- type: string
- example: Lorem ipsum, dolor sit amet
- descriptionParsed:
- type: string
- example: Lorem ipsum, dolor sit amet
- icon:
- type: string
- example: bullhorn
- bgColor:
- type: string
- example: '#ffffff'
- color:
- type: string
- example: '#000000'
- slug:
- type: string
- example: 1/my-new-category
- parentCid:
- type: number
- example: 0
- topic_count:
- type: number
- example: 0
- post_count:
- type: number
- example: 0
- disabled:
- type: number
- example: 0
- order:
- type: number
- example: 5
- link:
- type: number
- example: 'https://example.org'
- numRecentReplies:
- type: number
- example: 1
- class:
- type: string
- example: col-md-3 col-xs-6
- imageClass:
- type: string
- example: cover
- isSection:
- type: number
- example: 0
- totalPostCount:
- type: number
- example: 0
- totalTopicCount:
- type: number
- example: 0
- tagWhitelist:
- type: array
- example:
- - some-tag
- - another-tag
- unread-class:
- type: string
- backgroundImage:
- type: string
- example: '/assets/images/covers/Circuit1.png'
\ No newline at end of file
diff --git a/public/openapi/components/schemas/CategoryObject.yaml b/public/openapi/components/schemas/CategoryObject.yaml
index c19a5f192c..bbeca1cf9f 100644
--- a/public/openapi/components/schemas/CategoryObject.yaml
+++ b/public/openapi/components/schemas/CategoryObject.yaml
@@ -57,6 +57,12 @@ CategoryObject:
description: The `background-position` of the category background image, if one is set
isSection:
type: number
+ minTags:
+ type: number
+ description: Minimum tags per topic in this category
+ maxTags:
+ type: number
+ description: Maximum tags per topic in this category
postQueue:
type: number
totalPostCount:
@@ -64,10 +70,4 @@ CategoryObject:
description: The number of posts in the category
totalTopicCount:
type: number
- description: The number of topics in the category
- minTags:
- type: number
- description: Minimum tags per topic in this category
- maxTags:
- type: number
- description: Maximum tags per topic in this category
\ No newline at end of file
+ description: The number of topics in the category
\ No newline at end of file
diff --git a/public/openapi/read/categories.yaml b/public/openapi/read/categories.yaml
index 723501a410..36f7b3b797 100644
--- a/public/openapi/read/categories.yaml
+++ b/public/openapi/read/categories.yaml
@@ -13,7 +13,7 @@ get:
Subcategories are also returned, nested under a category's `children` property.
responses:
"200":
- description: A list of category objectscurrently available to the accessing user
+ description: A list of category objects currently available to the accessing user
content:
application/json:
schema:
diff --git a/public/openapi/write.yaml b/public/openapi/write.yaml
index bb113bf7ef..2405718f33 100644
--- a/public/openapi/write.yaml
+++ b/public/openapi/write.yaml
@@ -70,6 +70,8 @@ paths:
$ref: 'write/users/uid/invites/groups.yaml'
/categories/:
$ref: 'write/categories.yaml'
+ /categories/{cid}:
+ $ref: 'write/categories/cid.yaml'
/groups/:
$ref: 'write/groups.yaml'
/groups/{slug}:
diff --git a/public/openapi/write/categories.yaml b/public/openapi/write/categories.yaml
index dc90d8f41f..5c26b53633 100644
--- a/public/openapi/write/categories.yaml
+++ b/public/openapi/write/categories.yaml
@@ -54,4 +54,13 @@ post:
status:
$ref: ../components/schemas/Status.yaml#/Status
response:
- $ref: ../components/schemas/CategoryObj.yaml#/CategoryObj
\ No newline at end of file
+ allOf:
+ - $ref: ../components/schemas/CategoryObject.yaml#/CategoryObject
+ - type: object
+ properties:
+ tagWhitelist:
+ type: array
+ items:
+ type: string
+ unread-class:
+ type: string
\ No newline at end of file
diff --git a/public/openapi/write/categories/cid.yaml b/public/openapi/write/categories/cid.yaml
new file mode 100644
index 0000000000..a719178060
--- /dev/null
+++ b/public/openapi/write/categories/cid.yaml
@@ -0,0 +1,68 @@
+put:
+ tags:
+ - topics
+ summary: update a category
+ description: This operation updates an existing category.
+ parameters:
+ - in: path
+ name: cid
+ schema:
+ type: number
+ required: true
+ description: a valid category id
+ example: 1
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ type: object
+ properties: {}
+ additionalProperties: {}
+ responses:
+ '200':
+ description: category successfully updated
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ status:
+ $ref: ../../components/schemas/Status.yaml#/Status
+ response:
+ allOf:
+ - $ref: ../../components/schemas/CategoryObject.yaml#/CategoryObject
+ - type: object
+ properties:
+ tagWhitelist:
+ type: array
+ items:
+ type: string
+ unread-class:
+ type: string
+delete:
+ tags:
+ - topics
+ summary: delete a category
+ description: This operation deletes and purges a category and all of its topics and posts (careful, there is no confirmation!)
+ parameters:
+ - in: path
+ name: cid
+ schema:
+ type: number
+ required: true
+ description: a valid category id
+ example: 1
+ responses:
+ '200':
+ description: Category successfully deleted
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ status:
+ $ref: ../../components/schemas/Status.yaml#/Status
+ response:
+ type: object
+ properties: {}
\ No newline at end of file
diff --git a/public/openapi/write/ping.yaml b/public/openapi/write/ping.yaml
index 8e2b0c7540..67d3dd62ba 100644
--- a/public/openapi/write/ping.yaml
+++ b/public/openapi/write/ping.yaml
@@ -33,6 +33,7 @@ post:
application/json:
schema:
type: object
+ properties: {}
additionalProperties: {}
responses:
'200':