Create communication creation events for non-compliance reports
This commit is contained in:
parent
b4ae9e5a95
commit
66dc3a171e
1 changed files with 10 additions and 0 deletions
|
|
@ -6,6 +6,7 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"math/big"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
|
|
@ -433,6 +434,7 @@ func publicReportCreate(ctx context.Context, setter_report modelpublicreport.Rep
|
|||
|
||||
// Only create communication entries for compliance when they're submitted
|
||||
report_type := setter_report.ReportType
|
||||
var comm_id int
|
||||
if report_type != modelpublicreport.Reporttype_Compliance {
|
||||
comm := model.Communication{
|
||||
Created: time.Now(),
|
||||
|
|
@ -450,6 +452,7 @@ func publicReportCreate(ctx context.Context, setter_report modelpublicreport.Rep
|
|||
return result, fmt.Errorf("insert communication: %w", err)
|
||||
}
|
||||
log.Debug().Int32("id", comm.ID).Msg("inserted new communication")
|
||||
comm_id = int(comm.ID)
|
||||
}
|
||||
|
||||
if err := txn.Commit(ctx); err != nil {
|
||||
|
|
@ -461,6 +464,13 @@ func publicReportCreate(ctx context.Context, setter_report modelpublicreport.Rep
|
|||
organization_id,
|
||||
result.PublicID,
|
||||
)
|
||||
if report_type != modelpublicreport.Reporttype_Compliance && comm_id != 0 {
|
||||
event.Created(
|
||||
event.TypeCommunication,
|
||||
organization_id,
|
||||
strconv.Itoa(comm_id),
|
||||
)
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
func publicReportUpdateAddressID(ctx context.Context, txn db.Tx, report *modelpublicreport.Report, address types.Address) error {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue