Overhaul publicreport storage layer, create unified tables
This is a huge change. I was getting really sick of the split between nuisance/water tables when more than half of the data they store is common. I finally bit off the big work of switching it all. This creates a single unified table, publicreport.report and copies the existing report data into it. It also ports existing data from the original tables into the new table. Along with all of this I also overhauled the system for handling asynchronous work to use a LISTEN/NOTIFY connection from the database and a single cache table to avoid ever losing work.
This commit is contained in:
parent
2538638c9d
commit
1e071d5ce5
109 changed files with 22903 additions and 11713 deletions
|
|
@ -9,16 +9,9 @@ import (
|
|||
)
|
||||
|
||||
func NotificationCount(ctx context.Context, org *models.Organization, user *models.User) (result uint, err error) {
|
||||
count_nreports, err := publicreport.NuisanceReportForOrganizationCount(ctx, org.ID)
|
||||
count_reports, err := publicreport.ReportsForOrganizationCount(ctx, org.ID)
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("nuisance report query: %w", err)
|
||||
return 0, fmt.Errorf("report query: %w", err)
|
||||
}
|
||||
result += count_nreports
|
||||
|
||||
count_wreports, err := publicreport.WaterReportForOrganizationCount(ctx, org.ID)
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("water report query: %w", err)
|
||||
}
|
||||
result += count_wreports
|
||||
return result, nil
|
||||
return uint(count_reports), nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue