Update event types to include compliance reports

This commit is contained in:
Eli Ribble 2026-04-13 16:43:15 +00:00
parent 5db4c05544
commit 1a031f16bd
No known key found for this signature in database
4 changed files with 19 additions and 12 deletions

View file

@ -88,8 +88,9 @@ const (
TypeNoteAudio
TypeNoteImage
TypeReviewTask
TypeRMOCompliance
TypeRMONuisance
TypeRMOReport
TypeRMOPublicReport
TypeRMOWater
TypeSession
TypeSignal
@ -141,12 +142,14 @@ func resourceString(t ResourceType) string {
return "sync:note:image"
case TypeReviewTask:
return "sync:review-task"
case TypeRMOCompliance:
return "rmo:publicreport.compliance"
case TypeRMONuisance:
return "rmo:nuisance"
case TypeRMOReport:
return "rmo:report"
return "rmo:publicreport.nuisance"
case TypeRMOPublicReport:
return "rmo:publicreport"
case TypeRMOWater:
return "rmo:water"
return "rmo:publicreport.water"
case TypeSession:
return "sync:session"
case TypeSignal:
@ -165,10 +168,14 @@ func makeURI(t ResourceType, id string) string {
return config.MakeURLNidus("/api/note/%s", id)
case TypeReviewTask:
return config.MakeURLNidus("/api/review/%s", id)
case TypeRMOCompliance:
return config.MakeURLReport("/api/publicreport/compliance/%s", id)
case TypeRMONuisance:
return config.MakeURLReport("/api/report/%s", id)
return config.MakeURLReport("/api/publicreport/nuisance/%s", id)
case TypeRMOPublicReport:
return config.MakeURLReport("/api/publicreport/%s", id)
case TypeRMOWater:
return config.MakeURLReport("/api/report/%s", id)
return config.MakeURLReport("/api/publicrreport/water/%s", id)
case TypeSession:
return config.MakeURLReport("/api/session")
case TypeSignal:

View file

@ -53,7 +53,7 @@ func PublicreportInvalid(ctx context.Context, user User, report_id string) error
})
log.Info().Int32("id", report.ID).Msg("Report marked as invalid")
event.Updated(event.TypeRMOReport, user.Organization.ID, report_id)
event.Updated(event.TypeRMOPublicReport, user.Organization.ID, report_id)
return nil
}
@ -132,7 +132,7 @@ func PublicReportUpdateCompliance(ctx context.Context, report_id string, report_
return publicreport.ByID(ctx, report_id)
}
func PublicReportReporterUpdated(ctx context.Context, org_id int32, report_id string) {
event.Updated(event.TypeRMOReport, org_id, report_id)
event.Updated(event.TypeRMOPublicReport, org_id, report_id)
}
func PublicReportsForOrganization(ctx context.Context, org_id int32) ([]*types.PublicReport, error) {
return publicreport.ReportsForOrganization(ctx, org_id)
@ -287,7 +287,7 @@ func publicReportCreate(ctx context.Context, setter_report models.PublicreportRe
if organization_id != nil {
event.Created(
event.TypeRMONuisance,
event.TypeRMOPublicReport,
*organization_id,
result.PublicID,
)

View file

@ -167,7 +167,7 @@ func sendTextComplete(ctx context.Context, txn bob.Executor, job *models.CommsTe
if err != nil {
return fmt.Errorf("find public report: %w", err)
}
event.Updated(event.TypeRMOReport, report.OrganizationID, report.PublicID)
event.Updated(event.TypeRMOPublicReport, report.OrganizationID, report.PublicID)
} else {
log.Debug().Msg("no report info on text")
}

View file

@ -143,7 +143,7 @@ func respondText(ctx context.Context, txn bob.Executor, log_id int32) error {
Type: omit.From(enums.PublicreportReportlogtypeMessageText),
UserID: omitnull.FromPtr[int32](nil),
}).One(ctx, txn)
event.Updated(event.TypeRMOReport, report.OrganizationID, report.PublicID)
event.Updated(event.TypeRMOPublicReport, report.OrganizationID, report.PublicID)
}
// If humans are involved, wait for them.
if len(reports) > 0 {