From 594d2245b43b6da7da250544b5468a5f4be123e7 Mon Sep 17 00:00:00 2001 From: JezzDiego Date: Mon, 5 May 2025 06:35:34 -0300 Subject: [PATCH 1/2] docs: add 'inconsistente' field to API models and documentation --- docs/docs.go | 6 ++++++ docs/swagger.json | 6 ++++++ docs/swagger.yaml | 4 ++++ papi/handlers.go | 1 + papi/models.go | 1 + uiapi/models.go | 1 + uiapi/uiapi_test.go | 3 ++- 7 files changed, 21 insertions(+), 1 deletion(-) diff --git a/docs/docs.go b/docs/docs.go index 7b8dd4c3..3b68a51b 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -1431,6 +1431,9 @@ const docTemplate = `{ "id_orgao": { "type": "string" }, + "inconsistente": { + "type": "boolean" + }, "indice_transparencia": { "$ref": "#/definitions/papi.score" }, @@ -1932,6 +1935,9 @@ const docTemplate = `{ "error": { "$ref": "#/definitions/uiapi.procError" }, + "inconsistente": { + "type": "boolean" + }, "mes": { "type": "integer" }, diff --git a/docs/swagger.json b/docs/swagger.json index eb5fd4b5..f8e5ddbd 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -1422,6 +1422,9 @@ "id_orgao": { "type": "string" }, + "inconsistente": { + "type": "boolean" + }, "indice_transparencia": { "$ref": "#/definitions/papi.score" }, @@ -1923,6 +1926,9 @@ "error": { "$ref": "#/definitions/uiapi.procError" }, + "inconsistente": { + "type": "boolean" + }, "mes": { "type": "integer" }, diff --git a/docs/swagger.yaml b/docs/swagger.yaml index be23db59..8558c2b6 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -278,6 +278,8 @@ definitions: $ref: '#/definitions/papi.miError' id_orgao: type: string + inconsistente: + type: boolean indice_transparencia: $ref: '#/definitions/papi.score' mes: @@ -612,6 +614,8 @@ definitions: type: number error: $ref: '#/definitions/uiapi.procError' + inconsistente: + type: boolean mes: type: integer outras_remuneracoes: diff --git a/papi/handlers.go b/papi/handlers.go index 00ecbcf4..aa09cd53 100644 --- a/papi/handlers.go +++ b/papi/handlers.go @@ -374,6 +374,7 @@ func (h handler) V2GetMonthlyInfo(c echo.Context) error { ParserVersion: monthlyInfo.ParserVersion, }, ManualCollection: monthlyInfo.ManualCollection, + Inconsistent: monthlyInfo.Inconsistent, } //O status 4 informa que os dados estão indisponíveis. Ao removê-los dos resultados da API, garantimos que eles sejam exibidos como se não houvesse dados. } else if monthlyInfo.ProcInfo.Status != 4 { diff --git a/papi/models.go b/papi/models.go index a286b0ac..873eb654 100644 --- a/papi/models.go +++ b/papi/models.go @@ -82,6 +82,7 @@ type summaryzedMI struct { Collect *collect `json:"dados_coleta,omitempty"` ManualCollection bool `json:"coleta_manual"` Error *miError `json:"error,omitempty"` + Inconsistent bool `json:"inconsistente"` } type agency struct { diff --git a/uiapi/models.go b/uiapi/models.go index 8ef4a2fb..760840c6 100644 --- a/uiapi/models.go +++ b/uiapi/models.go @@ -168,6 +168,7 @@ type v2MonthTotals struct { RemunerationsPerCapita float64 `json:"remuneracoes_por_membro"` CrawlingTimestamp timestamp `json:"timestamp"` ItemSummary itemSummary `json:"resumo_rubricas"` + Inconsistent bool `json:"inconsistente"` } type timestamp struct { diff --git a/uiapi/uiapi_test.go b/uiapi/uiapi_test.go index ec747a3f..bb64da79 100644 --- a/uiapi/uiapi_test.go +++ b/uiapi/uiapi_test.go @@ -1219,7 +1219,8 @@ func (g getTotalsOfAgencyYear) testWhenDataExists(t *testing.T) { "licenca_compensatoria": 120, "auxilio_saude": 300, "outras": 200 - } + }, + "inconsistente": false } ], "package": { From 7cd79babb586b8a0f4ba2f03acef2a4f37291b1d Mon Sep 17 00:00:00 2001 From: JezzDiego Date: Mon, 5 May 2025 06:45:54 -0300 Subject: [PATCH 2/2] docs: add 'inconsistente' field to missing files --- docs/docs.go | 3 +++ docs/swagger.json | 3 +++ docs/swagger.yaml | 2 ++ uiapi/handlers.go | 1 + uiapi/models.go | 1 + uiapi/uiapi_test.go | 4 +++- 6 files changed, 13 insertions(+), 1 deletion(-) diff --git a/docs/docs.go b/docs/docs.go index 3b68a51b..3c02c6ef 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -1558,6 +1558,9 @@ const docTemplate = `{ "descontos_por_mes": { "type": "number" }, + "inconsistente": { + "type": "boolean" + }, "meses_com_dados": { "type": "integer" }, diff --git a/docs/swagger.json b/docs/swagger.json index f8e5ddbd..ac947301 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -1549,6 +1549,9 @@ "descontos_por_mes": { "type": "number" }, + "inconsistente": { + "type": "boolean" + }, "meses_com_dados": { "type": "integer" }, diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 8558c2b6..7ce35556 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -366,6 +366,8 @@ definitions: type: number descontos_por_mes: type: number + inconsistente: + type: boolean meses_com_dados: type: integer num_membros: diff --git a/uiapi/handlers.go b/uiapi/handlers.go index da925d7b..17ba6ca0 100644 --- a/uiapi/handlers.go +++ b/uiapi/handlers.go @@ -1026,6 +1026,7 @@ func (h handler) GetAnnualSummary(c echo.Context) error { Size: s.Package.Size, }, ItemSummary: itemSummary, + Inconsistent: s.Inconsistent, }) } var collect []collecting diff --git a/uiapi/models.go b/uiapi/models.go index 760840c6..1dcba0c3 100644 --- a/uiapi/models.go +++ b/uiapi/models.go @@ -272,6 +272,7 @@ type annualSummaryData struct { NumMonthsWithData int `json:"meses_com_dados"` Package *backup `json:"package,omitempty"` ItemSummary itemSummary `json:"resumo_rubricas"` + Inconsistent bool `json:"inconsistente"` } type itemSummary struct { diff --git a/uiapi/uiapi_test.go b/uiapi/uiapi_test.go index bb64da79..3241b6ea 100644 --- a/uiapi/uiapi_test.go +++ b/uiapi/uiapi_test.go @@ -1394,6 +1394,7 @@ func (g getAnnualSummary) testWhenDataExists(t *testing.T) { HealthAllowance: 300, Others: 200, }, + Inconsistent: true, }, } dbMock.EXPECT().Connect().Return(nil).Times(1) @@ -1463,7 +1464,8 @@ func (g getAnnualSummary) testWhenDataExists(t *testing.T) { "licenca_compensatoria": 120, "auxilio_saude": 300, "outras": 200 - } + }, + "inconsistente": true } ] }