forked from Arquisoft/wiq_0
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #59 from Arquisoft/PruebaConjunto
merge with master PruebaConjunto
- Loading branch information
Showing
26 changed files
with
1,095 additions
and
212 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,273 @@ | ||
openapi: 3.0.0 | ||
info: | ||
title: Gatewayservice API | ||
description: Gateway OpenAPI specification. | ||
version: 0.2.0 | ||
servers: | ||
- url: http://localhost:8000 | ||
description: Development server | ||
- url: http://SOMEIP:8000 | ||
description: Production server | ||
paths: | ||
/adduser: | ||
post: | ||
summary: Add a new user to the database. | ||
operationId: addUser | ||
requestBody: | ||
required: true | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
properties: | ||
username: | ||
type: string | ||
description: User ID. | ||
example: student | ||
password: | ||
type: string | ||
description: User password. | ||
example: pass | ||
responses: | ||
'200': | ||
description: User added successfully. | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
properties: | ||
username: | ||
type: string | ||
description: User ID | ||
password: | ||
type: string | ||
description: Hashed password | ||
example: $2b$10$ZKdNYLWFQxzt5Rei/YTc/OsZNi12YiWz30JeUFHNdAt7MyfmkTuvC | ||
_id: | ||
type: string | ||
description: Identification | ||
example: 65f756db3fa22d227a4b7c7d | ||
createdAt: | ||
type: string | ||
description: Creation date. | ||
example: '2024-03-17T20:47:23.935Z' | ||
___v: | ||
type: integer | ||
example: '0' | ||
'400': | ||
description: Failed to add user. | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
properties: | ||
error: | ||
type: string | ||
description: Error information. | ||
example: getaddrinfo EAI_AGAIN mongodb | ||
/health: | ||
get: | ||
summary: Check the health status of the service. | ||
operationId: checkHealth | ||
responses: | ||
'200': | ||
description: Service is healthy. | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
properties: | ||
status: | ||
type: string | ||
description: Health status. | ||
example: OK | ||
/login: | ||
post: | ||
summary: Log in to the system. | ||
operationId: loginUser | ||
requestBody: | ||
required: true | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
properties: | ||
username: | ||
type: string | ||
description: User ID. | ||
example: student | ||
password: | ||
type: string | ||
description: User password. | ||
example: pass | ||
responses: | ||
'200': | ||
description: Login successful. Returns user token, username, and creation date. | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
properties: | ||
token: | ||
type: string | ||
description: User token. | ||
example: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiI2NWY3NTZkYjNmYTIyZDIyN2E0YjdjN2QiLCJpYXQiOjE3MTA3MDg3NDUsImV4cCI6MTcxMDcxMjM0NX0.VMG_5DOyQ4GYlJQRcu1I6ICG1IGzuo2Xuei093ONHxw | ||
username: | ||
type: string | ||
description: Username. | ||
example: student | ||
createdAt: | ||
type: string | ||
description: Creation date. | ||
example: '2024-03-17T20:47:23.935Z' | ||
'401': | ||
description: Invalid credentials. | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
properties: | ||
error: | ||
type: string | ||
description: Shows the error info.. | ||
example: Invalid credentials | ||
'500': | ||
description: Internal server error. | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
properties: | ||
error: | ||
type: string | ||
description: Error information. | ||
example: Internal Server Error | ||
|
||
paths: | ||
/questions: | ||
post: | ||
summary: Create a question and its answers. | ||
operationId: questions | ||
responses: | ||
'200': | ||
description: Question created successfully. | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
properties: | ||
pregunta: | ||
type: string | ||
description: Question text | ||
example: Who was the author of The Hunger Games? | ||
correcta: | ||
type: string | ||
description: Correct answer | ||
example: Suzzanne Collins | ||
incorrectas: | ||
type: array | ||
items: | ||
type: string | ||
example: | ||
- Sarah J. Maas | ||
- Alice Oseman | ||
- Veronica Roth | ||
'400': | ||
description: Failed to create question. | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
properties: | ||
error: | ||
type: string | ||
description: Wikidata error conection. | ||
example: Cannot connect with Wikidata | ||
|
||
/getRecords: | ||
post: | ||
summary: Obtains the records of the user. | ||
operationId: userRecords | ||
requestBody: | ||
required: true | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
properties: | ||
username: | ||
type: string | ||
description: User ID. | ||
example: student | ||
responses: | ||
'200': | ||
description: Get Records successful. | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
properties: | ||
user_id: | ||
type: string | ||
description: Username. | ||
example: student | ||
correctQuestions: | ||
type: number | ||
description: Number of correct questions. | ||
example: 2 | ||
totalQuestions: | ||
type: number | ||
description: Number of questions. | ||
example: 5 | ||
totalTime: | ||
type: number | ||
description: Time spent playing in seconds. | ||
example: 26 | ||
doneAt: | ||
type: string | ||
description: When was the game done. | ||
example: '2024-03-17T20:47:23.935Z' | ||
|
||
|
||
'400': | ||
description: User is not valid or doesn't exist. | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
properties: | ||
error: | ||
type: string | ||
description: Shows the error info.. | ||
example: Invalid user | ||
/getAllUsers: | ||
get: | ||
summary: Obtains the information of all users. | ||
operationId: allUsers | ||
responses: | ||
'200': | ||
description: Get Users successful. | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
properties: | ||
username: | ||
type: string | ||
description: Username of the user. | ||
example: student | ||
createdAt: | ||
type: string | ||
description: When the account was created | ||
example: '2024-03-05T15:10:51.313Z' | ||
'500': | ||
description: Internal server error. | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
properties: | ||
error: | ||
type: string | ||
description: Error information. | ||
example: Internal Server Error |
Oops, something went wrong.