Skip to content

Commit

Permalink
atualizando a rota /indice
Browse files Browse the repository at this point in the history
  • Loading branch information
joellensilva committed Nov 2, 2023
1 parent 00e6cce commit dfc5ee8
Show file tree
Hide file tree
Showing 6 changed files with 227 additions and 27 deletions.
41 changes: 35 additions & 6 deletions docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ const docTemplate = `{
"tags": [
"public_api"
],
"operationId": "GetAggregateIndexes",
"operationId": "GetAggregateIndexesWithParams",
"parameters": [
{
"enum": [
Expand Down Expand Up @@ -757,7 +757,7 @@ const docTemplate = `{
"tags": [
"public_api"
],
"operationId": "GetAggregateIndexes",
"operationId": "GetAggregateIndexesWithParams",
"parameters": [
{
"enum": [
Expand Down Expand Up @@ -819,7 +819,7 @@ const docTemplate = `{
"tags": [
"public_api"
],
"operationId": "GetAggregateIndexes",
"operationId": "GetAggregateIndexesWithParams",
"parameters": [
{
"enum": [
Expand Down Expand Up @@ -895,7 +895,7 @@ const docTemplate = `{
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/papi.aggregateIndexes"
"$ref": "#/definitions/papi.aggregateIndexesByGroup"
}
}
},
Expand All @@ -917,7 +917,7 @@ const docTemplate = `{
"tags": [
"public_api"
],
"operationId": "GetAggregateIndexes",
"operationId": "GetAggregateIndexesWithParams",
"parameters": [
{
"type": "integer",
Expand Down Expand Up @@ -955,7 +955,7 @@ const docTemplate = `{
"tags": [
"public_api"
],
"operationId": "GetAggregateIndexes",
"operationId": "GetAggregateIndexesWithParams",
"parameters": [
{
"type": "integer",
Expand Down Expand Up @@ -1319,6 +1319,35 @@ const docTemplate = `{
}
}
},
"papi.aggregateIndexesByGroup": {
"type": "object",
"properties": {
"justica-estadual": {
"$ref": "#/definitions/papi.aggregateIndexes"
},
"justica-federal": {
"$ref": "#/definitions/papi.aggregateIndexes"
},
"justica-militar": {
"$ref": "#/definitions/papi.aggregateIndexes"
},
"justica-do-trabalho": {
"$ref": "#/definitions/papi.aggregateIndexes"
},
"justica-superior": {
"$ref": "#/definitions/papi.aggregateIndexes"
},
"justica-eleitoral": {
"$ref": "#/definitions/papi.aggregateIndexes"
},
"ministerios-publicos": {
"$ref": "#/definitions/papi.aggregateIndexes"
},
"conselhos-de-justica": {
"$ref": "#/definitions/papi.aggregateIndexes"
}
}
},
"uiapi.agency": {
"type": "object",
"properties": {
Expand Down
41 changes: 35 additions & 6 deletions docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@
"tags": [
"public_api"
],
"operationId": "GetAggregateIndexes",
"operationId": "GetAggregateIndexesWithParams",
"parameters": [
{
"enum": [
Expand Down Expand Up @@ -747,7 +747,7 @@
"tags": [
"public_api"
],
"operationId": "GetAggregateIndexes",
"operationId": "GetAggregateIndexesWithParams",
"parameters": [
{
"enum": [
Expand Down Expand Up @@ -809,7 +809,7 @@
"tags": [
"public_api"
],
"operationId": "GetAggregateIndexes",
"operationId": "GetAggregateIndexesWithParams",
"parameters": [
{
"enum": [
Expand Down Expand Up @@ -885,7 +885,7 @@
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/papi.aggregateIndexes"
"$ref": "#/definitions/papi.aggregateIndexesByGroup"
}
}
},
Expand All @@ -907,7 +907,7 @@
"tags": [
"public_api"
],
"operationId": "GetAggregateIndexes",
"operationId": "GetAggregateIndexesWithParams",
"parameters": [
{
"type": "integer",
Expand Down Expand Up @@ -945,7 +945,7 @@
"tags": [
"public_api"
],
"operationId": "GetAggregateIndexes",
"operationId": "GetAggregateIndexesWithParams",
"parameters": [
{
"type": "integer",
Expand Down Expand Up @@ -1309,6 +1309,35 @@
}
}
},
"papi.aggregateIndexesByGroup": {
"type": "object",
"properties": {
"justica-estadual": {
"$ref": "#/definitions/papi.aggregateIndexes"
},
"justica-federal": {
"$ref": "#/definitions/papi.aggregateIndexes"
},
"justica-militar": {
"$ref": "#/definitions/papi.aggregateIndexes"
},
"justica-do-trabalho": {
"$ref": "#/definitions/papi.aggregateIndexes"
},
"justica-superior": {
"$ref": "#/definitions/papi.aggregateIndexes"
},
"justica-eleitoral": {
"$ref": "#/definitions/papi.aggregateIndexes"
},
"ministerios-publicos": {
"$ref": "#/definitions/papi.aggregateIndexes"
},
"conselhos-de-justica": {
"$ref": "#/definitions/papi.aggregateIndexes"
}
}
},
"uiapi.agency": {
"type": "object",
"properties": {
Expand Down
29 changes: 24 additions & 5 deletions docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,25 @@ definitions:
detalhe:
$ref: "#/definitions/papi.indexInformation"
type: object
papi.aggregateIndexesByGroup:
properties:
justica-estadual:
$ref: "#/definitions/papi.aggregateIndexes"
justica-federal:
$ref: "#/definitions/papi.aggregateIndexes"
justica-militar:
$ref: "#/definitions/papi.aggregateIndexes"
justica-do-trabalho:
$ref: "#/definitions/papi.aggregateIndexes"
justica-superior:
$ref: "#/definitions/papi.aggregateIndexes"
justica-eleitoral:
$ref: "#/definitions/papi.aggregateIndexes"
ministerios-publicos:
$ref: "#/definitions/papi.aggregateIndexes"
conselhos-de-justica:
$ref: "#/definitions/papi.aggregateIndexes"
type: object
uiapi.agency:
properties:
coletando:
Expand Down Expand Up @@ -997,7 +1016,7 @@ paths:
/v2/indice/{param}/{valor}":
get:
description: Busca as informações de índices de um grupo ou órgão específico.
operationId: GetAggregateIndexes
operationId: GetAggregateIndexesWithParams
parameters:
- description: Tipo de parâmetro.
enum:
Expand Down Expand Up @@ -1034,7 +1053,7 @@ paths:
/v2/indice/{param}/{valor}/{ano}":
get:
description: Busca as informações de índices de um grupo ou órgão específico para o ano informado.
operationId: GetAggregateIndexes
operationId: GetAggregateIndexesWithParams
parameters:
- description: Tipo de parâmetro.
enum:
Expand Down Expand Up @@ -1076,7 +1095,7 @@ paths:
/v2/indice/{param}/{valor}/{ano}/{mes}":
get:
description: Busca as informações de índices de um grupo ou órgão específico para o ano e mês informados.
operationId: GetAggregateIndexes
operationId: GetAggregateIndexesWithParams
parameters:
- description: Tipo de parâmetro.
enum:
Expand Down Expand Up @@ -1142,7 +1161,7 @@ paths:
/v2/indices/{ano}:
get:
description: Busca as informações de índices de todos os órgãos para um ano específico.
operationId: GetAggregateIndexes
operationId: GetAggregateIndexesWithParams
parameters:
- description: Ano.
type: string,
Expand All @@ -1167,7 +1186,7 @@ paths:
/v2/indices/{ano}/{mes}:
get:
description: Busca as informações de índices de todos os órgãos para um ano e mês específicos.
operationId: GetAggregateIndexes
operationId: GetAggregateIndexesWithParams
parameters:
- description: Ano.
type: string,
Expand Down
16 changes: 8 additions & 8 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ func main() {

e := echo.New()

e.GET("/", func(ctx echo.Context) error {
return ctx.Redirect(http.StatusMovedPermanently, "/doc")
}) // necessário para checagem do beanstalk.
e.GET("/", func(ctx echo.Context) error {
return ctx.Redirect(http.StatusMovedPermanently, "/doc")
}) // necessário para checagem do beanstalk.

e.Use(middleware.StaticWithConfig(middleware.StaticConfig{
Root: "ui/dist/",
Expand Down Expand Up @@ -219,12 +219,12 @@ func main() {
// Return MIs by month
apiGroupV2.GET("/dados/:orgao/:ano/:mes", apiHandler.V2GetMonthlyInfo)
// Return agency index information
apiGroupV2.GET("/indice/:param/:valor", apiHandler.V2GetAggregateIndexes)
apiGroupV2.GET("/indice/:param/:valor/:ano", apiHandler.V2GetAggregateIndexes)
apiGroupV2.GET("/indice/:param/:valor/:ano/:mes", apiHandler.V2GetAggregateIndexes)
apiGroupV2.GET("/indice", apiHandler.V2GetAggregateIndexes)
apiGroupV2.GET("/indices/:ano", apiHandler.V2GetAggregateIndexes)
apiGroupV2.GET("/indices/:ano/:mes", apiHandler.V2GetAggregateIndexes)
apiGroupV2.GET("/indice/:param/:valor", apiHandler.V2GetAggregateIndexesWithParams)
apiGroupV2.GET("/indice/:param/:valor/:ano", apiHandler.V2GetAggregateIndexesWithParams)
apiGroupV2.GET("/indice/:param/:valor/:ano/:mes", apiHandler.V2GetAggregateIndexesWithParams)
apiGroupV2.GET("/indices/:ano", apiHandler.V2GetAggregateIndexesWithParams)
apiGroupV2.GET("/indices/:ano/:mes", apiHandler.V2GetAggregateIndexesWithParams)
apiGroupV2.GET("/dados/:orgao", apiHandler.V2GetAllAgencyInformation)

s := &http.Server{
Expand Down
Loading

0 comments on commit dfc5ee8

Please sign in to comment.