openapi: "3.1.0" info: version: 1.0.0 title: nQuest servers: - url: /api 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' # Team routes /teams: get: responses: 200: $ref: '#/components/responses/teamsListResponse' 403: $ref: '#/components/responses/errorResponse' post: requestBody: content: 'application/json': schema: type: object properties: name: type: string required: [ name ] responses: 200: $ref: '#/components/responses/teamResponse' 404: $ref: '#/components/responses/errorResponse' /teams/{teamID}: get: parameters: - in: path name: teamID schema: type: integer required: true responses: 200: $ref: '#/components/responses/teamResponse' 404: $ref: '#/components/responses/errorResponse' delete: parameters: - in: path name: teamID schema: type: integer required: true responses: 204: description: '' 403: $ref: '#/components/responses/errorResponse' /teams/{teamID}/members: post: parameters: - in: path name: teamID schema: type: integer required: true responses: 200: $ref: '#/components/responses/teamResponse' 404: $ref: '#/components/responses/errorResponse' delete: parameters: - in: path name: teamID schema: type: integer required: true requestBody: content: 'application/json': schema: userID: type: integer responses: 200: $ref: '#/components/responses/teamResponse' 404: $ref: '#/components/responses/errorResponse' # Game routes /games: get: security: [] responses: 200: $ref: '#/components/responses/gameListResponse' components: schemas: userTeam: type: object properties: id: type: integer name: type: string role: $ref: "#/components/schemas/userTeamRole" required: [ id, name, role ] userTeamRole: type: string enum: - member - captain teamMember: type: object properties: user: $ref: "#/components/schemas/userView" role: $ref: "#/components/schemas/userTeamRole" createdAt: type: string required: [ user, role, createdAt ] teamRequest: type: object properties: user: $ref: "#/components/schemas/userView" createdAt: type: string required: [ user, role, createdAt ] userView: type: object properties: id: type: integer username: type: string required: [ id, username ] teamView: type: object properties: id: type: integer name: type: string members: type: integer currentTeam: type: boolean createdAt: type: string required: [ id, name, createdAt ] gameView: type: object properties: id: type: integer title: type: string description: type: string startAt: type: string teams: type: array items: $ref: "#/components/schemas/teamView" required: - id - title - description - startAt - teams 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 ] responses: userResponse: description: '' content: 'application/json': schema: type: object properties: id: type: integer username: type: string email: type: string team: $ref: "#/components/schemas/userTeam" required: - id - username - email errorResponse: description: '' content: 'application/json': schema: type: object properties: code: type: integer message: type: string required: [ code, message ] teamsListResponse: description: '' content: 'application/json': schema: type: array items: $ref: "#/components/schemas/teamView" teamResponse: description: '' content: 'application/json': schema: type: object properties: id: type: integer name: type: string members: type: array items: $ref: "#/components/schemas/teamMember" requests: type: array items: $ref: "#/components/schemas/teamRequest" createdAt: type: string required: [ id, name, members, requests, createdAt ] gameListResponse: description: '' content: 'application/json': schema: type: array items: $ref: "#/components/schemas/gameView" gameResponse: description: '' content: 'application/json': schema: $ref: "#/components/schemas/gameView" securitySchemes: cookieAuth: type: apiKey in: cookie name: session security: - cookieAuth: []