Skip to content

Commit a912b9c

Browse files
committed
atualizando documentação e teste
1 parent c403c47 commit a912b9c

File tree

5 files changed

+87
-62
lines changed

5 files changed

+87
-62
lines changed

docs/docs.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,6 +1185,9 @@ const docTemplate = `{
11851185
"id_orgao": {
11861186
"type": "string"
11871187
},
1188+
"inconsistente": {
1189+
"type": "boolean"
1190+
},
11881191
"indice_transparencia": {
11891192
"$ref": "#/definitions/papi.score"
11901193
},
@@ -1309,6 +1312,9 @@ const docTemplate = `{
13091312
"descontos_por_mes": {
13101313
"type": "number"
13111314
},
1315+
"inconsistente": {
1316+
"type": "boolean"
1317+
},
13121318
"meses_com_dados": {
13131319
"type": "integer"
13141320
},
@@ -1686,6 +1692,9 @@ const docTemplate = `{
16861692
"error": {
16871693
"$ref": "#/definitions/uiapi.procError"
16881694
},
1695+
"inconsistente": {
1696+
"type": "boolean"
1697+
},
16891698
"mes": {
16901699
"type": "integer"
16911700
},

docs/swagger.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1176,6 +1176,9 @@
11761176
"id_orgao": {
11771177
"type": "string"
11781178
},
1179+
"inconsistente": {
1180+
"type": "boolean"
1181+
},
11791182
"indice_transparencia": {
11801183
"$ref": "#/definitions/papi.score"
11811184
},
@@ -1300,6 +1303,9 @@
13001303
"descontos_por_mes": {
13011304
"type": "number"
13021305
},
1306+
"inconsistente": {
1307+
"type": "boolean"
1308+
},
13031309
"meses_com_dados": {
13041310
"type": "integer"
13051311
},
@@ -1677,6 +1683,9 @@
16771683
"error": {
16781684
"$ref": "#/definitions/uiapi.procError"
16791685
},
1686+
"inconsistente": {
1687+
"type": "boolean"
1688+
},
16801689
"mes": {
16811690
"type": "integer"
16821691
},

docs/swagger.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,8 @@ definitions:
278278
$ref: '#/definitions/papi.miError'
279279
id_orgao:
280280
type: string
281+
inconsistente:
282+
type: boolean
281283
indice_transparencia:
282284
$ref: '#/definitions/papi.score'
283285
mes:
@@ -364,6 +366,8 @@ definitions:
364366
type: number
365367
descontos_por_mes:
366368
type: number
369+
inconsistente:
370+
type: boolean
367371
meses_com_dados:
368372
type: integer
369373
num_membros:
@@ -612,6 +616,8 @@ definitions:
612616
type: number
613617
error:
614618
$ref: '#/definitions/uiapi.procError'
619+
inconsistente:
620+
type: boolean
615621
mes:
616622
type: integer
617623
outras_remuneracoes:

papi/handlers.go

Lines changed: 61 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ func (h handler) V1GetAgencyById(c echo.Context) error {
3939
return c.JSON(http.StatusOK, agency)
4040
}
4141

42-
// @ID GetAgencyById
43-
// @Tags public_api
44-
// @Description Busca um órgão específico utilizando seu ID.
45-
// @Produce json
46-
// @Param orgao path string true "ID do órgão. Exemplos: tjal, tjba, mppb."
47-
// @Success 200 {object} agency "Requisição bem sucedida."
48-
// @Failure 404 {string} string "Órgão não encontrado."
49-
// @Router /v2/orgao/{orgao} [get]
42+
// @ID GetAgencyById
43+
// @Tags public_api
44+
// @Description Busca um órgão específico utilizando seu ID.
45+
// @Produce json
46+
// @Param orgao path string true "ID do órgão. Exemplos: tjal, tjba, mppb."
47+
// @Success 200 {object} agency "Requisição bem sucedida."
48+
// @Failure 404 {string} string "Órgão não encontrado."
49+
// @Router /v2/orgao/{orgao} [get]
5050
func (h handler) V2GetAgencyById(c echo.Context) error {
5151
agencyName := c.Param("orgao")
5252
strAgency, err := h.client.Db.GetAgency(agencyName)
@@ -92,13 +92,13 @@ func (h handler) V1GetAllAgencies(c echo.Context) error {
9292
return c.JSON(http.StatusOK, agencies)
9393
}
9494

95-
// @ID GetAllAgencies
96-
// @Tags public_api
97-
// @Description Busca todos os órgãos disponíveis.
98-
// @Produce json
99-
// @Success 200 {object} []agency "Requisição bem sucedida."
100-
// @Failure 500 {string} string "Erro interno do servidor."
101-
// @Router /v2/orgaos [get]
95+
// @ID GetAllAgencies
96+
// @Tags public_api
97+
// @Description Busca todos os órgãos disponíveis.
98+
// @Produce json
99+
// @Success 200 {object} []agency "Requisição bem sucedida."
100+
// @Failure 500 {string} string "Erro interno do servidor."
101+
// @Router /v2/orgaos [get]
102102
func (h handler) V2GetAllAgencies(c echo.Context) error {
103103
strAgencies, err := h.client.Db.GetAllAgencies()
104104
if err != nil {
@@ -264,17 +264,17 @@ func (h handler) GetMonthlyInfo(c echo.Context) error {
264264
return c.JSON(http.StatusOK, sumMI)
265265
}
266266

267-
// @ID GetMonthlyInfo
268-
// @Tags public_api
269-
// @Description Busca um dado mensal de um órgão
270-
// @Produce json
271-
// @Success 200 {object} summaryzedMI "Requisição bem sucedida"
272-
// @Failure 400 {string} string "Parâmetros inválidos"
273-
// @Failure 404 {string} string "Não existem dados para os parâmetros informados"
274-
// @Param ano path int true "Ano"
275-
// @Param orgao path string true "Órgão"
276-
// @Param mes path int true "Mês"
277-
// @Router /v2/dados/{orgao}/{ano}/{mes} [get]
267+
// @ID GetMonthlyInfo
268+
// @Tags public_api
269+
// @Description Busca um dado mensal de um órgão
270+
// @Produce json
271+
// @Success 200 {object} summaryzedMI "Requisição bem sucedida"
272+
// @Failure 400 {string} string "Parâmetros inválidos"
273+
// @Failure 404 {string} string "Não existem dados para os parâmetros informados"
274+
// @Param ano path int true "Ano"
275+
// @Param orgao path string true "Órgão"
276+
// @Param mes path int true "Mês"
277+
// @Router /v2/dados/{orgao}/{ano}/{mes} [get]
278278
func (h handler) V2GetMonthlyInfo(c echo.Context) error {
279279
year, err := strconv.Atoi(c.Param("ano"))
280280
if err != nil {
@@ -398,16 +398,16 @@ func (h handler) V2GetMonthlyInfo(c echo.Context) error {
398398
return c.JSON(http.StatusOK, sumMI)
399399
}
400400

401-
// @ID GetMonthlyInfosByYear
402-
// @Tags public_api
403-
// @Description Busca os dados mensais de um órgão por ano
404-
// @Produce json
405-
// @Success 200 {object} []summaryzedMI "Requisição bem sucedida"
406-
// @Failure 400 {string} string "Parâmetros inválidos"
407-
// @Failure 404 {string} string "Não existem dados para os parâmetros informados"
408-
// @Param ano path int true "Ano"
409-
// @Param orgao path string true "Órgão"
410-
// @Router /v2/dados/{orgao}/{ano} [get]
401+
// @ID GetMonthlyInfosByYear
402+
// @Tags public_api
403+
// @Description Busca os dados mensais de um órgão por ano
404+
// @Produce json
405+
// @Success 200 {object} []summaryzedMI "Requisição bem sucedida"
406+
// @Failure 400 {string} string "Parâmetros inválidos"
407+
// @Failure 404 {string} string "Não existem dados para os parâmetros informados"
408+
// @Param ano path int true "Ano"
409+
// @Param orgao path string true "Órgão"
410+
// @Router /v2/dados/{orgao}/{ano} [get]
411411
func (h handler) GetMonthlyInfosByYear(c echo.Context) error {
412412
year, err := strconv.Atoi(c.Param("ano"))
413413
if err != nil {
@@ -532,16 +532,16 @@ func (h handler) GetMonthlyInfosByYear(c echo.Context) error {
532532
return c.JSON(http.StatusOK, sumMI)
533533
}
534534

535-
// @ID GetAggregateIndexesWithParams
536-
// @Tags public_api
537-
// @Description Busca as informações de índices de um grupo ou órgão específico.
538-
// @Produce json
539-
// @Success 200 {object} []aggregateIndexes "Requisição bem sucedida."
540-
// @Failure 400 {string} string "Requisição inválida."
541-
// @Failure 500 {string} string "Erro interno do servidor."
542-
// @Param param path string true "'grupo' ou 'orgao'"
543-
// @Param valor path string true "Jurisdição ou ID do órgao"
544-
// @Router /v2/indice/{param}/{valor} [get]
535+
// @ID GetAggregateIndexesWithParams
536+
// @Tags public_api
537+
// @Description Busca as informações de índices de um grupo ou órgão específico.
538+
// @Produce json
539+
// @Success 200 {object} []aggregateIndexes "Requisição bem sucedida."
540+
// @Failure 400 {string} string "Requisição inválida."
541+
// @Failure 500 {string} string "Erro interno do servidor."
542+
// @Param param path string true "'grupo' ou 'orgao'"
543+
// @Param valor path string true "Jurisdição ou ID do órgao"
544+
// @Router /v2/indice/{param}/{valor} [get]
545545
func (h handler) V2GetAggregateIndexesWithParams(c echo.Context) error {
546546
param := c.Param("param")
547547
valor := c.Param("valor")
@@ -689,13 +689,13 @@ func (h handler) V2GetAggregateIndexesWithParams(c echo.Context) error {
689689
return c.JSON(http.StatusOK, aggregate)
690690
}
691691

692-
// @ID GetAggregateIndexes
693-
// @Tags public_api
694-
// @Description Busca as informações de índices de todos os órgãos.
695-
// @Produce json
696-
// @Success 200 {object} []aggregateIndexesByGroup "Requisição bem sucedida."
697-
// @Failure 500 {string} string "Erro interno do servidor."
698-
// @Router /v2/indice [get]
692+
// @ID GetAggregateIndexes
693+
// @Tags public_api
694+
// @Description Busca as informações de índices de todos os órgãos.
695+
// @Produce json
696+
// @Success 200 {object} []aggregateIndexesByGroup "Requisição bem sucedida."
697+
// @Failure 500 {string} string "Erro interno do servidor."
698+
// @Router /v2/indice [get]
699699
func (h handler) V2GetAggregateIndexes(c echo.Context) error {
700700
agregado := c.QueryParam("agregado")
701701
detalhe := c.QueryParam("detalhe")
@@ -799,14 +799,14 @@ func (h handler) V2GetAggregateIndexes(c echo.Context) error {
799799
return c.JSON(http.StatusOK, dados)
800800
}
801801

802-
// @ID GetAllAgencyInformation
803-
// @Tags public_api
804-
// @Description Busca todas as informações de um órgão específico.
805-
// @Produce json
806-
// @Success 200 {object} allAgencyInformation "Requisição bem sucedida."
807-
// @Failure 400 {string} string "Requisição inválida."
808-
// @Param orgao path string true "órgão"
809-
// @Router /v2/dados/{orgao} [get]
802+
// @ID GetAllAgencyInformation
803+
// @Tags public_api
804+
// @Description Busca todas as informações de um órgão específico.
805+
// @Produce json
806+
// @Success 200 {object} allAgencyInformation "Requisição bem sucedida."
807+
// @Failure 400 {string} string "Requisição inválida."
808+
// @Param orgao path string true "órgão"
809+
// @Router /v2/dados/{orgao} [get]
810810
func (h handler) V2GetAllAgencyInformation(c echo.Context) error {
811811
agency := strings.ToLower(c.Param("orgao"))
812812

uiapi/uiapi_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1219,7 +1219,8 @@ func (g getTotalsOfAgencyYear) testWhenDataExists(t *testing.T) {
12191219
"licenca_compensatoria": 120,
12201220
"auxilio_saude": 300,
12211221
"outras": 200
1222-
}
1222+
},
1223+
"inconsistente": false
12231224
}
12241225
],
12251226
"package": {

0 commit comments

Comments
 (0)