2023-11-01 23:21:12 +03:00
|
|
|
openapi: "3.1.0"
|
2023-11-12 23:22:58 +03:00
|
|
|
|
2023-11-01 23:21:12 +03:00
|
|
|
info:
|
|
|
|
version: 1.0.0
|
|
|
|
title: nQuest
|
2023-11-12 23:22:58 +03:00
|
|
|
|
2023-11-01 23:21:12 +03:00
|
|
|
servers:
|
|
|
|
- url: /api
|
2023-11-12 23:22:58 +03:00
|
|
|
|
2023-11-01 23:21:12 +03:00
|
|
|
paths:
|
|
|
|
# User routes
|
|
|
|
/user:
|
|
|
|
get:
|
|
|
|
responses:
|
|
|
|
200:
|
|
|
|
$ref: '#/components/responses/userResponse'
|
|
|
|
403:
|
|
|
|
$ref: '#/components/responses/errorResponse'
|
|
|
|
/user/login:
|
|
|
|
post:
|
|
|
|
security: []
|
|
|
|
requestBody:
|
|
|
|
$ref: '#/components/requestBodies/login'
|
|
|
|
responses:
|
|
|
|
200:
|
|
|
|
$ref: '#/components/responses/userResponse'
|
|
|
|
400:
|
|
|
|
$ref: '#/components/responses/errorResponse'
|
|
|
|
/user/register:
|
|
|
|
post:
|
|
|
|
security: []
|
|
|
|
requestBody:
|
|
|
|
$ref: '#/components/requestBodies/register'
|
|
|
|
responses:
|
|
|
|
200:
|
|
|
|
$ref: '#/components/responses/userResponse'
|
|
|
|
400:
|
|
|
|
$ref: '#/components/responses/errorResponse'
|
|
|
|
/user/logout:
|
|
|
|
post:
|
|
|
|
security: []
|
|
|
|
responses:
|
|
|
|
204:
|
|
|
|
description: "success logout"
|
|
|
|
400:
|
|
|
|
$ref: '#/components/responses/errorResponse'
|
2024-01-05 03:50:33 +03:00
|
|
|
|
|
|
|
# Game routes
|
|
|
|
/games:
|
2023-11-01 23:21:12 +03:00
|
|
|
get:
|
2024-01-05 03:50:33 +03:00
|
|
|
security: []
|
2023-11-01 23:21:12 +03:00
|
|
|
responses:
|
|
|
|
200:
|
2024-01-05 03:50:33 +03:00
|
|
|
$ref: '#/components/responses/gameListResponse'
|
2023-11-02 23:38:50 +03:00
|
|
|
post:
|
2024-01-05 03:50:33 +03:00
|
|
|
operationId: createGame
|
|
|
|
security:
|
|
|
|
- cookieAuth: [creator, admin]
|
2023-11-02 23:38:50 +03:00
|
|
|
requestBody:
|
2024-01-05 03:50:33 +03:00
|
|
|
$ref: "#/components/requestBodies/gameEditRequest"
|
2023-11-02 23:38:50 +03:00
|
|
|
responses:
|
|
|
|
200:
|
2024-01-05 03:50:33 +03:00
|
|
|
$ref: "#/components/responses/gameResponse"
|
|
|
|
/engine/{uid}:
|
2023-11-01 23:21:12 +03:00
|
|
|
get:
|
2024-01-05 03:50:33 +03:00
|
|
|
operationId: gameEngine
|
2023-11-01 23:21:12 +03:00
|
|
|
parameters:
|
2024-01-05 03:50:33 +03:00
|
|
|
- name: uid
|
|
|
|
in: path
|
2023-11-01 23:21:12 +03:00
|
|
|
required: true
|
|
|
|
schema:
|
2024-01-06 08:44:26 +03:00
|
|
|
type: string
|
|
|
|
format: uuid
|
2023-11-12 23:22:58 +03:00
|
|
|
responses:
|
|
|
|
200:
|
2024-01-05 03:50:33 +03:00
|
|
|
$ref: '#/components/responses/taskResponse'
|
|
|
|
/engine/{uid}/code:
|
2023-11-12 23:22:58 +03:00
|
|
|
post:
|
2024-01-05 03:50:33 +03:00
|
|
|
operationId: enterCode
|
2023-11-12 23:22:58 +03:00
|
|
|
parameters:
|
2024-01-05 03:50:33 +03:00
|
|
|
- name: uid
|
|
|
|
in: path
|
2023-11-12 23:22:58 +03:00
|
|
|
required: true
|
|
|
|
schema:
|
2024-01-06 08:44:26 +03:00
|
|
|
type: string
|
|
|
|
format: uuid
|
2023-11-01 23:21:12 +03:00
|
|
|
requestBody:
|
2024-01-05 03:50:33 +03:00
|
|
|
$ref: "#/components/requestBodies/enterCodeRequest"
|
2023-11-12 23:22:58 +03:00
|
|
|
responses:
|
|
|
|
200:
|
2024-01-05 03:50:33 +03:00
|
|
|
$ref: '#/components/responses/taskResponse'
|
2024-01-20 21:37:49 +03:00
|
|
|
/file/upload:
|
|
|
|
post:
|
|
|
|
security: []
|
|
|
|
operationId: uploadFile
|
|
|
|
requestBody:
|
|
|
|
content:
|
|
|
|
multipart/form-data:
|
|
|
|
schema:
|
|
|
|
type: object
|
|
|
|
properties:
|
|
|
|
file:
|
|
|
|
type: string
|
|
|
|
format: binary
|
|
|
|
responses:
|
|
|
|
200:
|
|
|
|
$ref: '#/components/responses/uploadResponse'
|
|
|
|
/file/{uid}:
|
|
|
|
get:
|
|
|
|
operationId: getFile
|
|
|
|
parameters:
|
|
|
|
- name: uid
|
|
|
|
in: path
|
|
|
|
required: true
|
|
|
|
schema:
|
|
|
|
type: string
|
|
|
|
format: uuid
|
|
|
|
responses:
|
|
|
|
200:
|
|
|
|
description: file
|
|
|
|
content:
|
|
|
|
'application/octet-stream':
|
|
|
|
schema:
|
|
|
|
type: string
|
|
|
|
format: binary
|
|
|
|
|
2023-11-01 23:21:12 +03:00
|
|
|
|
|
|
|
components:
|
|
|
|
schemas:
|
2024-01-05 03:50:33 +03:00
|
|
|
userView:
|
2023-11-01 23:21:12 +03:00
|
|
|
type: object
|
|
|
|
properties:
|
|
|
|
id:
|
2024-01-06 08:44:26 +03:00
|
|
|
type: string
|
|
|
|
format: uuid
|
2024-01-05 03:50:33 +03:00
|
|
|
username:
|
2023-11-01 23:21:12 +03:00
|
|
|
type: string
|
2024-01-05 03:50:33 +03:00
|
|
|
required: [ id, username ]
|
|
|
|
gameView:
|
2023-11-01 23:21:12 +03:00
|
|
|
type: object
|
|
|
|
properties:
|
2024-01-05 03:50:33 +03:00
|
|
|
id:
|
2024-01-06 08:44:26 +03:00
|
|
|
type: string
|
|
|
|
format: uuid
|
2024-01-05 03:50:33 +03:00
|
|
|
title:
|
|
|
|
type: string
|
|
|
|
description:
|
2023-11-01 23:21:12 +03:00
|
|
|
type: string
|
2024-01-05 03:50:33 +03:00
|
|
|
type:
|
|
|
|
$ref: "#/components/schemas/gameType"
|
2024-01-06 08:44:26 +03:00
|
|
|
points:
|
|
|
|
type: integer
|
|
|
|
taskCount:
|
|
|
|
type: integer
|
|
|
|
createdAt:
|
|
|
|
type: string
|
|
|
|
authors:
|
|
|
|
type: array
|
|
|
|
items:
|
|
|
|
$ref: "#/components/schemas/userView"
|
2024-01-20 21:37:49 +03:00
|
|
|
icon:
|
|
|
|
type: string
|
|
|
|
format: uuid
|
2024-01-05 03:50:33 +03:00
|
|
|
required:
|
|
|
|
- id
|
|
|
|
- title
|
|
|
|
- description
|
|
|
|
- type
|
2024-01-06 08:44:26 +03:00
|
|
|
- points
|
|
|
|
- taskCount
|
|
|
|
- createdAt
|
|
|
|
- authors
|
2024-01-20 21:37:49 +03:00
|
|
|
- icon
|
2024-01-05 03:50:33 +03:00
|
|
|
taskView:
|
2023-11-01 23:21:12 +03:00
|
|
|
type: object
|
|
|
|
properties:
|
2024-01-06 08:44:26 +03:00
|
|
|
message:
|
|
|
|
type: string
|
|
|
|
enum:
|
|
|
|
- ok_code
|
|
|
|
- invalid_code
|
|
|
|
- old_code
|
|
|
|
- next_level
|
|
|
|
- game_complete
|
2024-01-05 03:50:33 +03:00
|
|
|
title:
|
2023-11-01 23:21:12 +03:00
|
|
|
type: string
|
2024-01-05 03:50:33 +03:00
|
|
|
text:
|
|
|
|
type: string
|
|
|
|
codes:
|
|
|
|
type: array
|
|
|
|
items:
|
|
|
|
$ref: '#/components/schemas/codeView'
|
|
|
|
solutions:
|
|
|
|
type: array
|
|
|
|
items:
|
|
|
|
$ref: '#/components/schemas/solutionView'
|
|
|
|
required:
|
|
|
|
- title
|
|
|
|
- text
|
|
|
|
- codes
|
|
|
|
- solutions
|
|
|
|
codeView:
|
2023-11-01 23:21:12 +03:00
|
|
|
type: object
|
|
|
|
properties:
|
2024-01-05 03:50:33 +03:00
|
|
|
description:
|
2023-11-01 23:21:12 +03:00
|
|
|
type: string
|
2024-01-05 03:50:33 +03:00
|
|
|
code:
|
|
|
|
type: string
|
|
|
|
required:
|
|
|
|
- description
|
|
|
|
solutionView:
|
2023-11-02 01:21:13 +03:00
|
|
|
type: object
|
|
|
|
properties:
|
2024-01-05 03:50:33 +03:00
|
|
|
text:
|
2023-11-02 01:21:13 +03:00
|
|
|
type: string
|
2024-01-05 03:50:33 +03:00
|
|
|
after:
|
2023-11-02 01:21:13 +03:00
|
|
|
type: integer
|
2024-01-05 03:50:33 +03:00
|
|
|
required:
|
|
|
|
- after
|
|
|
|
gameEdit:
|
2023-11-02 01:21:13 +03:00
|
|
|
type: object
|
|
|
|
properties:
|
|
|
|
title:
|
|
|
|
type: string
|
|
|
|
description:
|
|
|
|
type: string
|
2024-01-05 03:50:33 +03:00
|
|
|
type:
|
|
|
|
$ref: "#/components/schemas/gameType"
|
|
|
|
tasks:
|
2023-11-02 01:21:13 +03:00
|
|
|
type: array
|
|
|
|
items:
|
2024-01-05 03:50:33 +03:00
|
|
|
$ref: "#/components/schemas/taskEdit"
|
|
|
|
points:
|
|
|
|
type: integer
|
2024-01-20 21:37:49 +03:00
|
|
|
icon:
|
|
|
|
type: string
|
|
|
|
format: uuid
|
2023-11-02 01:21:13 +03:00
|
|
|
required:
|
|
|
|
- title
|
|
|
|
- description
|
2024-01-05 03:50:33 +03:00
|
|
|
- type
|
|
|
|
- tasks
|
|
|
|
- points
|
2024-01-20 21:37:49 +03:00
|
|
|
- icon
|
2024-01-05 03:50:33 +03:00
|
|
|
taskEdit:
|
2023-11-19 22:54:54 +03:00
|
|
|
type: object
|
|
|
|
properties:
|
|
|
|
title:
|
|
|
|
type: string
|
2024-01-05 03:50:33 +03:00
|
|
|
text:
|
|
|
|
type: string
|
|
|
|
codes:
|
|
|
|
type: array
|
|
|
|
items:
|
|
|
|
$ref: '#/components/schemas/codeEdit'
|
|
|
|
solutions:
|
|
|
|
type: array
|
|
|
|
items:
|
|
|
|
$ref: '#/components/schemas/solutionEdit'
|
|
|
|
required:
|
|
|
|
- title
|
|
|
|
- text
|
|
|
|
- codes
|
|
|
|
- solutions
|
|
|
|
codeEdit:
|
|
|
|
type: object
|
|
|
|
properties:
|
|
|
|
description:
|
|
|
|
type: string
|
|
|
|
code:
|
2023-11-19 22:54:54 +03:00
|
|
|
type: string
|
2024-01-05 03:50:33 +03:00
|
|
|
required:
|
|
|
|
- description
|
|
|
|
- code
|
|
|
|
solutionEdit:
|
|
|
|
type: object
|
|
|
|
properties:
|
|
|
|
text:
|
|
|
|
type: string
|
|
|
|
after:
|
|
|
|
type: integer
|
|
|
|
required:
|
|
|
|
- after
|
|
|
|
- text
|
|
|
|
gameType:
|
|
|
|
type: string
|
|
|
|
enum:
|
|
|
|
- virtual
|
|
|
|
- city
|
2023-11-01 23:21:12 +03:00
|
|
|
requestBodies:
|
|
|
|
login:
|
|
|
|
required: true
|
|
|
|
content:
|
|
|
|
'application/json':
|
|
|
|
schema:
|
|
|
|
type: object
|
|
|
|
properties:
|
|
|
|
email:
|
|
|
|
type: string
|
|
|
|
password:
|
|
|
|
type: string
|
|
|
|
required: [ email, password ]
|
|
|
|
register:
|
|
|
|
required: true
|
|
|
|
content:
|
|
|
|
'application/json':
|
|
|
|
schema:
|
|
|
|
type: object
|
|
|
|
properties:
|
|
|
|
username:
|
|
|
|
type: string
|
|
|
|
email:
|
|
|
|
type: string
|
|
|
|
password:
|
|
|
|
type: string
|
|
|
|
password2:
|
|
|
|
type: string
|
|
|
|
required: [ username, email, password, password2 ]
|
2024-01-05 03:50:33 +03:00
|
|
|
gameEditRequest:
|
|
|
|
required: true
|
|
|
|
content:
|
|
|
|
'application/json':
|
|
|
|
schema:
|
|
|
|
$ref: '#/components/schemas/gameEdit'
|
|
|
|
enterCodeRequest:
|
|
|
|
required: true
|
|
|
|
content:
|
|
|
|
'application/json':
|
|
|
|
schema:
|
|
|
|
type: object
|
|
|
|
properties:
|
|
|
|
code:
|
|
|
|
type: string
|
|
|
|
required:
|
|
|
|
- code
|
2023-11-01 23:21:12 +03:00
|
|
|
responses:
|
|
|
|
userResponse:
|
|
|
|
description: ''
|
|
|
|
content:
|
|
|
|
'application/json':
|
|
|
|
schema:
|
|
|
|
type: object
|
|
|
|
properties:
|
|
|
|
id:
|
2024-01-06 08:44:26 +03:00
|
|
|
type: string
|
|
|
|
format: uuid
|
2023-11-01 23:21:12 +03:00
|
|
|
username:
|
|
|
|
type: string
|
|
|
|
email:
|
|
|
|
type: string
|
2024-01-05 03:50:33 +03:00
|
|
|
experience:
|
|
|
|
type: integer
|
|
|
|
level:
|
|
|
|
type: integer
|
2024-01-06 08:44:26 +03:00
|
|
|
expToCurrentLevel:
|
|
|
|
type: integer
|
|
|
|
expToNextLevel:
|
|
|
|
type: integer
|
2024-01-05 03:50:33 +03:00
|
|
|
games:
|
|
|
|
type: array
|
|
|
|
items:
|
|
|
|
$ref: "#/components/schemas/gameView"
|
2023-11-01 23:21:12 +03:00
|
|
|
required:
|
|
|
|
- id
|
|
|
|
- username
|
|
|
|
- email
|
2024-01-05 03:50:33 +03:00
|
|
|
- experience
|
|
|
|
- level
|
2024-01-06 08:44:26 +03:00
|
|
|
- expToCurrentLevel
|
|
|
|
- expToNextLevel
|
2024-01-05 03:50:33 +03:00
|
|
|
- games
|
2023-11-01 23:21:12 +03:00
|
|
|
errorResponse:
|
|
|
|
description: ''
|
|
|
|
content:
|
|
|
|
'application/json':
|
|
|
|
schema:
|
|
|
|
type: object
|
|
|
|
properties:
|
|
|
|
code:
|
|
|
|
type: integer
|
|
|
|
message:
|
|
|
|
type: string
|
|
|
|
required: [ code, message ]
|
2023-11-02 01:21:13 +03:00
|
|
|
gameListResponse:
|
|
|
|
description: ''
|
|
|
|
content:
|
|
|
|
'application/json':
|
|
|
|
schema:
|
|
|
|
type: array
|
|
|
|
items:
|
|
|
|
$ref: "#/components/schemas/gameView"
|
|
|
|
gameResponse:
|
|
|
|
description: ''
|
|
|
|
content:
|
|
|
|
'application/json':
|
|
|
|
schema:
|
|
|
|
$ref: "#/components/schemas/gameView"
|
2024-01-05 03:50:33 +03:00
|
|
|
taskResponse:
|
2023-11-19 22:54:54 +03:00
|
|
|
description: ''
|
|
|
|
content:
|
|
|
|
'application/json':
|
|
|
|
schema:
|
2024-01-05 03:50:33 +03:00
|
|
|
$ref: "#/components/schemas/taskView"
|
2024-01-20 21:37:49 +03:00
|
|
|
uploadResponse:
|
|
|
|
description: ''
|
|
|
|
content:
|
|
|
|
'application/json':
|
|
|
|
schema:
|
|
|
|
type: object
|
|
|
|
properties:
|
|
|
|
uuid:
|
|
|
|
type: string
|
|
|
|
format: uuid
|
|
|
|
required:
|
|
|
|
- uuid
|
2023-11-01 23:21:12 +03:00
|
|
|
securitySchemes:
|
|
|
|
cookieAuth:
|
|
|
|
type: apiKey
|
|
|
|
in: cookie
|
|
|
|
name: session
|
|
|
|
|
|
|
|
security:
|
|
|
|
- cookieAuth: []
|