450 lines
9.6 KiB
YAML
450 lines
9.6 KiB
YAML
components:
|
|
responses:
|
|
errorResponse:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
properties:
|
|
code:
|
|
type: integer
|
|
message:
|
|
type: string
|
|
required:
|
|
- code
|
|
- message
|
|
type: object
|
|
description: ""
|
|
filesListResponse:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
items:
|
|
$ref: '#/components/schemas/fileItem'
|
|
type: array
|
|
description: ""
|
|
gameAdminResponse:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/gameEdit'
|
|
description: ""
|
|
gameListResponse:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
items:
|
|
$ref: '#/components/schemas/gameView'
|
|
type: array
|
|
description: ""
|
|
gameResponse:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/gameView'
|
|
description: ""
|
|
taskResponse:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/taskView'
|
|
description: ""
|
|
uploadResponse:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
properties:
|
|
uuid:
|
|
format: uuid
|
|
type: string
|
|
required:
|
|
- uuid
|
|
type: object
|
|
description: ""
|
|
userResponse:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/userView'
|
|
description: ""
|
|
schemas:
|
|
codeEdit:
|
|
properties:
|
|
code:
|
|
type: string
|
|
description:
|
|
type: string
|
|
id:
|
|
format: uuid
|
|
type: string
|
|
required:
|
|
- code
|
|
type: object
|
|
codeView:
|
|
properties:
|
|
code:
|
|
type: string
|
|
description:
|
|
type: string
|
|
type: object
|
|
fileItem:
|
|
properties:
|
|
id:
|
|
format: uuid
|
|
type: string
|
|
originalName:
|
|
type: string
|
|
size:
|
|
type: integer
|
|
required:
|
|
- id
|
|
- originalName
|
|
- size
|
|
type: object
|
|
gameEdit:
|
|
properties:
|
|
description:
|
|
type: string
|
|
icon:
|
|
format: uuid
|
|
type: string
|
|
id:
|
|
format: uuid
|
|
type: string
|
|
points:
|
|
type: integer
|
|
tasks:
|
|
items:
|
|
$ref: '#/components/schemas/taskEdit'
|
|
type: array
|
|
title:
|
|
type: string
|
|
type:
|
|
$ref: '#/components/schemas/gameType'
|
|
visible:
|
|
type: boolean
|
|
required:
|
|
- visible
|
|
- title
|
|
- description
|
|
- type
|
|
- tasks
|
|
- points
|
|
type: object
|
|
gameType:
|
|
enum:
|
|
- virtual
|
|
- city
|
|
type: string
|
|
gameView:
|
|
properties:
|
|
authors:
|
|
items:
|
|
$ref: '#/components/schemas/userView'
|
|
type: array
|
|
createdAt:
|
|
type: string
|
|
description:
|
|
type: string
|
|
icon:
|
|
format: uuid
|
|
type: string
|
|
id:
|
|
format: uuid
|
|
type: string
|
|
points:
|
|
type: integer
|
|
taskCount:
|
|
type: integer
|
|
title:
|
|
type: string
|
|
type:
|
|
$ref: '#/components/schemas/gameType'
|
|
visible:
|
|
type: boolean
|
|
required:
|
|
- id
|
|
- title
|
|
- description
|
|
- type
|
|
- points
|
|
- taskCount
|
|
- createdAt
|
|
- authors
|
|
type: object
|
|
taskEdit:
|
|
properties:
|
|
codes:
|
|
items:
|
|
$ref: '#/components/schemas/codeEdit'
|
|
type: array
|
|
id:
|
|
format: uuid
|
|
type: string
|
|
text:
|
|
type: string
|
|
title:
|
|
type: string
|
|
required:
|
|
- id
|
|
- title
|
|
- text
|
|
- codes
|
|
type: object
|
|
taskView:
|
|
properties:
|
|
codes:
|
|
items:
|
|
$ref: '#/components/schemas/codeView'
|
|
type: array
|
|
message:
|
|
enum:
|
|
- ok_code
|
|
- invalid_code
|
|
- old_code
|
|
- next_level
|
|
- game_complete
|
|
type: string
|
|
text:
|
|
type: string
|
|
title:
|
|
type: string
|
|
required:
|
|
- title
|
|
- text
|
|
- codes
|
|
type: object
|
|
userView:
|
|
properties:
|
|
email:
|
|
type: string
|
|
expToCurrentLevel:
|
|
type: integer
|
|
expToNextLevel:
|
|
type: integer
|
|
experience:
|
|
type: integer
|
|
games:
|
|
items:
|
|
$ref: '#/components/schemas/gameView'
|
|
type: array
|
|
id:
|
|
format: uuid
|
|
type: string
|
|
level:
|
|
type: integer
|
|
role:
|
|
enum:
|
|
- user
|
|
- creator
|
|
- admin
|
|
type: string
|
|
username:
|
|
type: string
|
|
required:
|
|
- id
|
|
- username
|
|
- email
|
|
- experience
|
|
- level
|
|
- expToCurrentLevel
|
|
- expToNextLevel
|
|
- games
|
|
- role
|
|
type: object
|
|
securitySchemes:
|
|
cookieAuth:
|
|
in: cookie
|
|
name: session
|
|
type: apiKey
|
|
info:
|
|
title: nQuest
|
|
version: 1.0.0
|
|
openapi: 3.1.0
|
|
paths:
|
|
/admin/file/{quest}:
|
|
get:
|
|
operationId: adminListFiles
|
|
parameters:
|
|
- in: path
|
|
name: quest
|
|
required: true
|
|
schema:
|
|
format: uuid
|
|
type: string
|
|
responses:
|
|
200:
|
|
$ref: '#/components/responses/filesListResponse'
|
|
security:
|
|
- cookieAuth:
|
|
- creator
|
|
- admin
|
|
/admin/file/{quest}/upload:
|
|
post:
|
|
operationId: adminUploadFile
|
|
parameters:
|
|
- in: path
|
|
name: quest
|
|
required: true
|
|
schema:
|
|
format: uuid
|
|
type: string
|
|
requestBody:
|
|
content:
|
|
multipart/form-data:
|
|
properties:
|
|
file:
|
|
format: binary
|
|
type: string
|
|
schema: null
|
|
type: object
|
|
responses:
|
|
200:
|
|
$ref: '#/components/responses/uploadResponse'
|
|
security:
|
|
- cookieAuth:
|
|
- creator
|
|
- admin
|
|
/admin/games:
|
|
get:
|
|
operationId: adminListGames
|
|
responses:
|
|
200:
|
|
$ref: '#/components/responses/gameListResponse'
|
|
post:
|
|
operationId: adminEditGame
|
|
requestBody:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/gameEdit'
|
|
responses:
|
|
200:
|
|
$ref: '#/components/responses/gameAdminResponse'
|
|
security:
|
|
- cookieAuth:
|
|
- creator
|
|
- admin
|
|
/admin/games/{uid}:
|
|
get:
|
|
operationId: adminGetGame
|
|
parameters:
|
|
- in: path
|
|
name: uid
|
|
required: true
|
|
schema:
|
|
format: uuid
|
|
type: string
|
|
responses:
|
|
200:
|
|
$ref: '#/components/responses/gameAdminResponse'
|
|
security:
|
|
- cookieAuth:
|
|
- creator
|
|
- admin
|
|
/engine/{uid}:
|
|
get:
|
|
operationId: gameEngine
|
|
parameters:
|
|
- in: path
|
|
name: uid
|
|
required: true
|
|
schema:
|
|
format: uuid
|
|
type: string
|
|
responses:
|
|
200:
|
|
$ref: '#/components/responses/taskResponse'
|
|
/engine/{uid}/code:
|
|
post:
|
|
operationId: enterCode
|
|
parameters:
|
|
- in: path
|
|
name: uid
|
|
required: true
|
|
schema:
|
|
format: uuid
|
|
type: string
|
|
requestBody:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
properties:
|
|
code:
|
|
type: string
|
|
required:
|
|
- code
|
|
type: object
|
|
responses:
|
|
200:
|
|
$ref: '#/components/responses/taskResponse'
|
|
/games:
|
|
get:
|
|
responses:
|
|
200:
|
|
$ref: '#/components/responses/gameListResponse'
|
|
/user:
|
|
get:
|
|
responses:
|
|
200:
|
|
$ref: '#/components/responses/userResponse'
|
|
403:
|
|
$ref: '#/components/responses/errorResponse'
|
|
/user/login:
|
|
post:
|
|
requestBody:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
properties:
|
|
email:
|
|
type: string
|
|
password:
|
|
type: string
|
|
required:
|
|
- email
|
|
- password
|
|
type: object
|
|
responses:
|
|
200:
|
|
$ref: '#/components/responses/userResponse'
|
|
400:
|
|
$ref: '#/components/responses/errorResponse'
|
|
security: []
|
|
/user/logout:
|
|
post:
|
|
responses:
|
|
204:
|
|
description: success logout
|
|
400:
|
|
$ref: '#/components/responses/errorResponse'
|
|
/user/register:
|
|
post:
|
|
requestBody:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
properties:
|
|
email:
|
|
type: string
|
|
password:
|
|
type: string
|
|
password2:
|
|
type: string
|
|
username:
|
|
type: string
|
|
required:
|
|
- username
|
|
- email
|
|
- password
|
|
- password2
|
|
type: object
|
|
responses:
|
|
200:
|
|
$ref: '#/components/responses/userResponse'
|
|
400:
|
|
$ref: '#/components/responses/errorResponse'
|
|
security: []
|
|
security:
|
|
- cookieAuth: []
|
|
servers:
|
|
- url: /api
|