feat: add missing schema for category update and deletion

Deleted CategoryObj component, since CategoryObject is used more
v1.18.x
Julian Lam 4 years ago
parent 7fc329de2f
commit d6de925348

@ -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'

@ -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
description: The number of topics in the category

@ -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:

@ -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}:

@ -54,4 +54,13 @@ post:
status:
$ref: ../components/schemas/Status.yaml#/Status
response:
$ref: ../components/schemas/CategoryObj.yaml#/CategoryObj
allOf:
- $ref: ../components/schemas/CategoryObject.yaml#/CategoryObject
- type: object
properties:
tagWhitelist:
type: array
items:
type: string
unread-class:
type: string

@ -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: {}

@ -33,6 +33,7 @@ post:
application/json:
schema:
type: object
properties: {}
additionalProperties: {}
responses:
'200':

Loading…
Cancel
Save