Emit a created event on signal creation
This commit is contained in:
parent
2c4e7c4f96
commit
429b724cf2
2 changed files with 8 additions and 0 deletions
|
|
@ -88,6 +88,7 @@ const (
|
|||
TypeRMONuisance
|
||||
TypeRMOReport
|
||||
TypeRMOWater
|
||||
TypeSignal
|
||||
)
|
||||
|
||||
func Created(t ResourceType, organization_id int32, uri_id string) {
|
||||
|
|
@ -127,6 +128,8 @@ func resourceString(t ResourceType) string {
|
|||
return "rmo:report"
|
||||
case TypeRMOWater:
|
||||
return "rmo:water"
|
||||
case TypeSignal:
|
||||
return "sync:signal"
|
||||
default:
|
||||
return "unknown"
|
||||
}
|
||||
|
|
@ -141,6 +144,8 @@ func makeURI(t ResourceType, id string) string {
|
|||
return config.MakeURLReport("/report/%s", id)
|
||||
case TypeRMOWater:
|
||||
return config.MakeURLReport("/report/%s", id)
|
||||
case TypeSignal:
|
||||
return config.MakeURLReport("/signal/%s", id)
|
||||
default:
|
||||
return config.MakeURLReport("/unknown")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import (
|
|||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/Gleipnir-Technology/bob"
|
||||
|
|
@ -13,6 +14,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/Gleipnir-Technology/nidus-sync/platform/types"
|
||||
//"github.com/Gleipnir-Technology/nidus-sync/platform/geocode"
|
||||
//"github.com/Gleipnir-Technology/nidus-sync/platform/geom"
|
||||
|
|
@ -118,6 +120,7 @@ func SignalCreateFromPublicreport(ctx context.Context, user User, report_id stri
|
|||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to update report %d: %w", report_id, err)
|
||||
}
|
||||
event.Created(event.TypeSignal, user.Organization.ID(), strconv.Itoa(int(signal.ID)))
|
||||
txn.Commit(ctx)
|
||||
|
||||
return &signal.ID, nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue