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"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"math/big"
|
"math/big"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
|
@ -433,6 +434,7 @@ func publicReportCreate(ctx context.Context, setter_report modelpublicreport.Rep
|
||||||
|
|
||||||
// Only create communication entries for compliance when they're submitted
|
// Only create communication entries for compliance when they're submitted
|
||||||
report_type := setter_report.ReportType
|
report_type := setter_report.ReportType
|
||||||
|
var comm_id int
|
||||||
if report_type != modelpublicreport.Reporttype_Compliance {
|
if report_type != modelpublicreport.Reporttype_Compliance {
|
||||||
comm := model.Communication{
|
comm := model.Communication{
|
||||||
Created: time.Now(),
|
Created: time.Now(),
|
||||||
|
|
@ -450,6 +452,7 @@ func publicReportCreate(ctx context.Context, setter_report modelpublicreport.Rep
|
||||||
return result, fmt.Errorf("insert communication: %w", err)
|
return result, fmt.Errorf("insert communication: %w", err)
|
||||||
}
|
}
|
||||||
log.Debug().Int32("id", comm.ID).Msg("inserted new communication")
|
log.Debug().Int32("id", comm.ID).Msg("inserted new communication")
|
||||||
|
comm_id = int(comm.ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := txn.Commit(ctx); err != nil {
|
if err := txn.Commit(ctx); err != nil {
|
||||||
|
|
@ -461,6 +464,13 @@ func publicReportCreate(ctx context.Context, setter_report modelpublicreport.Rep
|
||||||
organization_id,
|
organization_id,
|
||||||
result.PublicID,
|
result.PublicID,
|
||||||
)
|
)
|
||||||
|
if report_type != modelpublicreport.Reporttype_Compliance && comm_id != 0 {
|
||||||
|
event.Created(
|
||||||
|
event.TypeCommunication,
|
||||||
|
organization_id,
|
||||||
|
strconv.Itoa(comm_id),
|
||||||
|
)
|
||||||
|
}
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
func publicReportUpdateAddressID(ctx context.Context, txn db.Tx, report *modelpublicreport.Report, address types.Address) error {
|
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