Skip to content

Commit

Permalink
agency cannot be empty
Browse files Browse the repository at this point in the history
  • Loading branch information
joellensilva committed Feb 12, 2025
1 parent d9f2f97 commit 79dacbd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion repo/database/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,12 @@ func (p *PostgresDB) GetNotices(agency string, year int, month int) ([]*string,
params := []interface{}{}

query := "atual = true AND avisos IS NOT NULL AND id_orgao = ?"
params = append(params, agency)

if agency != "" {
params = append(params, agency)
} else {
return nil, fmt.Errorf("error agency cannot be empty")
}

if year != 0 {
query = query + " AND ano = ?"
Expand Down

0 comments on commit 79dacbd

Please sign in to comment.