mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-06 12:31:33 +01:00
Flags API (#9666)
* feat: new routes for flags API + flag get + flag creation, migration from socket method + flag update, migration from socket method * fixed bug where you could not unassign someone from a flag * feat: tests for new flags API added missing files for schema update * fix: flag tests to use Write API instead of sockets * feat: flag notes API + tests * chore: remove debug line * test: fix breaking test on mongo
This commit is contained in:
67
public/openapi/write/flags/flagId.yaml
Normal file
67
public/openapi/write/flags/flagId.yaml
Normal file
@@ -0,0 +1,67 @@
|
||||
get:
|
||||
tags:
|
||||
- flags
|
||||
summary: get a flag
|
||||
description: This operation retrieve a flag's details. It is only available to privileged users (that is, moderators, global moderators, and administrators).
|
||||
parameters:
|
||||
- in: path
|
||||
name: flagId
|
||||
schema:
|
||||
type: number
|
||||
required: true
|
||||
description: a valid flag id
|
||||
example: 1
|
||||
responses:
|
||||
'200':
|
||||
description: flag successfully retrieved
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
status:
|
||||
$ref: ../../components/schemas/Status.yaml#/Status
|
||||
response:
|
||||
$ref: ../../components/schemas/FlagObject.yaml#/FlagObject
|
||||
put:
|
||||
tags:
|
||||
- flags
|
||||
summary: update a flag
|
||||
description: This operation updates a flag's details. It is only available to privileged users (that is, moderators, global moderators, and administrators).
|
||||
parameters:
|
||||
- in: path
|
||||
name: flagId
|
||||
schema:
|
||||
type: number
|
||||
required: true
|
||||
description: a valid flag id
|
||||
example: 1
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
datetime:
|
||||
type: number
|
||||
example: 1625859990035
|
||||
state:
|
||||
type: string
|
||||
enum: ['open', 'wip', 'resolved', 'rejected']
|
||||
example: 'wip'
|
||||
assignee:
|
||||
type: number
|
||||
example: 1
|
||||
responses:
|
||||
'200':
|
||||
description: flag successfully updated
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
status:
|
||||
$ref: ../../components/schemas/Status.yaml#/Status
|
||||
response:
|
||||
$ref: ../../components/schemas/FlagObject.yaml#/FlagHistoryObject
|
||||
42
public/openapi/write/flags/flagId/notes.yaml
Normal file
42
public/openapi/write/flags/flagId/notes.yaml
Normal file
@@ -0,0 +1,42 @@
|
||||
post:
|
||||
tags:
|
||||
- flags
|
||||
summary: append a flag note
|
||||
description: This operation append a shared note for a given flag. It is only available to privileged users (that is, moderators, global moderators, and administrators).
|
||||
parameters:
|
||||
- in: path
|
||||
name: flagId
|
||||
schema:
|
||||
type: number
|
||||
required: true
|
||||
description: a valid flag id
|
||||
example: 1
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
note:
|
||||
type: string
|
||||
example: 'test note'
|
||||
datetime:
|
||||
type: number
|
||||
example: 1626446956652
|
||||
required:
|
||||
- note
|
||||
responses:
|
||||
'200':
|
||||
description: flag note successfully added or updated
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
status:
|
||||
$ref: ../../../components/schemas/Status.yaml#/Status
|
||||
response:
|
||||
allOf:
|
||||
- $ref: ../../../components/schemas/FlagObject.yaml#/FlagNotesObject
|
||||
- $ref: ../../../components/schemas/FlagObject.yaml#/FlagHistoryObject
|
||||
34
public/openapi/write/flags/flagId/notes/datetime.yaml
Normal file
34
public/openapi/write/flags/flagId/notes/datetime.yaml
Normal file
@@ -0,0 +1,34 @@
|
||||
delete:
|
||||
tags:
|
||||
- flags
|
||||
summary: delete a flag note
|
||||
description: This operation deletes a shared note for a given flag. It is only available to privileged users (that is, moderators, global moderators, and administrators).
|
||||
parameters:
|
||||
- in: path
|
||||
name: flagId
|
||||
schema:
|
||||
type: number
|
||||
required: true
|
||||
description: a valid flag id
|
||||
example: 1
|
||||
- in: path
|
||||
name: datetime
|
||||
schema:
|
||||
type: number
|
||||
required: true
|
||||
description: A valid UNIX timestamp
|
||||
example: 1626446956652
|
||||
responses:
|
||||
'200':
|
||||
description: Flag note deleted
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
status:
|
||||
$ref: ../../../../components/schemas/Status.yaml#/Status
|
||||
response:
|
||||
allOf:
|
||||
- $ref: ../../../../components/schemas/FlagObject.yaml#/FlagNotesObject
|
||||
- $ref: ../../../../components/schemas/FlagObject.yaml#/FlagHistoryObject
|
||||
Reference in New Issue
Block a user