Push update to public report event when reporter is saved

This commit is contained in:
Eli Ribble 2026-03-14 18:14:30 +00:00
parent 1075e35bca
commit 148454d392
No known key found for this signature in database
3 changed files with 69 additions and 17 deletions

View file

@ -11,6 +11,7 @@ import (
"github.com/Gleipnir-Technology/nidus-sync/db"
"github.com/Gleipnir-Technology/nidus-sync/db/enums"
"github.com/Gleipnir-Technology/nidus-sync/db/models"
"github.com/Gleipnir-Technology/nidus-sync/platform/event"
"github.com/rs/zerolog/log"
)
@ -36,5 +37,22 @@ func PublicreportInvalid(ctx context.Context, user User, report_id string) error
}
log.Info().Str("report-id", report_id).Str("tablename", tablename).Msg("Marked as invalid")
resource := resourceTypeFromTablename(tablename)
event.Updated(resource, user.Organization.ID(), report_id)
return nil
}
func PublicReportReporterUpdated(ctx context.Context, org_id int32, report_id string, tablename string) {
resource := resourceTypeFromTablename(tablename)
event.Updated(resource, org_id, report_id)
}
func resourceTypeFromTablename(tablename string) event.ResourceType {
switch tablename {
case "nuisance":
return event.TypeRMONuisance
case "water":
return event.TypeRMOWater
default:
return event.TypeUnknown
}
}