-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b824371
commit d356684
Showing
29 changed files
with
498 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
node_modules | ||
dist | ||
coverage | ||
.vscode | ||
.vscode | ||
globalConfig.json |
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,19 @@ | ||
import { apiKeyAuthSchema } from './schemas/' | ||
import { | ||
badRequest, | ||
serverError, | ||
unauthorized, | ||
notFound, | ||
forbidden | ||
} from './components/' | ||
|
||
export default { | ||
securitySchemes: { | ||
apiKeyAuth: apiKeyAuthSchema | ||
}, | ||
badRequest, | ||
serverError, | ||
unauthorized, | ||
notFound, | ||
forbidden | ||
} |
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,10 @@ | ||
export const badRequest = { | ||
description: 'Requisição inválida', | ||
content: { | ||
'application/json': { | ||
schema: { | ||
$ref: '#/schemas/error' | ||
} | ||
} | ||
} | ||
} |
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,10 @@ | ||
export const forbidden = { | ||
description: 'Acesso negado', | ||
content: { | ||
'application/json': { | ||
schema: { | ||
$ref: '#/schemas/error' | ||
} | ||
} | ||
} | ||
} |
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,5 @@ | ||
export * from './bad-request' | ||
export * from './server-error' | ||
export * from './unauthorized' | ||
export * from './not-found' | ||
export * from './forbidden' |
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,3 @@ | ||
export const notFound = { | ||
description: 'API não encontrada' | ||
} |
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,10 @@ | ||
export const serverError = { | ||
description: 'Erro interno no servidor', | ||
content: { | ||
'application/json': { | ||
schema: { | ||
$ref: '#/schemas/error' | ||
} | ||
} | ||
} | ||
} |
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,10 @@ | ||
export const unauthorized = { | ||
description: 'Credenciais inválidas', | ||
content: { | ||
'application/json': { | ||
schema: { | ||
$ref: '#/schemas/error' | ||
} | ||
} | ||
} | ||
} |
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,13 @@ | ||
import { | ||
loginPath, | ||
surveyPath, | ||
signUpPath, | ||
surveyResultPath | ||
} from './paths/' | ||
|
||
export default { | ||
'/login': loginPath, | ||
'/signup': signUpPath, | ||
'/surveys': surveyPath, | ||
'/surveys/{surveyId}/results': surveyResultPath | ||
} |
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,4 @@ | ||
export * from './login-path' | ||
export * from './survey-path' | ||
export * from './signup-path' | ||
export * from './survey-result-path' |
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,41 @@ | ||
export const signUpPath = { | ||
post: { | ||
tags: ['Login'], | ||
summary: 'API para criar conta de um usuário', | ||
description: 'Essa rota pode ser executada por **qualquer usuário**', | ||
requestBody: { | ||
required: true, | ||
content: { | ||
'application/json': { | ||
schema: { | ||
$ref: '#/schemas/signUpParams' | ||
} | ||
} | ||
} | ||
}, | ||
responses: { | ||
200: { | ||
description: 'Sucesso', | ||
content: { | ||
'application/json': { | ||
schema: { | ||
$ref: '#/schemas/account' | ||
} | ||
} | ||
} | ||
}, | ||
400: { | ||
$ref: '#/components/badRequest' | ||
}, | ||
403: { | ||
$ref: '#/components/forbidden' | ||
}, | ||
404: { | ||
$ref: '#/components/notFound' | ||
}, | ||
500: { | ||
$ref: '#/components/serverError' | ||
} | ||
} | ||
} | ||
} |
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,66 @@ | ||
export const surveyPath = { | ||
get: { | ||
security: [{ | ||
apiKeyAuth: [] | ||
}], | ||
tags: ['Enquete'], | ||
summary: 'API para listar todas as enquetes', | ||
description: 'Essa rota só pode ser executada por **usuários autenticados**', | ||
responses: { | ||
200: { | ||
description: 'Sucesso', | ||
content: { | ||
'application/json': { | ||
schema: { | ||
$ref: '#/schemas/surveys' | ||
} | ||
} | ||
} | ||
}, | ||
204: { | ||
description: 'Sucesso, mas sem dados para exibir' | ||
}, | ||
403: { | ||
$ref: '#/components/forbidden' | ||
}, | ||
404: { | ||
$ref: '#/components/notFound' | ||
}, | ||
500: { | ||
$ref: '#/components/serverError' | ||
} | ||
} | ||
}, | ||
post: { | ||
security: [{ | ||
apiKeyAuth: [] | ||
}], | ||
tags: ['Enquete'], | ||
summary: 'API para criar uma enquete', | ||
description: 'Essa rota só pode ser executada por **administradores**', | ||
requestBody: { | ||
required: true, | ||
content: { | ||
'application/json': { | ||
schema: { | ||
$ref: '#/schemas/addSurveyParams' | ||
} | ||
} | ||
} | ||
}, | ||
responses: { | ||
204: { | ||
description: 'Sucesso, mas sem dados para exibir' | ||
}, | ||
403: { | ||
$ref: '#/components/forbidden' | ||
}, | ||
404: { | ||
$ref: '#/components/notFound' | ||
}, | ||
500: { | ||
$ref: '#/components/serverError' | ||
} | ||
} | ||
} | ||
} |
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,88 @@ | ||
export const surveyResultPath = { | ||
put: { | ||
security: [{ | ||
apiKeyAuth: [] | ||
}], | ||
tags: ['Enquete'], | ||
summary: 'API para criar a resposta de uma enquete', | ||
description: 'Essa rota só pode ser executada por **usuários autenticados**', | ||
parameters: [{ | ||
in: 'path', | ||
name: 'surveyId', | ||
description: 'ID da enquete a ser respondida', | ||
required: true, | ||
schema: { | ||
type: 'string' | ||
} | ||
}], | ||
requestBody: { | ||
required: true, | ||
content: { | ||
'application/json': { | ||
schema: { | ||
$ref: '#/schemas/saveSurveyParams' | ||
} | ||
} | ||
} | ||
}, | ||
responses: { | ||
200: { | ||
description: 'Sucesso', | ||
content: { | ||
'application/json': { | ||
schema: { | ||
$ref: '#/schemas/surveyResult' | ||
} | ||
} | ||
} | ||
}, | ||
403: { | ||
$ref: '#/components/forbidden' | ||
}, | ||
404: { | ||
$ref: '#/components/notFound' | ||
}, | ||
500: { | ||
$ref: '#/components/serverError' | ||
} | ||
} | ||
}, | ||
get: { | ||
security: [{ | ||
apiKeyAuth: [] | ||
}], | ||
tags: ['Enquete'], | ||
summary: 'API para consultar o resultado de uma enquete', | ||
description: 'Essa rota só pode ser executada por **usuários autenticados**', | ||
parameters: [{ | ||
in: 'path', | ||
name: 'surveyId', | ||
description: 'ID da enquete a ser respondida', | ||
required: true, | ||
schema: { | ||
type: 'string' | ||
} | ||
}], | ||
responses: { | ||
200: { | ||
description: 'Sucesso', | ||
content: { | ||
'application/json': { | ||
schema: { | ||
$ref: '#/schemas/surveyResult' | ||
} | ||
} | ||
} | ||
}, | ||
403: { | ||
$ref: '#/components/forbidden' | ||
}, | ||
404: { | ||
$ref: '#/components/notFound' | ||
}, | ||
500: { | ||
$ref: '#/components/serverError' | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.