From fb58d7511cf172973822122ce19a504dd48c77e1 Mon Sep 17 00:00:00 2001 From: Joellensilva Date: Fri, 15 Mar 2024 19:01:53 -0300 Subject: [PATCH] =?UTF-8?q?adicionando=20auxilio-sa=C3=BAde?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- models/summary.go | 1 + repo/database/dto/annuaISummary.go | 2 ++ repo/database/dto/generalMonthlyInfo.go | 3 +++ repo/database/postgres.go | 2 ++ repo/database/postgres_test.go | 7 +++++++ 5 files changed, 15 insertions(+) diff --git a/models/summary.go b/models/summary.go index 239a933..e3c63be 100644 --- a/models/summary.go +++ b/models/summary.go @@ -33,5 +33,6 @@ type ItemSummary struct { VacationCompensation float64 `json:"indenizacao_de_ferias,omitempty"` ChristmasBonus float64 `json:"gratificacao_natalina,omitempty"` CompensatoryLicense float64 `json:"licenca_compensatoria,omitempty"` + HealthAllowance float64 `json:"auxilio_saude,omitempty"` Others float64 `json:"outras,omitempty"` // valor agregado de outras rubricas não identificadas } diff --git a/repo/database/dto/annuaISummary.go b/repo/database/dto/annuaISummary.go index a97fd88..e1ebe10 100644 --- a/repo/database/dto/annuaISummary.go +++ b/repo/database/dto/annuaISummary.go @@ -32,6 +32,7 @@ func NewAnnualSummaryDTO(ami models.AnnualSummary) *AnnualSummaryDTO { VacationCompensation: ami.ItemSummary.VacationCompensation, ChristmasBonus: ami.ItemSummary.ChristmasBonus, CompensatoryLicense: ami.ItemSummary.CompensatoryLicense, + HealthAllowance: ami.ItemSummary.HealthAllowance, Others: ami.ItemSummary.Others, }, } @@ -53,6 +54,7 @@ func (ami *AnnualSummaryDTO) ConvertToModel() *models.AnnualSummary { VacationCompensation: ami.ItemSummary.VacationCompensation, ChristmasBonus: ami.ItemSummary.ChristmasBonus, CompensatoryLicense: ami.ItemSummary.CompensatoryLicense, + HealthAllowance: ami.ItemSummary.HealthAllowance, Others: ami.ItemSummary.Others, }, } diff --git a/repo/database/dto/generalMonthlyInfo.go b/repo/database/dto/generalMonthlyInfo.go index 474c176..c95d665 100644 --- a/repo/database/dto/generalMonthlyInfo.go +++ b/repo/database/dto/generalMonthlyInfo.go @@ -20,6 +20,7 @@ type ItemSummary struct { VacationCompensation float64 `gorm:"column:indenizacao_de_ferias"` ChristmasBonus float64 `gorm:"column:gratificacao_natalina"` CompensatoryLicense float64 `gorm:"column:licenca_compensatoria"` + HealthAllowance float64 `gorm:"column:auxilio_saude"` Others float64 `gorm:"column:outras"` } @@ -37,6 +38,7 @@ func NewGeneralMonthlyInfoDTO(gmi models.GeneralMonthlyInfo) *GeneralMonthlyInfo VacationCompensation: gmi.ItemSummary.VacationCompensation, ChristmasBonus: gmi.ItemSummary.ChristmasBonus, CompensatoryLicense: gmi.ItemSummary.CompensatoryLicense, + HealthAllowance: gmi.ItemSummary.HealthAllowance, Others: gmi.ItemSummary.Others, }, } @@ -56,6 +58,7 @@ func (gmi *GeneralMonthlyInfoDTO) ConvertToModel() *models.GeneralMonthlyInfo { VacationCompensation: gmi.ItemSummary.VacationCompensation, ChristmasBonus: gmi.ItemSummary.ChristmasBonus, CompensatoryLicense: gmi.ItemSummary.CompensatoryLicense, + HealthAllowance: gmi.ItemSummary.HealthAllowance, Others: gmi.ItemSummary.Others, }, } diff --git a/repo/database/postgres.go b/repo/database/postgres.go index 8d833e7..ede5e0f 100644 --- a/repo/database/postgres.go +++ b/repo/database/postgres.go @@ -320,6 +320,7 @@ func (p *PostgresDB) GetAnnualSummary(agency string) ([]models.AnnualSummary, er SUM(CAST(sumario -> 'resumo_rubricas' ->> 'indenizacao_de_ferias' AS DECIMAL)) AS indenizacao_de_ferias, SUM(CAST(sumario -> 'resumo_rubricas' ->> 'gratificacao_natalina' AS DECIMAL)) AS gratificacao_natalina, SUM(CAST(sumario -> 'resumo_rubricas' ->> 'licenca_compensatoria' AS DECIMAL)) AS licenca_compensatoria, + SUM(CAST(sumario -> 'resumo_rubricas' ->> 'auxilio_saude' AS DECIMAL)) AS auxilio_saude, SUM(CAST(sumario -> 'resumo_rubricas' ->> 'outras' AS DECIMAL)) AS outras, COUNT(*) AS meses_com_dados` m := p.db.Model(&dtoAgmi).Select(query) @@ -371,6 +372,7 @@ func (p *PostgresDB) GetGeneralMonthlyInfosFromYear(year int) ([]models.GeneralM SUM(CAST(sumario -> 'resumo_rubricas' ->> 'indenizacao_de_ferias' AS DECIMAL)) AS indenizacao_de_ferias, SUM(CAST(sumario -> 'resumo_rubricas' ->> 'gratificacao_natalina' AS DECIMAL)) AS gratificacao_natalina, SUM(CAST(sumario -> 'resumo_rubricas' ->> 'licenca_compensatoria' AS DECIMAL)) AS licenca_compensatoria, + SUM(CAST(sumario -> 'resumo_rubricas' ->> 'auxilio_saude' AS DECIMAL)) AS auxilio_saude, SUM(CAST(sumario -> 'resumo_rubricas' ->> 'outras' AS DECIMAL)) AS outras` m := p.db.Model(&dtoAgmi).Select(query) m = m.Where("ano = ? AND atual=true AND (procinfo IS NULL OR procinfo::text = 'null')", year) diff --git a/repo/database/postgres_test.go b/repo/database/postgres_test.go index 1671aa6..6d00717 100644 --- a/repo/database/postgres_test.go +++ b/repo/database/postgres_test.go @@ -997,6 +997,7 @@ func (g getAnnualSummary) testWhenMonthlyInfoExists(t *testing.T) { ChristmasBonus: 175, CompensatoryLicense: 75, VacationCompensation: 50, + HealthAllowance: 125, }, }, }, @@ -1053,6 +1054,7 @@ func (g getAnnualSummary) testWhenMonthlyInfoExists(t *testing.T) { VacationCompensation: agmi.Summary.ItemSummary.VacationCompensation + agmi2.Summary.ItemSummary.VacationCompensation, ChristmasBonus: agmi.Summary.ItemSummary.ChristmasBonus + agmi2.Summary.ItemSummary.ChristmasBonus, CompensatoryLicense: agmi.Summary.ItemSummary.CompensatoryLicense + agmi2.Summary.ItemSummary.CompensatoryLicense, + HealthAllowance: agmi.Summary.ItemSummary.HealthAllowance + agmi2.Summary.ItemSummary.HealthAllowance, }, }) } @@ -1079,6 +1081,7 @@ func (g getAnnualSummary) testWhenMonthlyInfoExists(t *testing.T) { assert.Equal(t, amis[1].ItemSummary.VacationCompensation, returnedAmis[1].ItemSummary.VacationCompensation) assert.Equal(t, amis[1].ItemSummary.ChristmasBonus, returnedAmis[1].ItemSummary.ChristmasBonus) assert.Equal(t, amis[1].ItemSummary.CompensatoryLicense, returnedAmis[1].ItemSummary.CompensatoryLicense) + assert.Equal(t, amis[1].ItemSummary.HealthAllowance, returnedAmis[1].ItemSummary.HealthAllowance) truncateTables() } @@ -1239,6 +1242,7 @@ func (g getGeneralMonthlyInfoFromYear) testWhenDataExists(t *testing.T) { VacationCompensation: 50, ChristmasBonus: 75, CompensatoryLicense: 175, + HealthAllowance: 130, }, }, }, @@ -1276,6 +1280,7 @@ func (g getGeneralMonthlyInfoFromYear) testWhenDataExists(t *testing.T) { VacationCompensation: agmi.Summary.ItemSummary.VacationCompensation + agmi2.Summary.ItemSummary.VacationCompensation, ChristmasBonus: agmi.Summary.ItemSummary.ChristmasBonus + agmi2.Summary.ItemSummary.ChristmasBonus, CompensatoryLicense: agmi.Summary.ItemSummary.CompensatoryLicense + agmi2.Summary.ItemSummary.CompensatoryLicense, + HealthAllowance: agmi.Summary.ItemSummary.HealthAllowance + agmi2.Summary.ItemSummary.HealthAllowance, }, }) } @@ -1431,6 +1436,7 @@ func (s store) testWhenDataIsOK(t *testing.T) { VacationCompensation: 125, ChristmasBonus: 175, CompensatoryLicense: 120, + HealthAllowance: 130, Others: 200, }, }, @@ -1499,6 +1505,7 @@ func (s store) testWhenDataIsOK(t *testing.T) { assert.Equal(t, agmi.Summary.ItemSummary.VacationCompensation, result.Summary.ItemSummary.VacationCompensation) assert.Equal(t, agmi.Summary.ItemSummary.ChristmasBonus, result.Summary.ItemSummary.ChristmasBonus) assert.Equal(t, agmi.Summary.ItemSummary.CompensatoryLicense, result.Summary.ItemSummary.CompensatoryLicense) + assert.Equal(t, agmi.Summary.ItemSummary.HealthAllowance, result.Summary.ItemSummary.HealthAllowance) truncateTables() }