nidus-sync/platform/communication.go
Eli Ribble 1e071d5ce5
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.
2026-03-18 15:36:20 +00:00

17 lines
467 B
Go

package platform
import (
"context"
"fmt"
"github.com/Gleipnir-Technology/nidus-sync/db/models"
"github.com/Gleipnir-Technology/nidus-sync/platform/publicreport"
)
func NotificationCount(ctx context.Context, org *models.Organization, user *models.User) (result uint, err error) {
count_reports, err := publicreport.ReportsForOrganizationCount(ctx, org.ID)
if err != nil {
return 0, fmt.Errorf("report query: %w", err)
}
return uint(count_reports), nil
}