From 4f7d05d4fa593eba45fcd88cc616c9d038f78446 Mon Sep 17 00:00:00 2001 From: Joellensilva Date: Wed, 13 Dec 2023 16:40:53 -0300 Subject: [PATCH 1/2] retornando resumo rubricas --- docs/docs.go | 580 +++++++++++----------------- docs/swagger.json | 575 +++++++++++---------------- docs/swagger.yaml | 919 ++++++++++++++++++++------------------------ papi/handlers.go | 18 +- papi/models.go | 6 + uiapi/handlers.go | 21 +- uiapi/models.go | 103 ++--- uiapi/uiapi_test.go | 36 +- 8 files changed, 999 insertions(+), 1259 deletions(-) diff --git a/docs/docs.go b/docs/docs.go index 85ad125..6815a9c 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -1,5 +1,4 @@ -// Package docs GENERATED BY SWAG; DO NOT EDIT -// This file was generated by swaggo/swag +// Package docs Code generated by swaggo/swag. DO NOT EDIT package docs import "github.com/swaggo/swag" @@ -288,7 +287,7 @@ const docTemplate = `{ "200": { "description": "Requisição bem sucedida.", "schema": { - "$ref": "#/definitions/uiapi.agencySalary" + "$ref": "#/definitions/uiapi.agencyRemuneration" } }, "206": { @@ -629,58 +628,23 @@ const docTemplate = `{ } } }, - "/v2/orgao/{orgao}": { - "get": { - "description": "Busca um órgão específico utilizando seu ID.", - "produces": [ - "application/json" - ], - "tags": [ - "public_api" - ], - "operationId": "GetAgencyById", - "parameters": [ - { - "type": "string", - "description": "ID do órgão. Exemplos: tjal, tjba, mppb.", - "name": "orgao", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "Requisição bem sucedida.", - "schema": { - "$ref": "#/definitions/papi.agency" - } - }, - "404": { - "description": "Órgão não encontrado.", - "schema": { - "type": "string" - } - } - } - } - }, - "/v2/orgaos": { + "/v2/indice": { "get": { - "description": "Busca todos os órgãos disponíveis.", + "description": "Busca as informações de índices de todos os órgãos.", "produces": [ "application/json" ], "tags": [ "public_api" ], - "operationId": "GetAllAgencies", + "operationId": "GetAggregateIndexes", "responses": { "200": { "description": "Requisição bem sucedida.", "schema": { "type": "array", "items": { - "$ref": "#/definitions/papi.agency" + "$ref": "#/definitions/papi.aggregateIndexesByGroup" } } }, @@ -705,19 +669,15 @@ const docTemplate = `{ "operationId": "GetAggregateIndexesWithParams", "parameters": [ { - "enum": [ - "grupo", - "orgao" - ], "type": "string", - "description": "Tipo de parâmetro.", + "description": "'grupo' ou 'orgao'", "name": "param", "in": "path", "required": true }, { "type": "string", - "description": "jurisdição ou ID do órgão", + "description": "Jurisdição ou ID do órgao", "name": "valor", "in": "path", "required": true @@ -748,181 +708,21 @@ const docTemplate = `{ } } }, - "/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.", - "produces": [ - "application/json" - ], - "tags": [ - "public_api" - ], - "operationId": "GetAggregateIndexesWithParams", - "parameters": [ - { - "enum": [ - "grupo", - "orgao" - ], - "type": "string", - "description": "Tipo de parâmetro.", - "name": "param", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "jurisdição ou ID do órgão", - "name": "valor", - "in": "path", - "required": true - }, - { - "type": "integer", - "description": "Ano", - "name": "ano", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "Requisição bem sucedida.", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/papi.aggregateIndexes" - } - } - }, - "400": { - "description": "Requisição inválida.", - "schema": { - "type": "string" - } - }, - "500": { - "description": "Erro interno do servidor.", - "schema": { - "type": "string" - } - } - } - } - }, - "/v2/indice/{param}/{valor}/{ano}/{mes}": { + "/v2/orgao/{orgao}": { "get": { - "description": "Busca as informações de índices de um grupo ou órgão específico para o ano e mês informados.", + "description": "Busca um órgão específico utilizando seu ID.", "produces": [ "application/json" ], "tags": [ "public_api" ], - "operationId": "GetAggregateIndexesWithParams", + "operationId": "GetAgencyById", "parameters": [ - { - "enum": [ - "grupo", - "orgao" - ], - "type": "string", - "description": "Tipo de parâmetro.", - "name": "param", - "in": "path", - "required": true - }, { "type": "string", - "description": "jurisdição ou ID do órgão", - "name": "valor", - "in": "path", - "required": true - }, - { - "type": "integer", - "description": "Ano", - "name": "ano", - "in": "path", - "required": true - }, - { - "type": "integer", - "description": "Mês", - "name": "mes", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "Requisição bem sucedida.", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/papi.aggregateIndexes" - } - } - }, - "400": { - "description": "Requisição inválida.", - "schema": { - "type": "string" - } - }, - "500": { - "description": "Erro interno do servidor.", - "schema": { - "type": "string" - } - } - } - } - }, - "/v2/indice": { - "get": { - "description": "Busca as informações de índices de todos os órgãos", - "produces": [ - "application/json" - ], - "tags": [ - "public_api" - ], - "operationId": "GetAggregateIndexes", - "responses": { - "200": { - "description": "Requisição bem sucedida.", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/papi.aggregateIndexesByGroup" - } - } - }, - "500": { - "description": "Erro interno do servidor.", - "schema": { - "type": "string" - } - } - } - } - }, - "/v2/indices/{ano}": { - "get": { - "description": "Busca as informações de índices de todos os órgãos para um ano específico", - "produces": [ - "application/json" - ], - "tags": [ - "public_api" - ], - "operationId": "GetAggregateIndexesWithParams", - "parameters": [ - { - "type": "integer", - "description": "Ano.", - "name": "ano", + "description": "ID do órgão. Exemplos: tjal, tjba, mppb.", + "name": "orgao", "in": "path", "required": true } @@ -931,14 +731,11 @@ const docTemplate = `{ "200": { "description": "Requisição bem sucedida.", "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/papi.aggregateIndexes" - } + "$ref": "#/definitions/papi.agency" } }, - "500": { - "description": "Erro interno do servidor.", + "404": { + "description": "Órgão não encontrado.", "schema": { "type": "string" } @@ -946,39 +743,23 @@ const docTemplate = `{ } } }, - "/v2/indices/{ano}/{mes}": { + "/v2/orgaos": { "get": { - "description": "Busca as informações de índices de todos os órgãos para um ano e um mês específicos", + "description": "Busca todos os órgãos disponíveis.", "produces": [ "application/json" ], "tags": [ "public_api" ], - "operationId": "GetAggregateIndexesWithParams", - "parameters": [ - { - "type": "integer", - "description": "Ano.", - "name": "ano", - "in": "path", - "required": true - }, - { - "type": "integer", - "description": "Mês.", - "name": "mes", - "in": "path", - "required": true - } - ], + "operationId": "GetAllAgencies", "responses": { "200": { "description": "Requisição bem sucedida.", "schema": { "type": "array", "items": { - "$ref": "#/definitions/papi.aggregateIndexes" + "$ref": "#/definitions/papi.agency" } } }, @@ -1022,6 +803,10 @@ const docTemplate = `{ "description": "Agencys's ombudsman url", "type": "string" }, + "possui_dados": { + "description": "If there is data from that agency", + "type": "boolean" + }, "twitter_handle": { "description": "Agency's twitter handle", "type": "string" @@ -1033,48 +818,121 @@ const docTemplate = `{ "url": { "description": "Link for state url", "type": "string" - }, - "possui_dados": { - "description": "If there is data from that agency", - "type": "boolean" } } }, - "papi.allAgencyInformation": { + "papi.aggregateIndexes": { "type": "object", "properties": { + "agregado": { + "description": "Aggregate indices", + "allOf": [ + { + "$ref": "#/definitions/papi.score" + } + ] + }, + "detalhe": { + "description": "All agency indices", + "type": "array", + "items": { + "$ref": "#/definitions/papi.indexInformation" + } + }, "id_orgao": { - "description": "'trt13'", + "description": "e.g. 'trt13'", "type": "string" + } + } + }, + "papi.aggregateIndexesByGroup": { + "type": "object", + "properties": { + "conselhos-de-justica": { + "type": "array", + "items": { + "$ref": "#/definitions/papi.aggregateIndexes" + } }, - "nome": { - "description": "'Tribunal Regional do Trabalho 13° Região'", - "type": "string" + "justica-do-trabalho": { + "type": "array", + "items": { + "$ref": "#/definitions/papi.aggregateIndexes" + } }, - "jurisdicao": { - "description": "'Estadual', 'Eleitroral', 'Militar', etc.", - "type": "string" + "justica-eleitoral": { + "type": "array", + "items": { + "$ref": "#/definitions/papi.aggregateIndexes" + } }, - "entidade": { - "description": "'Tribunal', 'Ministério' or 'Conselho'.", - "type": "string" + "justica-estadual": { + "type": "array", + "items": { + "$ref": "#/definitions/papi.aggregateIndexes" + } }, - "uf": { - "description": "Short code for federative unity.", - "type": "string" + "justica-federal": { + "type": "array", + "items": { + "$ref": "#/definitions/papi.aggregateIndexes" + } + }, + "justica-militar": { + "type": "array", + "items": { + "$ref": "#/definitions/papi.aggregateIndexes" + } + }, + "justica-superior": { + "type": "array", + "items": { + "$ref": "#/definitions/papi.aggregateIndexes" + } }, + "ministerios-publicos": { + "type": "array", + "items": { + "$ref": "#/definitions/papi.aggregateIndexes" + } + } + } + }, + "papi.allAgencyInformation": { + "type": "object", + "properties": { "coletando": { "type": "array", "items": { "$ref": "#/definitions/papi.collecting" } }, - "url": { - "description": "Link for state url", + "coletas": { + "type": "array", + "items": { + "$ref": "#/definitions/papi.summaryzedMI" + } + }, + "entidade": { + "description": "\"J\" For Judiciário, \"M\" for Ministério Público, \"P\" for Procuradorias and \"D\" for Defensorias.", "type": "string" }, - "twitter_handle": { - "description": "Agency's twitter handle", + "id_orgao": { + "description": "'trt13'", + "type": "string" + }, + "indice_transparencia": { + "$ref": "#/definitions/papi.score" + }, + "jurisdicao": { + "description": "\"R\" for Regional, \"M\" for Municipal, \"F\" for Federal, \"E\" for State.", + "type": "string" + }, + "meses_com_dados": { + "type": "integer" + }, + "nome": { + "description": "'Tribunal Regional do Trabalho 13° Região'", "type": "string" }, "ouvidoria": { @@ -1084,17 +942,17 @@ const docTemplate = `{ "total_coletas_realizadas": { "type": "integer" }, - "meses_com_dados": { - "type": "integer" + "twitter_handle": { + "description": "Agency's twitter handle", + "type": "string" }, - "indice_transparencia": { - "$ref": "#/definitions/papi.score" + "uf": { + "description": "Short code for federative unity.", + "type": "string" }, - "coletas": { - "type": "array", - "items": { - "$ref": "#/definitions/papi.summaryzedMI" - } + "url": { + "description": "Link for state url", + "type": "string" } } }, @@ -1165,6 +1023,35 @@ const docTemplate = `{ } } }, + "papi.indexInformation": { + "type": "object", + "properties": { + "ano": { + "type": "integer" + }, + "indice_transparencia": { + "$ref": "#/definitions/papi.score" + }, + "mes": { + "type": "integer" + }, + "metadados": { + "$ref": "#/definitions/papi.metadata" + } + } + }, + "papi.itemSummary": { + "type": "object", + "properties": { + "auxilio_alimentacao": { + "type": "number" + }, + "outras": { + "description": "valor agregado de outras rubricas não identificadas", + "type": "number" + } + } + }, "papi.metadata": { "type": "object", "properties": { @@ -1242,6 +1129,9 @@ const docTemplate = `{ "papi.summary": { "type": "object", "properties": { + "descontos": { + "$ref": "#/definitions/papi.dataSummary" + }, "outras_remuneracoes": { "$ref": "#/definitions/papi.dataSummary" }, @@ -1251,8 +1141,11 @@ const docTemplate = `{ "remuneracao_base": { "$ref": "#/definitions/papi.dataSummary" }, - "descontos": { + "remuneracoes": { "$ref": "#/definitions/papi.dataSummary" + }, + "resumo_rubricas": { + "$ref": "#/definitions/papi.itemSummary" } } }, @@ -1288,66 +1181,6 @@ const docTemplate = `{ } } }, - "papi.indexInformation": { - "type": "object", - "properties": { - "mes": { - "type": "integer" - }, - "ano": { - "type": "integer" - }, - "indice_transparencia": { - "$ref": "#/definitions/papi.score" - }, - "metadados": { - "$ref": "#/definitions/papi.metadata" - } - } - }, - "papi.aggregateIndexes": { - "type": "object", - "properties": { - "id_orgao": { - "type": "string" - }, - "agregado": { - "$ref": "#/definitions/papi.score" - }, - "detalhe": { - "$ref": "#/definitions/papi.indexInformation" - } - } - }, - "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": { @@ -1377,6 +1210,10 @@ const docTemplate = `{ "description": "Agencys's ombudsman url", "type": "string" }, + "possui_dados": { + "description": "If there is data from that agency", + "type": "boolean" + }, "twitter_handle": { "description": "Agency's twitter handle", "type": "string" @@ -1388,10 +1225,6 @@ const docTemplate = `{ "url": { "description": "Link for state url", "type": "string" - }, - "possui_dados": { - "description": "If there is data from that agency", - "type": "boolean" } } }, @@ -1409,7 +1242,7 @@ const docTemplate = `{ } } }, - "uiapi.agencySalary": { + "uiapi.agencyRemuneration": { "type": "object", "properties": { "histograma": { @@ -1446,6 +1279,15 @@ const docTemplate = `{ "ano": { "type": "integer" }, + "descontos": { + "type": "number" + }, + "descontos_por_membro": { + "type": "number" + }, + "descontos_por_mes": { + "type": "number" + }, "meses_com_dados": { "type": "integer" }, @@ -1455,10 +1297,10 @@ const docTemplate = `{ "outras_remuneracoes": { "type": "number" }, - "outras_remuneracoes_por_mes": { + "outras_remuneracoes_por_membro": { "type": "number" }, - "outras_remuneracoes_por_membro": { + "outras_remuneracoes_por_mes": { "type": "number" }, "package": { @@ -1467,20 +1309,23 @@ const docTemplate = `{ "remuneracao_base": { "type": "number" }, - "remuneracao_base_por_mes": { + "remuneracao_base_por_membro": { "type": "number" }, - "remuneracao_base_por_membro": { + "remuneracao_base_por_mes": { "type": "number" }, - "descontos": { + "remuneracoes": { "type": "number" }, - "descontos_por_mes": { + "remuneracoes_por_membro": { "type": "number" }, - "descontos_por_membro": { + "remuneracoes_por_mes": { "type": "number" + }, + "resumo_rubricas": { + "$ref": "#/definitions/uiapi.itemSummary" } } }, @@ -1534,9 +1379,24 @@ const docTemplate = `{ } } }, + "uiapi.itemSummary": { + "type": "object", + "properties": { + "auxilio_alimentacao": { + "type": "number" + }, + "outras": { + "description": "valor agregado de outras rubricas não identificadas", + "type": "number" + } + } + }, "uiapi.mensalRemuneration": { "type": "object", "properties": { + "descontos": { + "type": "number" + }, "mes": { "type": "integer" }, @@ -1549,8 +1409,11 @@ const docTemplate = `{ "remuneracao_base": { "type": "number" }, - "descontos": { + "remuneracoes": { "type": "number" + }, + "resumo_rubricas": { + "$ref": "#/definitions/uiapi.itemSummary" } } }, @@ -1688,13 +1551,19 @@ const docTemplate = `{ "uiapi.v2AgencySummary": { "type": "object", "properties": { + "descontos": { + "type": "number" + }, + "max_descontos": { + "type": "number" + }, "max_outras_remuneracoes": { "type": "number" }, - "max_remuneracao_base": { + "max_remuneracao": { "type": "number" }, - "max_descontos": { + "max_remuneracao_base": { "type": "number" }, "orgao": { @@ -1706,8 +1575,8 @@ const docTemplate = `{ "remuneracao_base": { "type": "number" }, - "descontos": { - "type": "number" + "resumo_rubricas": { + "$ref": "#/definitions/uiapi.itemSummary" }, "tem_anterior": { "type": "boolean" @@ -1749,6 +1618,12 @@ const docTemplate = `{ "uiapi.v2MonthTotals": { "type": "object", "properties": { + "descontos": { + "type": "number" + }, + "descontos_por_membro": { + "type": "number" + }, "error": { "$ref": "#/definitions/uiapi.procError" }, @@ -1767,12 +1642,15 @@ const docTemplate = `{ "remuneracao_base_por_membro": { "type": "number" }, - "descontos": { + "remuneracoes": { "type": "number" }, - "descontos_por_membro": { + "remuneracoes_por_membro": { "type": "number" }, + "resumo_rubricas": { + "$ref": "#/definitions/uiapi.itemSummary" + }, "timestamp": { "$ref": "#/definitions/uiapi.timestamp" }, @@ -1805,6 +1683,8 @@ var SwaggerInfo = &swag.Spec{ Description: "", InfoInstanceName: "swagger", SwaggerTemplate: docTemplate, + LeftDelim: "{{", + RightDelim: "}}", } func init() { diff --git a/docs/swagger.json b/docs/swagger.json index c72c57e..f0dd204 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -278,7 +278,7 @@ "200": { "description": "Requisição bem sucedida.", "schema": { - "$ref": "#/definitions/uiapi.agencySalary" + "$ref": "#/definitions/uiapi.agencyRemuneration" } }, "206": { @@ -619,58 +619,23 @@ } } }, - "/v2/orgao/{orgao}": { - "get": { - "description": "Busca um órgão específico utilizando seu ID.", - "produces": [ - "application/json" - ], - "tags": [ - "public_api" - ], - "operationId": "GetAgencyById", - "parameters": [ - { - "type": "string", - "description": "ID do órgão. Exemplos: tjal, tjba, mppb.", - "name": "orgao", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "Requisição bem sucedida.", - "schema": { - "$ref": "#/definitions/papi.agency" - } - }, - "404": { - "description": "Órgão não encontrado.", - "schema": { - "type": "string" - } - } - } - } - }, - "/v2/orgaos": { + "/v2/indice": { "get": { - "description": "Busca todos os órgãos disponíveis.", + "description": "Busca as informações de índices de todos os órgãos.", "produces": [ "application/json" ], "tags": [ "public_api" ], - "operationId": "GetAllAgencies", + "operationId": "GetAggregateIndexes", "responses": { "200": { "description": "Requisição bem sucedida.", "schema": { "type": "array", "items": { - "$ref": "#/definitions/papi.agency" + "$ref": "#/definitions/papi.aggregateIndexesByGroup" } } }, @@ -695,19 +660,15 @@ "operationId": "GetAggregateIndexesWithParams", "parameters": [ { - "enum": [ - "grupo", - "orgao" - ], "type": "string", - "description": "Tipo de parâmetro.", + "description": "'grupo' ou 'orgao'", "name": "param", "in": "path", "required": true }, { "type": "string", - "description": "jurisdição ou ID do órgão", + "description": "Jurisdição ou ID do órgao", "name": "valor", "in": "path", "required": true @@ -738,181 +699,21 @@ } } }, - "/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.", - "produces": [ - "application/json" - ], - "tags": [ - "public_api" - ], - "operationId": "GetAggregateIndexesWithParams", - "parameters": [ - { - "enum": [ - "grupo", - "orgao" - ], - "type": "string", - "description": "Tipo de parâmetro.", - "name": "param", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "jurisdição ou ID do órgão", - "name": "valor", - "in": "path", - "required": true - }, - { - "type": "integer", - "description": "Ano", - "name": "ano", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "Requisição bem sucedida.", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/papi.aggregateIndexes" - } - } - }, - "400": { - "description": "Requisição inválida.", - "schema": { - "type": "string" - } - }, - "500": { - "description": "Erro interno do servidor.", - "schema": { - "type": "string" - } - } - } - } - }, - "/v2/indice/{param}/{valor}/{ano}/{mes}": { + "/v2/orgao/{orgao}": { "get": { - "description": "Busca as informações de índices de um grupo ou órgão específico para o ano e mês informados.", + "description": "Busca um órgão específico utilizando seu ID.", "produces": [ "application/json" ], "tags": [ "public_api" ], - "operationId": "GetAggregateIndexesWithParams", + "operationId": "GetAgencyById", "parameters": [ - { - "enum": [ - "grupo", - "orgao" - ], - "type": "string", - "description": "Tipo de parâmetro.", - "name": "param", - "in": "path", - "required": true - }, { "type": "string", - "description": "jurisdição ou ID do órgão", - "name": "valor", - "in": "path", - "required": true - }, - { - "type": "integer", - "description": "Ano", - "name": "ano", - "in": "path", - "required": true - }, - { - "type": "integer", - "description": "Mês", - "name": "mes", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "Requisição bem sucedida.", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/papi.aggregateIndexes" - } - } - }, - "400": { - "description": "Requisição inválida.", - "schema": { - "type": "string" - } - }, - "500": { - "description": "Erro interno do servidor.", - "schema": { - "type": "string" - } - } - } - } - }, - "/v2/indice": { - "get": { - "description": "Busca as informações de índices de todos os órgãos", - "produces": [ - "application/json" - ], - "tags": [ - "public_api" - ], - "operationId": "GetAggregateIndexes", - "responses": { - "200": { - "description": "Requisição bem sucedida.", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/papi.aggregateIndexesByGroup" - } - } - }, - "500": { - "description": "Erro interno do servidor.", - "schema": { - "type": "string" - } - } - } - } - }, - "/v2/indices/{ano}": { - "get": { - "description": "Busca as informações de índices de todos os órgãos para um ano específico", - "produces": [ - "application/json" - ], - "tags": [ - "public_api" - ], - "operationId": "GetAggregateIndexesWithParams", - "parameters": [ - { - "type": "integer", - "description": "Ano.", - "name": "ano", + "description": "ID do órgão. Exemplos: tjal, tjba, mppb.", + "name": "orgao", "in": "path", "required": true } @@ -921,14 +722,11 @@ "200": { "description": "Requisição bem sucedida.", "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/papi.aggregateIndexes" - } + "$ref": "#/definitions/papi.agency" } }, - "500": { - "description": "Erro interno do servidor.", + "404": { + "description": "Órgão não encontrado.", "schema": { "type": "string" } @@ -936,39 +734,23 @@ } } }, - "/v2/indices/{ano}/{mes}": { + "/v2/orgaos": { "get": { - "description": "Busca as informações de índices de todos os órgãos para um ano e um mês específicos", + "description": "Busca todos os órgãos disponíveis.", "produces": [ "application/json" ], "tags": [ "public_api" ], - "operationId": "GetAggregateIndexesWithParams", - "parameters": [ - { - "type": "integer", - "description": "Ano.", - "name": "ano", - "in": "path", - "required": true - }, - { - "type": "integer", - "description": "Mês.", - "name": "mes", - "in": "path", - "required": true - } - ], + "operationId": "GetAllAgencies", "responses": { "200": { "description": "Requisição bem sucedida.", "schema": { "type": "array", "items": { - "$ref": "#/definitions/papi.aggregateIndexes" + "$ref": "#/definitions/papi.agency" } } }, @@ -1012,6 +794,10 @@ "description": "Agencys's ombudsman url", "type": "string" }, + "possui_dados": { + "description": "If there is data from that agency", + "type": "boolean" + }, "twitter_handle": { "description": "Agency's twitter handle", "type": "string" @@ -1023,48 +809,121 @@ "url": { "description": "Link for state url", "type": "string" - }, - "possui_dados": { - "description": "If there is data from that agency", - "type": "boolean" } } }, - "papi.allAgencyInformation": { + "papi.aggregateIndexes": { "type": "object", "properties": { + "agregado": { + "description": "Aggregate indices", + "allOf": [ + { + "$ref": "#/definitions/papi.score" + } + ] + }, + "detalhe": { + "description": "All agency indices", + "type": "array", + "items": { + "$ref": "#/definitions/papi.indexInformation" + } + }, "id_orgao": { - "description": "'trt13'", + "description": "e.g. 'trt13'", "type": "string" + } + } + }, + "papi.aggregateIndexesByGroup": { + "type": "object", + "properties": { + "conselhos-de-justica": { + "type": "array", + "items": { + "$ref": "#/definitions/papi.aggregateIndexes" + } }, - "nome": { - "description": "'Tribunal Regional do Trabalho 13° Região'", - "type": "string" + "justica-do-trabalho": { + "type": "array", + "items": { + "$ref": "#/definitions/papi.aggregateIndexes" + } }, - "jurisdicao": { - "description": "'Estadual', 'Eleitroral', 'Militar', etc.", - "type": "string" + "justica-eleitoral": { + "type": "array", + "items": { + "$ref": "#/definitions/papi.aggregateIndexes" + } }, - "entidade": { - "description": "'Tribunal', 'Ministério' or 'Conselho'.", - "type": "string" + "justica-estadual": { + "type": "array", + "items": { + "$ref": "#/definitions/papi.aggregateIndexes" + } }, - "uf": { - "description": "Short code for federative unity.", - "type": "string" + "justica-federal": { + "type": "array", + "items": { + "$ref": "#/definitions/papi.aggregateIndexes" + } + }, + "justica-militar": { + "type": "array", + "items": { + "$ref": "#/definitions/papi.aggregateIndexes" + } + }, + "justica-superior": { + "type": "array", + "items": { + "$ref": "#/definitions/papi.aggregateIndexes" + } }, + "ministerios-publicos": { + "type": "array", + "items": { + "$ref": "#/definitions/papi.aggregateIndexes" + } + } + } + }, + "papi.allAgencyInformation": { + "type": "object", + "properties": { "coletando": { "type": "array", "items": { "$ref": "#/definitions/papi.collecting" } }, - "url": { - "description": "Link for state url", + "coletas": { + "type": "array", + "items": { + "$ref": "#/definitions/papi.summaryzedMI" + } + }, + "entidade": { + "description": "\"J\" For Judiciário, \"M\" for Ministério Público, \"P\" for Procuradorias and \"D\" for Defensorias.", "type": "string" }, - "twitter_handle": { - "description": "Agency's twitter handle", + "id_orgao": { + "description": "'trt13'", + "type": "string" + }, + "indice_transparencia": { + "$ref": "#/definitions/papi.score" + }, + "jurisdicao": { + "description": "\"R\" for Regional, \"M\" for Municipal, \"F\" for Federal, \"E\" for State.", + "type": "string" + }, + "meses_com_dados": { + "type": "integer" + }, + "nome": { + "description": "'Tribunal Regional do Trabalho 13° Região'", "type": "string" }, "ouvidoria": { @@ -1074,17 +933,17 @@ "total_coletas_realizadas": { "type": "integer" }, - "meses_com_dados": { - "type": "integer" + "twitter_handle": { + "description": "Agency's twitter handle", + "type": "string" }, - "indice_transparencia": { - "$ref": "#/definitions/papi.score" + "uf": { + "description": "Short code for federative unity.", + "type": "string" }, - "coletas": { - "type": "array", - "items": { - "$ref": "#/definitions/papi.summaryzedMI" - } + "url": { + "description": "Link for state url", + "type": "string" } } }, @@ -1155,6 +1014,35 @@ } } }, + "papi.indexInformation": { + "type": "object", + "properties": { + "ano": { + "type": "integer" + }, + "indice_transparencia": { + "$ref": "#/definitions/papi.score" + }, + "mes": { + "type": "integer" + }, + "metadados": { + "$ref": "#/definitions/papi.metadata" + } + } + }, + "papi.itemSummary": { + "type": "object", + "properties": { + "auxilio_alimentacao": { + "type": "number" + }, + "outras": { + "description": "valor agregado de outras rubricas não identificadas", + "type": "number" + } + } + }, "papi.metadata": { "type": "object", "properties": { @@ -1232,6 +1120,9 @@ "papi.summary": { "type": "object", "properties": { + "descontos": { + "$ref": "#/definitions/papi.dataSummary" + }, "outras_remuneracoes": { "$ref": "#/definitions/papi.dataSummary" }, @@ -1241,8 +1132,11 @@ "remuneracao_base": { "$ref": "#/definitions/papi.dataSummary" }, - "descontos": { + "remuneracoes": { "$ref": "#/definitions/papi.dataSummary" + }, + "resumo_rubricas": { + "$ref": "#/definitions/papi.itemSummary" } } }, @@ -1278,66 +1172,6 @@ } } }, - "papi.indexInformation": { - "type": "object", - "properties": { - "mes": { - "type": "integer" - }, - "ano": { - "type": "integer" - }, - "indice_transparencia": { - "$ref": "#/definitions/papi.score" - }, - "metadados": { - "$ref": "#/definitions/papi.metadata" - } - } - }, - "papi.aggregateIndexes": { - "type": "object", - "properties": { - "id_orgao": { - "type": "string" - }, - "agregado": { - "$ref": "#/definitions/papi.score" - }, - "detalhe": { - "$ref": "#/definitions/papi.indexInformation" - } - } - }, - "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": { @@ -1367,6 +1201,10 @@ "description": "Agencys's ombudsman url", "type": "string" }, + "possui_dados": { + "description": "If there is data from that agency", + "type": "boolean" + }, "twitter_handle": { "description": "Agency's twitter handle", "type": "string" @@ -1378,10 +1216,6 @@ "url": { "description": "Link for state url", "type": "string" - }, - "possui_dados": { - "description": "If there is data from that agency", - "type": "boolean" } } }, @@ -1399,7 +1233,7 @@ } } }, - "uiapi.agencySalary": { + "uiapi.agencyRemuneration": { "type": "object", "properties": { "histograma": { @@ -1436,6 +1270,15 @@ "ano": { "type": "integer" }, + "descontos": { + "type": "number" + }, + "descontos_por_membro": { + "type": "number" + }, + "descontos_por_mes": { + "type": "number" + }, "meses_com_dados": { "type": "integer" }, @@ -1445,10 +1288,10 @@ "outras_remuneracoes": { "type": "number" }, - "outras_remuneracoes_por_mes": { + "outras_remuneracoes_por_membro": { "type": "number" }, - "outras_remuneracoes_por_membro": { + "outras_remuneracoes_por_mes": { "type": "number" }, "package": { @@ -1457,20 +1300,23 @@ "remuneracao_base": { "type": "number" }, - "remuneracao_base_por_mes": { + "remuneracao_base_por_membro": { "type": "number" }, - "remuneracao_base_por_membro": { + "remuneracao_base_por_mes": { "type": "number" }, - "descontos": { + "remuneracoes": { "type": "number" }, - "descontos_por_mes": { + "remuneracoes_por_membro": { "type": "number" }, - "descontos_por_membro": { + "remuneracoes_por_mes": { "type": "number" + }, + "resumo_rubricas": { + "$ref": "#/definitions/uiapi.itemSummary" } } }, @@ -1524,9 +1370,24 @@ } } }, + "uiapi.itemSummary": { + "type": "object", + "properties": { + "auxilio_alimentacao": { + "type": "number" + }, + "outras": { + "description": "valor agregado de outras rubricas não identificadas", + "type": "number" + } + } + }, "uiapi.mensalRemuneration": { "type": "object", "properties": { + "descontos": { + "type": "number" + }, "mes": { "type": "integer" }, @@ -1539,8 +1400,11 @@ "remuneracao_base": { "type": "number" }, - "descontos": { + "remuneracoes": { "type": "number" + }, + "resumo_rubricas": { + "$ref": "#/definitions/uiapi.itemSummary" } } }, @@ -1678,13 +1542,19 @@ "uiapi.v2AgencySummary": { "type": "object", "properties": { + "descontos": { + "type": "number" + }, + "max_descontos": { + "type": "number" + }, "max_outras_remuneracoes": { "type": "number" }, - "max_remuneracao_base": { + "max_remuneracao": { "type": "number" }, - "max_descontos": { + "max_remuneracao_base": { "type": "number" }, "orgao": { @@ -1696,8 +1566,8 @@ "remuneracao_base": { "type": "number" }, - "descontos": { - "type": "number" + "resumo_rubricas": { + "$ref": "#/definitions/uiapi.itemSummary" }, "tem_anterior": { "type": "boolean" @@ -1739,6 +1609,12 @@ "uiapi.v2MonthTotals": { "type": "object", "properties": { + "descontos": { + "type": "number" + }, + "descontos_por_membro": { + "type": "number" + }, "error": { "$ref": "#/definitions/uiapi.procError" }, @@ -1757,12 +1633,15 @@ "remuneracao_base_por_membro": { "type": "number" }, - "descontos": { + "remuneracoes": { "type": "number" }, - "descontos_por_membro": { + "remuneracoes_por_membro": { "type": "number" }, + "resumo_rubricas": { + "$ref": "#/definitions/uiapi.itemSummary" + }, "timestamp": { "$ref": "#/definitions/uiapi.timestamp" }, diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 5f44b1a..556ea67 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -3,27 +3,28 @@ definitions: properties: coletando: items: - $ref: "#/definitions/papi.collecting" + $ref: '#/definitions/papi.collecting' type: array entidade: - description: - '"J" For Judiciário, "M" for Ministério Público, "P" for Procuradorias + description: '"J" For Judiciário, "M" for Ministério Público, "P" for Procuradorias and "D" for Defensorias.' type: string id_orgao: - description: "'trt13'" + description: '''trt13''' type: string jurisdicao: - description: - '"R" for Regional, "M" for Municipal, "F" for Federal, "E" for + description: '"R" for Regional, "M" for Municipal, "F" for Federal, "E" for State.' type: string nome: - description: "'Tribunal Regional do Trabalho 13° Região'" + description: '''Tribunal Regional do Trabalho 13° Região''' type: string ouvidoria: description: Agencys's ombudsman url type: string + possui_dados: + description: If there is data from that agency + type: boolean twitter_handle: description: Agency's twitter handle type: string @@ -33,35 +34,84 @@ definitions: url: description: Link for state url type: string - possui_dados: - description: If there is data from that agency - type: boolean + type: object + papi.aggregateIndexes: + properties: + agregado: + allOf: + - $ref: '#/definitions/papi.score' + description: Aggregate indices + detalhe: + description: All agency indices + items: + $ref: '#/definitions/papi.indexInformation' + type: array + id_orgao: + description: e.g. 'trt13' + type: string + type: object + papi.aggregateIndexesByGroup: + properties: + conselhos-de-justica: + items: + $ref: '#/definitions/papi.aggregateIndexes' + type: array + justica-do-trabalho: + items: + $ref: '#/definitions/papi.aggregateIndexes' + type: array + justica-eleitoral: + items: + $ref: '#/definitions/papi.aggregateIndexes' + type: array + justica-estadual: + items: + $ref: '#/definitions/papi.aggregateIndexes' + type: array + justica-federal: + items: + $ref: '#/definitions/papi.aggregateIndexes' + type: array + justica-militar: + items: + $ref: '#/definitions/papi.aggregateIndexes' + type: array + justica-superior: + items: + $ref: '#/definitions/papi.aggregateIndexes' + type: array + ministerios-publicos: + items: + $ref: '#/definitions/papi.aggregateIndexes' + type: array type: object papi.allAgencyInformation: properties: coletando: items: - $ref: "#/definitions/papi.collecting" + $ref: '#/definitions/papi.collecting' type: array coletas: items: - $ref: "#/definitions/papi.summaryzedMI" + $ref: '#/definitions/papi.summaryzedMI' type: array entidade: - description: '"Tribunal", "Ministério" or "Conselho".' + description: '"J" For Judiciário, "M" for Ministério Público, "P" for Procuradorias + and "D" for Defensorias.' type: string id_orgao: - description: "'trt13'" + description: '''trt13''' type: string indice_transparencia: - $ref: "#/definitions/papi.score" + $ref: '#/definitions/papi.score' jurisdicao: - description: '"Estadual", "Eleitroral", "Militar", etc.' + description: '"R" for Regional, "M" for Municipal, "F" for Federal, "E" for + State.' type: string meses_com_dados: type: integer nome: - description: 'ex.: "Tribunal Regional do Trabalho 13° Região".' + description: '''Tribunal Regional do Trabalho 13° Região''' type: string ouvidoria: description: Agencys's ombudsman url @@ -122,6 +172,25 @@ definitions: total: type: number type: object + papi.indexInformation: + properties: + ano: + type: integer + indice_transparencia: + $ref: '#/definitions/papi.score' + mes: + type: integer + metadados: + $ref: '#/definitions/papi.metadata' + type: object + papi.itemSummary: + properties: + auxilio_alimentacao: + type: number + outras: + description: valor agregado de outras rubricas não identificadas + type: number + type: object papi.metadata: properties: acesso: @@ -168,104 +237,70 @@ definitions: papi.summaries: properties: membros_ativos: - $ref: "#/definitions/papi.summary" + $ref: '#/definitions/papi.summary' type: object papi.summary: properties: + descontos: + $ref: '#/definitions/papi.dataSummary' outras_remuneracoes: - $ref: "#/definitions/papi.dataSummary" + $ref: '#/definitions/papi.dataSummary' quantidade: type: integer remuneracao_base: - $ref: "#/definitions/papi.dataSummary" - descontos: - $ref: "#/definitions/papi.dataSummary" + $ref: '#/definitions/papi.dataSummary' + remuneracoes: + $ref: '#/definitions/papi.dataSummary' + resumo_rubricas: + $ref: '#/definitions/papi.itemSummary' type: object papi.summaryzedMI: properties: ano: type: integer dados_coleta: - $ref: "#/definitions/papi.collect" + $ref: '#/definitions/papi.collect' error: - $ref: "#/definitions/papi.miError" + $ref: '#/definitions/papi.miError' id_orgao: type: string indice_transparencia: - $ref: "#/definitions/papi.score" + $ref: '#/definitions/papi.score' mes: type: integer metadados: - $ref: "#/definitions/papi.metadata" + $ref: '#/definitions/papi.metadata' pacote_de_dados: - $ref: "#/definitions/papi.backup" + $ref: '#/definitions/papi.backup' sumarios: - $ref: "#/definitions/papi.summaries" - type: object - papi.indexInformation: - properties: - mes: - type: integer - ano: - type: integer - indice_transparencia: - $ref: "#/definitions/papi.score" - metadados: - $ref: "#/definitions/papi.metadata" - type: object - papi.aggregateIndexes: - properties: - id_orgao: - type: string - agregado: - $ref: "#/definitions/papi.score" - 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" + $ref: '#/definitions/papi.summaries' type: object uiapi.agency: properties: coletando: items: - $ref: "#/definitions/uiapi.collecting" + $ref: '#/definitions/uiapi.collecting' type: array entidade: - description: - '"J" For Judiciário, "M" for Ministério Público, "P" for Procuradorias + description: '"J" For Judiciário, "M" for Ministério Público, "P" for Procuradorias and "D" for Defensorias.' type: string id_orgao: - description: "'trt13'" + description: '''trt13''' type: string jurisdicao: - description: - '"R" for Regional, "M" for Municipal, "F" for Federal, "E" for + description: '"R" for Regional, "M" for Municipal, "F" for Federal, "E" for State.' type: string nome: - description: "'Tribunal Regional do Trabalho 13° Região'" + description: '''Tribunal Regional do Trabalho 13° Região''' type: string ouvidoria: description: Agencys's ombudsman url type: string + possui_dados: + description: If there is data from that agency + type: boolean twitter_handle: description: Agency's twitter handle type: string @@ -285,7 +320,7 @@ definitions: name: type: string type: object - uiapi.agencySalary: + uiapi.agencyRemuneration: properties: histograma: additionalProperties: @@ -294,45 +329,53 @@ definitions: max_salario: type: number package: - $ref: "#/definitions/uiapi.backup" + $ref: '#/definitions/uiapi.backup' type: object uiapi.annualSummary: properties: dados_anuais: items: - $ref: "#/definitions/uiapi.annualSummaryData" + $ref: '#/definitions/uiapi.annualSummaryData' type: array orgao: - $ref: "#/definitions/uiapi.agency" + $ref: '#/definitions/uiapi.agency' type: object uiapi.annualSummaryData: properties: ano: type: integer + descontos: + type: number + descontos_por_membro: + type: number + descontos_por_mes: + type: number meses_com_dados: type: integer num_membros: type: integer outras_remuneracoes: type: number - outras_remuneracoes_por_mes: - type: number outras_remuneracoes_por_membro: type: number + outras_remuneracoes_por_mes: + type: number package: - $ref: "#/definitions/uiapi.backup" + $ref: '#/definitions/uiapi.backup' remuneracao_base: type: number - remuneracao_base_por_mes: - type: number remuneracao_base_por_membro: type: number - descontos: + remuneracao_base_por_mes: type: number - descontos_por_mes: + remuneracoes: type: number - descontos_por_membro: + remuneracoes_por_membro: type: number + remuneracoes_por_mes: + type: number + resumo_rubricas: + $ref: '#/definitions/uiapi.itemSummary' type: object uiapi.backup: properties: @@ -342,9 +385,6 @@ definitions: type: integer url: type: string - possui_dados: - description: If there is data from that agency - type: boolean type: object uiapi.collecting: properties: @@ -370,8 +410,18 @@ definitions: remuneracao_total: type: number type: object + uiapi.itemSummary: + properties: + auxilio_alimentacao: + type: number + outras: + description: valor agregado de outras rubricas não identificadas + type: number + type: object uiapi.mensalRemuneration: properties: + descontos: + type: number mes: type: integer num_membros: @@ -380,8 +430,10 @@ definitions: type: number remuneracao_base: type: number - descontos: + remuneracoes: type: number + resumo_rubricas: + $ref: '#/definitions/uiapi.itemSummary' type: object uiapi.procError: properties: @@ -421,7 +473,7 @@ definitions: type: integer result: items: - $ref: "#/definitions/uiapi.searchResult" + $ref: '#/definitions/uiapi.searchResult' type: array search_limit: type: integer @@ -453,7 +505,7 @@ definitions: properties: agency: items: - $ref: "#/definitions/uiapi.agencyBasic" + $ref: '#/definitions/uiapi.agencyBasic' type: array flagURL: type: string @@ -471,11 +523,15 @@ definitions: type: object uiapi.v2AgencySummary: properties: + descontos: + type: number + max_descontos: + type: number max_outras_remuneracoes: type: number - max_remuneracao_base: + max_remuneracao: type: number - max_descontos: + max_remuneracao_base: type: number orgao: type: string @@ -483,14 +539,14 @@ definitions: type: number remuneracao_base: type: number - descontos: - type: number + resumo_rubricas: + $ref: '#/definitions/uiapi.itemSummary' tem_anterior: type: boolean tem_proximo: type: boolean timestamp: - $ref: "#/definitions/uiapi.timestamp" + $ref: '#/definitions/uiapi.timestamp' total_membros: type: integer total_remuneracao: @@ -502,17 +558,21 @@ definitions: type: integer meses: items: - $ref: "#/definitions/uiapi.v2MonthTotals" + $ref: '#/definitions/uiapi.v2MonthTotals' type: array orgao: - $ref: "#/definitions/uiapi.agency" + $ref: '#/definitions/uiapi.agency' package: - $ref: "#/definitions/uiapi.backup" + $ref: '#/definitions/uiapi.backup' type: object uiapi.v2MonthTotals: properties: + descontos: + type: number + descontos_por_membro: + type: number error: - $ref: "#/definitions/uiapi.procError" + $ref: '#/definitions/uiapi.procError' mes: type: integer outras_remuneracoes: @@ -523,21 +583,23 @@ definitions: type: number remuneracao_base_por_membro: type: number - descontos: + remuneracoes: type: number - descontos_por_membro: + remuneracoes_por_membro: type: number + resumo_rubricas: + $ref: '#/definitions/uiapi.itemSummary' timestamp: - $ref: "#/definitions/uiapi.timestamp" + $ref: '#/definitions/uiapi.timestamp' total_membros: type: integer type: object uiapi.v2ProcInfoResult: properties: proc_info: - $ref: "#/definitions/uiapi.procInfo" + $ref: '#/definitions/uiapi.procInfo' timestamp: - $ref: "#/definitions/uiapi.timestamp" + $ref: '#/definitions/uiapi.timestamp' type: object info: contact: @@ -551,19 +613,19 @@ paths: description: Retorna os dados anuais de um orgão operationId: GetAnnualSummary parameters: - - description: Nome do orgão - in: path - name: orgao - required: true - type: string + - description: Nome do orgão + in: path + name: orgao + required: true + type: string produces: - - application/json + - application/json responses: "200": description: Requisição bem sucedida. schema: items: - $ref: "#/definitions/uiapi.annualSummary" + $ref: '#/definitions/uiapi.annualSummary' type: array "400": description: Parâmetro orgao inválido @@ -574,36 +636,35 @@ paths: schema: type: string tags: - - ui_api + - ui_api /uiapi/v2/download: get: description: Baixa dados referentes a remunerações a partir de filtros operationId: DownloadByUrl parameters: - - description: "Anos a serem pesquisados, separados por virgula. Exemplo: 2018,2019,2020" - in: query - name: anos - type: string - - description: "Meses a serem pesquisados, separados por virgula. Exemplo: 1,2,3" - in: query - name: meses - type: string - - description: - "Orgãos a serem pesquisados, separados por virgula. Exemplo: - tjal,mpal,mppb" - in: query - name: orgaos - type: string - - description: Categorias a serem pesquisadas - enum: - - base - - outras - - descontos - in: query - name: categorias - type: string + - description: 'Anos a serem pesquisados, separados por virgula. Exemplo: 2018,2019,2020' + in: query + name: anos + type: string + - description: 'Meses a serem pesquisados, separados por virgula. Exemplo: 1,2,3' + in: query + name: meses + type: string + - description: 'Orgãos a serem pesquisados, separados por virgula. Exemplo: + tjal,mpal,mppb' + in: query + name: orgaos + type: string + - description: Categorias a serem pesquisadas + enum: + - base + - outras + - descontos + in: query + name: categorias + type: string produces: - - application/json + - application/json responses: "200": description: Arquivo CSV com os dados. @@ -618,27 +679,26 @@ paths: schema: type: string tags: - - ui_api + - ui_api /uiapi/v2/geral/remuneracao/{ano}: get: - description: - Busca os dados, das remunerações de um ano inteiro, agrupados por + description: Busca os dados, das remunerações de um ano inteiro, agrupados por mês. operationId: GetGeneralRemunerationFromYear parameters: - - description: "Ano da remuneração. Exemplos: 2018, 2019, 2020..." - in: path - name: ano - required: true - type: string + - description: 'Ano da remuneração. Exemplos: 2018, 2019, 2020...' + in: path + name: ano + required: true + type: string produces: - - application/json + - application/json responses: "200": description: Requisição bem sucedida. schema: items: - $ref: "#/definitions/uiapi.mensalRemuneration" + $ref: '#/definitions/uiapi.mensalRemuneration' type: array "400": description: Parâmetro ano inválido. @@ -649,76 +709,76 @@ paths: schema: type: string tags: - - ui_api + - ui_api /uiapi/v2/geral/resumo: get: description: Busca e resume os dados das remunerações de todos os anos operationId: GetGeneralSummary produces: - - application/json + - application/json responses: "200": description: Requisição bem sucedida. schema: - $ref: "#/definitions/uiapi.generalSummary" + $ref: '#/definitions/uiapi.generalSummary' "500": description: Erro interno do servidor. schema: type: string tags: - - ui_api + - ui_api /uiapi/v2/orgao/{grupo}: get: description: Busca os órgãos de um determinado grupo. operationId: GetBasicInfoOfType parameters: - - description: Grupo de órgãos - enum: - - justica-eleitoral - - ministerios-publicos - - justica-estadual - - justica-do-trabalho - - justica-federal - - justica-militar - - justica-superior - - conselhos-de-justica - - AC - - AL - - AP - - AM - - BA - - CE - - DF - - ES - - GO - - MA - - MT - - MS - - MG - - PA - - PB - - PR - - PE - - PI - - RJ - - RN - - RS - - RO - - RR - - SC - - SP - - SE - - TO - in: path - name: grupo - type: string + - description: Grupo de órgãos + enum: + - justica-eleitoral + - ministerios-publicos + - justica-estadual + - justica-do-trabalho + - justica-federal + - justica-militar + - justica-superior + - conselhos-de-justica + - AC + - AL + - AP + - AM + - BA + - CE + - DF + - ES + - GO + - MA + - MT + - MS + - MG + - PA + - PB + - PR + - PE + - PI + - RJ + - RN + - RS + - RO + - RR + - SC + - SP + - SE + - TO + in: path + name: grupo + type: string produces: - - application/json + - application/json responses: "200": description: Órgãos do grupo schema: - $ref: "#/definitions/uiapi.state" + $ref: '#/definitions/uiapi.state' "400": description: Parâmetro inválido schema: @@ -728,34 +788,34 @@ paths: schema: type: string tags: - - ui_api + - ui_api /uiapi/v2/orgao/resumo/{orgao}/{ano}/{mes}: get: description: Resume os dados de remuneração mensal de um órgão. operationId: GetSummaryOfAgency parameters: - - description: "ID do órgão. Exemplos: tjal, tjba, mppb." - in: path - name: orgao - required: true - type: string - - description: "Ano da remuneração. Exemplo: 2018." - in: path - name: ano - required: true - type: integer - - description: "Mês da remuneração. Exemplo: 1." - in: path - name: mes - required: true - type: integer + - description: 'ID do órgão. Exemplos: tjal, tjba, mppb.' + in: path + name: orgao + required: true + type: string + - description: 'Ano da remuneração. Exemplo: 2018.' + in: path + name: ano + required: true + type: integer + - description: 'Mês da remuneração. Exemplo: 1.' + in: path + name: mes + required: true + type: integer produces: - - application/json + - application/json responses: "200": description: Requisição bem sucedida. schema: - $ref: "#/definitions/uiapi.v2AgencySummary" + $ref: '#/definitions/uiapi.v2AgencySummary' "400": description: Parâmetro ano, mês ou nome do órgão são inválidos. schema: @@ -765,108 +825,106 @@ paths: schema: type: string tags: - - ui_api + - ui_api /uiapi/v2/orgao/salario/{orgao}/{ano}/{mes}: get: description: Busca dados das remunerações mensais de um órgão. operationId: GetSalaryOfAgencyMonthYear parameters: - - description: "ID do órgão. Exemplos: tjal, tjba, mppb." - in: path - name: orgao - required: true - type: string - - description: "Mês da remuneração. Exemplos: 01, 02, 03..." - in: path - name: mes - required: true - type: string - - description: "Ano da remuneração. Exemplos: 2018, 2019, 2020..." - in: path - name: ano - required: true - type: string + - description: 'ID do órgão. Exemplos: tjal, tjba, mppb.' + in: path + name: orgao + required: true + type: string + - description: 'Mês da remuneração. Exemplos: 01, 02, 03...' + in: path + name: mes + required: true + type: string + - description: 'Ano da remuneração. Exemplos: 2018, 2019, 2020...' + in: path + name: ano + required: true + type: string produces: - - application/json + - application/json responses: "200": description: Requisição bem sucedida. schema: - $ref: "#/definitions/uiapi.agencySalary" + $ref: '#/definitions/uiapi.agencyRemuneration' "206": - description: - Requisição bem sucedida, mas os dados do órgão não foram bem + description: Requisição bem sucedida, mas os dados do órgão não foram bem processados schema: - $ref: "#/definitions/uiapi.v2ProcInfoResult" + $ref: '#/definitions/uiapi.v2ProcInfoResult' "400": description: Parâmetros inválidos. schema: type: string tags: - - ui_api + - ui_api /uiapi/v2/orgao/totais/{orgao}/{ano}: get: description: Busca os dados de remuneração de um órgão em um ano específico. operationId: GetTotalsOfAgencyYear parameters: - - description: "ID do órgão. Exemplos: tjal, tjba, mppb." - in: path - name: orgao - required: true - type: string - - description: "Ano. Exemplo: 2018." - in: path - name: ano - required: true - type: integer + - description: 'ID do órgão. Exemplos: tjal, tjba, mppb.' + in: path + name: orgao + required: true + type: string + - description: 'Ano. Exemplo: 2018.' + in: path + name: ano + required: true + type: integer produces: - - application/json + - application/json responses: "200": description: Requisição bem sucedida. schema: - $ref: "#/definitions/uiapi.v2AgencyTotalsYear" + $ref: '#/definitions/uiapi.v2AgencyTotalsYear' "400": description: Parâmetro ano ou orgao inválido. schema: type: string tags: - - ui_api + - ui_api /uiapi/v2/pesquisar: get: description: Faz uma busca por remunerações a partir de filtros operationId: SearchByUrl parameters: - - description: "Anos a serem pesquisados, separados por virgula. Exemplo: 2018,2019,2020" - in: query - name: anos - type: string - - description: "Meses a serem pesquisados, separados por virgula. Exemplo: 1,2,3" - in: query - name: meses - type: string - - description: - "Orgãos a serem pesquisados, separados por virgula. Exemplo: - tjal,mpal,mppb" - in: query - name: orgaos - type: string - - description: Categorias a serem pesquisadas - enum: - - base - - outras - - descontos - in: query - name: categorias - type: string + - description: 'Anos a serem pesquisados, separados por virgula. Exemplo: 2018,2019,2020' + in: query + name: anos + type: string + - description: 'Meses a serem pesquisados, separados por virgula. Exemplo: 1,2,3' + in: query + name: meses + type: string + - description: 'Orgãos a serem pesquisados, separados por virgula. Exemplo: + tjal,mpal,mppb' + in: query + name: orgaos + type: string + - description: Categorias a serem pesquisadas + enum: + - base + - outras + - descontos + in: query + name: categorias + type: string produces: - - application/json + - application/json responses: "200": description: Requisição bem sucedida. schema: - $ref: "#/definitions/uiapi.searchResponse" + $ref: '#/definitions/uiapi.searchResponse' "400": description: Erro de validação dos parâmetros. schema: @@ -876,53 +934,53 @@ paths: schema: type: string tags: - - ui_api + - ui_api /v2/dados/{orgao}: get: description: Busca todas as informações de um órgão específico. operationId: GetAllAgencyInformation parameters: - - description: órgão - in: path - name: orgao - required: true - type: string + - description: órgão + in: path + name: orgao + required: true + type: string produces: - - application/json + - application/json responses: "200": description: Requisição bem sucedida. schema: - $ref: "#/definitions/papi.allAgencyInformation" + $ref: '#/definitions/papi.allAgencyInformation' "400": description: Requisição inválida. schema: type: string tags: - - public_api + - public_api /v2/dados/{orgao}/{ano}: get: description: Busca os dados mensais de um órgão por ano operationId: GetMonthlyInfosByYear parameters: - - description: Ano - in: path - name: ano - required: true - type: integer - - description: Órgão - in: path - name: orgao - required: true - type: string + - description: Ano + in: path + name: ano + required: true + type: integer + - description: Órgão + in: path + name: orgao + required: true + type: string produces: - - application/json + - application/json responses: "200": description: Requisição bem sucedida schema: items: - $ref: "#/definitions/papi.summaryzedMI" + $ref: '#/definitions/papi.summaryzedMI' type: array "400": description: Parâmetros inválidos @@ -933,34 +991,34 @@ paths: schema: type: string tags: - - public_api + - public_api /v2/dados/{orgao}/{ano}/{mes}: get: description: Busca um dado mensal de um órgão operationId: GetMonthlyInfo parameters: - - description: Ano - in: path - name: ano - required: true - type: integer - - description: Órgão - in: path - name: orgao - required: true - type: string - - description: Mês - in: path - name: mes - required: true - type: integer + - description: Ano + in: path + name: ano + required: true + type: integer + - description: Órgão + in: path + name: orgao + required: true + type: string + - description: Mês + in: path + name: mes + required: true + type: integer produces: - - application/json + - application/json responses: "200": description: Requisição bem sucedida schema: - $ref: "#/definitions/papi.summaryzedMI" + $ref: '#/definitions/papi.summaryzedMI' "400": description: Parâmetros inválidos schema: @@ -970,247 +1028,100 @@ paths: schema: type: string tags: - - public_api - /v2/orgao/{orgao}: - get: - description: Busca um órgão específico utilizando seu ID. - operationId: GetAgencyById - parameters: - - description: "ID do órgão. Exemplos: tjal, tjba, mppb." - in: path - name: orgao - required: true - type: string - produces: - - application/json - responses: - "200": - description: Requisição bem sucedida. - schema: - $ref: "#/definitions/papi.agency" - "404": - description: Órgão não encontrado. - schema: - type: string - tags: - - public_api - /v2/orgaos: + - public_api + /v2/indice: get: - description: Busca todos os órgãos disponíveis. - operationId: GetAllAgencies + description: Busca as informações de índices de todos os órgãos. + operationId: GetAggregateIndexes produces: - - application/json + - application/json responses: "200": description: Requisição bem sucedida. schema: items: - $ref: "#/definitions/papi.agency" + $ref: '#/definitions/papi.aggregateIndexesByGroup' type: array "500": description: Erro interno do servidor. schema: type: string tags: - - public_api - /v2/indice/{param}/{valor}": + - public_api + /v2/indice/{param}/{valor}: get: description: Busca as informações de índices de um grupo ou órgão específico. operationId: GetAggregateIndexesWithParams parameters: - - description: Tipo de parâmetro. - enum: - - grupo, - - orgao, - type: string, - name: param, - in: path, - required: true - - description: jurisdição ou ID do órgão, - type: string, - name: valor, - in: path, - required: true - produces: - - application/json - responses: - "200": - description: Requisição bem sucedida., - schema: - type: array, - items: - $ref: "#/definitions/papi.aggregateIndexes" - "400": - description: Requisição inválida., - schema: - type: string - "500": - description: Erro interno do servidor., - schema: - type: string - tags: - - public_api - /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: GetAggregateIndexesWithParams - parameters: - - description: Tipo de parâmetro. - enum: - - grupo, - - orgao, - type: string, - name: param, - in: path, - required: true - - description: jurisdição ou ID do órgão, - type: string, - name: valor, - in: path, - required: true - - description: Ano, - type: integer, - name: ano, - in: path, - required: true - produces: - - application/json - responses: - "200": - description: Requisição bem sucedida., - schema: - type: array, - items: - $ref: "#/definitions/papi.aggregateIndexes" - "400": - description: Requisição inválida., - schema: - type: string - "500": - description: Erro interno do servidor., - schema: - type: string - tags: - - public_api - /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: GetAggregateIndexesWithParams - parameters: - - description: Tipo de parâmetro. - enum: - - grupo, - - orgao, - type: string, - name: param, - in: path, - required: true - - description: jurisdição ou ID do órgão, - type: string, - name: valor, - in: path, - required: true - - description: Ano, - type: integer, - name: ano, - in: path, - required: true - - description: Mês, - type: integer, - name: mes, - in: path, - required: true + - description: '''grupo'' ou ''orgao''' + in: path + name: param + required: true + type: string + - description: Jurisdição ou ID do órgao + in: path + name: valor + required: true + type: string produces: - - application/json + - application/json responses: "200": - description: Requisição bem sucedida., + description: Requisição bem sucedida. schema: - type: array, items: - $ref: "#/definitions/papi.aggregateIndexes" + $ref: '#/definitions/papi.aggregateIndexes' + type: array "400": - description: Requisição inválida., - schema: - type: string - "500": - description: Erro interno do servidor., + description: Requisição inválida. schema: type: string - tags: - - public_api - /v2/indice: - get: - description: Busca as informações de índices de todos os órgãos. - operationId: GetAggregateIndexes - produces: - - application/json - responses: - "200": - description: Requisição bem sucedida., - schema: - type: array, - items: - $ref: "#/definitions/papi.aggregateIndexes" "500": - description: Erro interno do servidor., + description: Erro interno do servidor. schema: type: string tags: - - public_api - /v2/indices/{ano}: + - public_api + /v2/orgao/{orgao}: get: - description: Busca as informações de índices de todos os órgãos para um ano específico. - operationId: GetAggregateIndexesWithParams + description: Busca um órgão específico utilizando seu ID. + operationId: GetAgencyById parameters: - - description: Ano. - type: string, - name: ano, - in: path, - required: true + - description: 'ID do órgão. Exemplos: tjal, tjba, mppb.' + in: path + name: orgao + required: true + type: string produces: - - application/json + - application/json responses: "200": - description: Requisição bem sucedida., + description: Requisição bem sucedida. schema: - type: array, - items: - $ref: "#/definitions/papi.aggregateIndexes" - "500": - description: Erro interno do servidor., + $ref: '#/definitions/papi.agency' + "404": + description: Órgão não encontrado. schema: type: string tags: - - public_api - /v2/indices/{ano}/{mes}: + - public_api + /v2/orgaos: get: - description: Busca as informações de índices de todos os órgãos para um ano e mês específicos. - operationId: GetAggregateIndexesWithParams - parameters: - - description: Ano. - type: string, - name: ano, - in: path, - required: true - - description: Mês. - type: string, - name: mes, - in: path, - required: true + description: Busca todos os órgãos disponíveis. + operationId: GetAllAgencies produces: - - application/json + - application/json responses: "200": - description: Requisição bem sucedida., + description: Requisição bem sucedida. schema: - type: array, items: - $ref: "#/definitions/papi.aggregateIndexes" + $ref: '#/definitions/papi.agency' + type: array "500": - description: Erro interno do servidor., + description: Erro interno do servidor. schema: type: string tags: - - public_api + - public_api swagger: "2.0" diff --git a/papi/handlers.go b/papi/handlers.go index f2eb82c..3333a77 100644 --- a/papi/handlers.go +++ b/papi/handlers.go @@ -332,6 +332,10 @@ func (h handler) V2GetMonthlyInfo(c echo.Context) error { Average: monthlyInfo.Summary.Remunerations.Average, Total: monthlyInfo.Summary.Remunerations.Total, }, + ItemSummary: itemSummary{ + FoodAllowance: monthlyInfo.Summary.ItemSummary.FoodAllowance, + Others: monthlyInfo.Summary.ItemSummary.Others, + }, }, }, Metadata: &metadata{ @@ -452,6 +456,10 @@ func (h handler) GetMonthlyInfosByYear(c echo.Context) error { Average: mi.Summary.Remunerations.Average, Total: mi.Summary.Remunerations.Total, }, + ItemSummary: itemSummary{ + FoodAllowance: mi.Summary.ItemSummary.FoodAllowance, + Others: mi.Summary.ItemSummary.Others, + }, }, }, Metadata: &metadata{ @@ -662,9 +670,9 @@ func (h handler) V2GetAggregateIndexesWithParams(c echo.Context) error { // @Tags public_api // @Description Busca as informações de índices de todos os órgãos. // @Produce json -// @Success 200 {object} []aggregateIndexesByGroup "Requisição bem sucedida." -// @Failure 500 {string} string "Erro interno do servidor." -// @Router /v2/indice [get] +// @Success 200 {object} []aggregateIndexesByGroup "Requisição bem sucedida." +// @Failure 500 {string} string "Erro interno do servidor." +// @Router /v2/indice [get] func (h handler) V2GetAggregateIndexes(c echo.Context) error { agregado := c.QueryParam("agregado") detalhe := c.QueryParam("detalhe") @@ -827,6 +835,10 @@ func (h handler) V2GetAllAgencyInformation(c echo.Context) error { Average: c.Summary.Remunerations.Average, Total: c.Summary.Remunerations.Total, }, + ItemSummary: itemSummary{ + FoodAllowance: c.Summary.ItemSummary.FoodAllowance, + Others: c.Summary.ItemSummary.Others, + }, }, }, Metadata: &metadata{ diff --git a/papi/models.go b/papi/models.go index 58cc74a..b939fba 100644 --- a/papi/models.go +++ b/papi/models.go @@ -19,6 +19,12 @@ type summary struct { OtherRemunerations dataSummary `json:"outras_remuneracoes,omitempty"` Discounts dataSummary `json:"descontos,omitempty"` Remunerations dataSummary `json:"remuneracoes,omitempty"` + ItemSummary itemSummary `json:"resumo_rubricas,omitempty"` +} + +type itemSummary struct { + FoodAllowance float64 `json:"auxilio_alimentacao,omitempty"` + Others float64 `json:"outras,omitempty"` // valor agregado de outras rubricas não identificadas } type summaries struct { diff --git a/uiapi/handlers.go b/uiapi/handlers.go index e648a65..38c1bd4 100644 --- a/uiapi/handlers.go +++ b/uiapi/handlers.go @@ -122,6 +122,10 @@ func (h handler) V2GetSummaryOfAgency(c echo.Context) error { }, HasNext: time.Date(year, time.Month(month), 1, 0, 0, 0, 0, time.UTC).In(h.loc).Before(time.Now().AddDate(0, 1, 0)), HasPrevious: time.Date(year, time.Month(month), 1, 0, 0, 0, 0, time.UTC).In(h.loc).After(time.Date(2018, 1, 1, 0, 0, 0, 0, time.UTC).In(h.loc)), + ItemSummary: itemSummary{ + FoodAllowance: agencyMonthlyInfo.Summary.ItemSummary.FoodAllowance, + Others: agencyMonthlyInfo.Summary.ItemSummary.Others, + }, } return c.JSON(http.StatusOK, agencySummary) } @@ -174,7 +178,7 @@ func (h handler) GetSalaryOfAgencyMonthYear(c echo.Context) error { // @Param orgao path string true "ID do órgão. Exemplos: tjal, tjba, mppb." // @Param mes path string true "Mês da remuneração. Exemplos: 01, 02, 03..." // @Param ano path string true "Ano da remuneração. Exemplos: 2018, 2019, 2020..." -// @Success 200 {object} agencySalary "Requisição bem sucedida." +// @Success 200 {object} agencyRemuneration "Requisição bem sucedida." // @Success 206 {object} v2ProcInfoResult "Requisição bem sucedida, mas os dados do órgão não foram bem processados" // @Failure 400 {string} string "Parâmetros inválidos." // @Router /uiapi/v2/orgao/salario/{orgao}/{ano}/{mes} [get] @@ -334,6 +338,10 @@ func (h handler) V2GetTotalsOfAgencyYear(c echo.Context) error { Nanos: agencyMonthlyInfo.CrawlingTimestamp.GetNanos(), }, MemberCount: agencyMonthlyInfo.Summary.Count, + ItemSummary: itemSummary{ + FoodAllowance: agencyMonthlyInfo.Summary.ItemSummary.FoodAllowance, + Others: agencyMonthlyInfo.Summary.ItemSummary.Others, + }, } monthTotalsOfYear = append(monthTotalsOfYear, monthTotals) @@ -575,7 +583,7 @@ func (h handler) V2GetGeneralRemunerationFromYear(c echo.Context) error { data, err := h.client.Db.GetGeneralMonthlyInfosFromYear(year) if err != nil { fmt.Println("Error searching for monthly info from year: %w", err) - return c.JSON(http.StatusInternalServerError, fmt.Sprintf("Error buscando dados")) + return c.JSON(http.StatusInternalServerError, "error buscando dados") } annualRemu := []mensalRemuneration{} for _, d := range data { @@ -586,6 +594,10 @@ func (h handler) V2GetGeneralRemunerationFromYear(c echo.Context) error { OtherRemunerations: d.OtherRemunerations, Discounts: d.Discounts, Remunerations: d.Remunerations, + ItemSummary: itemSummary{ + FoodAllowance: d.ItemSummary.FoodAllowance, + Others: d.ItemSummary.Others, + }, }) } return c.JSON(http.StatusOK, annualRemu) @@ -797,6 +809,10 @@ func (h handler) GetAnnualSummary(c echo.Context) error { remPerCapita := s.Remunerations / float64(s.TotalCount) discountsRemPerMonth := s.Discounts / float64(s.NumMonthsWithData) discountsRemPerCapita := s.Discounts / float64(s.TotalCount) + itemSummary := itemSummary{ + FoodAllowance: s.ItemSummary.FoodAllowance, + Others: s.ItemSummary.Others, + } annualData = append(annualData, annualSummaryData{ Year: s.Year, AverageMemberCount: s.AverageCount, @@ -818,6 +834,7 @@ func (h handler) GetAnnualSummary(c echo.Context) error { Hash: s.Package.Hash, Size: s.Package.Size, }, + ItemSummary: itemSummary, }) } var collect []collecting diff --git a/uiapi/models.go b/uiapi/models.go index a04f814..2d72fc3 100644 --- a/uiapi/models.go +++ b/uiapi/models.go @@ -98,19 +98,20 @@ type agencySummary struct { } type v2AgencySummary struct { - Agency string `json:"orgao"` - BaseRemuneration float64 `json:"remuneracao_base"` - MaxBase float64 `json:"max_remuneracao_base"` - OtherRemunerations float64 `json:"outras_remuneracoes"` - MaxOther float64 `json:"max_outras_remuneracoes"` - Discounts float64 `json:"descontos"` - MaxDiscounts float64 `json:"max_descontos"` - MaxRemuneration float64 `json:"max_remuneracao"` - CrawlingTime timestamp `json:"timestamp"` - TotalMembers int `json:"total_membros"` - TotalRemuneration float64 `json:"total_remuneracao"` - HasNext bool `json:"tem_proximo"` - HasPrevious bool `json:"tem_anterior"` + Agency string `json:"orgao"` + BaseRemuneration float64 `json:"remuneracao_base"` + MaxBase float64 `json:"max_remuneracao_base"` + OtherRemunerations float64 `json:"outras_remuneracoes"` + MaxOther float64 `json:"max_outras_remuneracoes"` + Discounts float64 `json:"descontos"` + MaxDiscounts float64 `json:"max_descontos"` + MaxRemuneration float64 `json:"max_remuneracao"` + CrawlingTime timestamp `json:"timestamp"` + TotalMembers int `json:"total_membros"` + TotalRemuneration float64 `json:"total_remuneracao"` + HasNext bool `json:"tem_proximo"` + HasPrevious bool `json:"tem_anterior"` + ItemSummary itemSummary `json:"resumo_rubricas"` } // AgencyTotalsYear - Represents the totals of an year @@ -153,18 +154,19 @@ type monthTotals struct { } type v2MonthTotals struct { - Error *procError `json:"error,omitempty"` - Month int `json:"mes"` - MemberCount int `json:"total_membros"` - BaseRemuneration float64 `json:"remuneracao_base"` - BaseRemunerationPerCapita float64 `json:"remuneracao_base_por_membro"` - OtherRemunerations float64 `json:"outras_remuneracoes"` - OtherRemunerationsPerCapita float64 `json:"outras_remuneracoes_por_membro"` - Discounts float64 `json:"descontos"` - DiscountsPerCapita float64 `json:"descontos_por_membro"` - Remunerations float64 `json:"remuneracoes"` - RemunerationsPerCapita float64 `json:"remuneracoes_por_membro"` - CrawlingTimestamp timestamp `json:"timestamp"` + Error *procError `json:"error,omitempty"` + Month int `json:"mes"` + MemberCount int `json:"total_membros"` + BaseRemuneration float64 `json:"remuneracao_base"` + BaseRemunerationPerCapita float64 `json:"remuneracao_base_por_membro"` + OtherRemunerations float64 `json:"outras_remuneracoes"` + OtherRemunerationsPerCapita float64 `json:"outras_remuneracoes_por_membro"` + Discounts float64 `json:"descontos"` + DiscountsPerCapita float64 `json:"descontos_por_membro"` + Remunerations float64 `json:"remuneracoes"` + RemunerationsPerCapita float64 `json:"remuneracoes_por_membro"` + CrawlingTimestamp timestamp `json:"timestamp"` + ItemSummary itemSummary `json:"resumo_rubricas"` } type timestamp struct { @@ -251,29 +253,36 @@ type annualSummary struct { } type annualSummaryData struct { - Year int `json:"ano,omitempty"` - AverageMemberCount int `json:"num_membros,omitempty"` - BaseRemuneration float64 `json:"remuneracao_base"` - BaseRemunerationPerMonth float64 `json:"remuneracao_base_por_mes"` - BaseRemunerationPerCapita float64 `json:"remuneracao_base_por_membro"` - OtherRemunerations float64 `json:"outras_remuneracoes"` - OtherRemunerationsPerMonth float64 `json:"outras_remuneracoes_por_mes"` - OtherRemunerationsPerCapita float64 `json:"outras_remuneracoes_por_membro"` - Discounts float64 `json:"descontos"` - DiscountsPerMonth float64 `json:"descontos_por_mes"` - DiscountsPerCapita float64 `json:"descontos_por_membro"` - Remunerations float64 `json:"remuneracoes"` - RemunerationsPerMonth float64 `json:"remuneracoes_por_mes"` - RemunerationsPerCapita float64 `json:"remuneracoes_por_membro"` - NumMonthsWithData int `json:"meses_com_dados"` - Package *backup `json:"package,omitempty"` + Year int `json:"ano,omitempty"` + AverageMemberCount int `json:"num_membros,omitempty"` + BaseRemuneration float64 `json:"remuneracao_base"` + BaseRemunerationPerMonth float64 `json:"remuneracao_base_por_mes"` + BaseRemunerationPerCapita float64 `json:"remuneracao_base_por_membro"` + OtherRemunerations float64 `json:"outras_remuneracoes"` + OtherRemunerationsPerMonth float64 `json:"outras_remuneracoes_por_mes"` + OtherRemunerationsPerCapita float64 `json:"outras_remuneracoes_por_membro"` + Discounts float64 `json:"descontos"` + DiscountsPerMonth float64 `json:"descontos_por_mes"` + DiscountsPerCapita float64 `json:"descontos_por_membro"` + Remunerations float64 `json:"remuneracoes"` + RemunerationsPerMonth float64 `json:"remuneracoes_por_mes"` + RemunerationsPerCapita float64 `json:"remuneracoes_por_membro"` + NumMonthsWithData int `json:"meses_com_dados"` + Package *backup `json:"package,omitempty"` + ItemSummary itemSummary `json:"resumo_rubricas"` +} + +type itemSummary struct { + FoodAllowance float64 `json:"auxilio_alimentacao,omitempty"` + Others float64 `json:"outras,omitempty"` // valor agregado de outras rubricas não identificadas } type mensalRemuneration struct { - Month int `json:"mes,omitempty"` - Members int `json:"num_membros,omitempty"` - BaseRemuneration float64 `json:"remuneracao_base"` - OtherRemunerations float64 `json:"outras_remuneracoes"` - Discounts float64 `json:"descontos"` - Remunerations float64 `json:"remuneracoes"` + Month int `json:"mes,omitempty"` + Members int `json:"num_membros,omitempty"` + BaseRemuneration float64 `json:"remuneracao_base"` + OtherRemunerations float64 `json:"outras_remuneracoes"` + Discounts float64 `json:"descontos"` + Remunerations float64 `json:"remuneracoes"` + ItemSummary itemSummary `json:"resumo_rubricas"` } diff --git a/uiapi/uiapi_test.go b/uiapi/uiapi_test.go index 77b5b64..f730e99 100644 --- a/uiapi/uiapi_test.go +++ b/uiapi/uiapi_test.go @@ -98,7 +98,8 @@ func (g getSummaryOfAgency) testWhenDataExists(t *testing.T) { "total_membros": 214, "total_remuneracao": 7.099024400000013e+06, "tem_proximo": true, - "tem_anterior": true + "tem_anterior": true, + "resumo_rubricas": {} } ` @@ -949,6 +950,10 @@ func (g getGenerealRemunerationFromYear) testWhenDataExists(t *testing.T) { OtherRemunerations: 1000, Discounts: 1000, Remunerations: 10000, + ItemSummary: models.ItemSummary{ + FoodAllowance: 100, + Others: 200, + }, }, { Month: 2, @@ -957,6 +962,10 @@ func (g getGenerealRemunerationFromYear) testWhenDataExists(t *testing.T) { OtherRemunerations: 2000, Discounts: 1000, Remunerations: 21000, + ItemSummary: models.ItemSummary{ + FoodAllowance: 100, + Others: 200, + }, }, } dbMock.EXPECT().Connect().Return(nil).Times(1) @@ -989,7 +998,11 @@ func (g getGenerealRemunerationFromYear) testWhenDataExists(t *testing.T) { "remuneracao_base": 10000, "outras_remuneracoes": 1000, "descontos": 1000, - "remuneracoes": 10000 + "remuneracoes": 10000, + "resumo_rubricas": { + "auxilio_alimentacao": 100, + "outras": 200 + } }, { "mes": 2, @@ -997,7 +1010,11 @@ func (g getGenerealRemunerationFromYear) testWhenDataExists(t *testing.T) { "remuneracao_base": 20000, "outras_remuneracoes": 2000, "descontos": 1000, - "remuneracoes": 21000 + "remuneracoes": 21000, + "resumo_rubricas": { + "auxilio_alimentacao": 100, + "outras": 200 + } } ] ` @@ -1149,7 +1166,8 @@ func (g getTotalsOfAgencyYear) testWhenDataExists(t *testing.T) { "seconds": 1, "nanos": 1 }, - "total_membros": 214 + "total_membros": 214, + "resumo_rubricas": {} } ], "package": { @@ -1293,6 +1311,10 @@ func (g getAnnualSummary) testWhenDataExists(t *testing.T) { Hash: "4d7ca8986101673aea060ac1d8e5a529", Size: 30195, }, + ItemSummary: models.ItemSummary{ + FoodAllowance: 100, + Others: 200, + }, }, } dbMock.EXPECT().Connect().Return(nil).Times(1) @@ -1352,7 +1374,11 @@ func (g getAnnualSummary) testWhenDataExists(t *testing.T) { "url": "https://dadosjusbr.org/download/tjal/datapackage/tjal-2020-1.zip", "hash": "4d7ca8986101673aea060ac1d8e5a529", "size": 30195 - } + }, + "resumo_rubricas": { + "auxilio_alimentacao": 100, + "outras": 200 + } } ] } From 175024f58ba7a90f4a9211bd7637e7d70d6d40d2 Mon Sep 17 00:00:00 2001 From: Joellensilva Date: Wed, 10 Jan 2024 13:28:01 -0300 Subject: [PATCH 2/2] atualizando storage --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 968fe05..c91626b 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.18 require ( github.com/dadosjusbr/proto v0.0.0-20221212025627-91c60aa3cd12 - github.com/dadosjusbr/storage v0.0.0-20231106132314-7063d34ebc2d + github.com/dadosjusbr/storage v0.0.0-20240109194919-e8fa5bdec162 github.com/gocarina/gocsv v0.0.0-20220712153207-8b2118da4570 github.com/golang/mock v1.6.0 github.com/joho/godotenv v1.4.0 diff --git a/go.sum b/go.sum index 7731afc..f84f17b 100644 --- a/go.sum +++ b/go.sum @@ -38,6 +38,8 @@ github.com/dadosjusbr/storage v0.0.0-20230711162749-e2d2c0a916f0 h1:zR5+0WcgvH4W github.com/dadosjusbr/storage v0.0.0-20230711162749-e2d2c0a916f0/go.mod h1:ttc45wBL5bjz5uU24mgNNPV9ZHaJ3SmoRwVOmyVRZyY= github.com/dadosjusbr/storage v0.0.0-20231106132314-7063d34ebc2d h1:vU6hL1gxD9fvKIXMqdUMvZLu5aApKW2NfYzlOywA7KQ= github.com/dadosjusbr/storage v0.0.0-20231106132314-7063d34ebc2d/go.mod h1:JTg/Wu2+wn9SV1J19dDeEronive9J6QelMA7K6vLO8I= +github.com/dadosjusbr/storage v0.0.0-20240109194919-e8fa5bdec162 h1:adRnuhh3Lvk4YClkZl3KRJYln3XmFr+ElGBArQt86LI= +github.com/dadosjusbr/storage v0.0.0-20240109194919-e8fa5bdec162/go.mod h1:PszGy6CDoG3kNLjIsCmwD3MAWED7xL7U/OWj7ajsiHc= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=