Fix insertion of communication log entries when marking
This commit is contained in:
parent
57eea3a08a
commit
27596aff20
2 changed files with 6 additions and 2 deletions
|
|
@ -12,8 +12,8 @@ import (
|
|||
|
||||
func CommunicationLogEntryInsert(ctx context.Context, txn db.Tx, m model.CommunicationLogEntry) (model.CommunicationLogEntry, error) {
|
||||
m.Created = time.Now()
|
||||
statement := table.Communication.INSERT(table.Communication.MutableColumns).
|
||||
statement := table.CommunicationLogEntry.INSERT(table.CommunicationLogEntry.MutableColumns).
|
||||
MODEL(m).
|
||||
RETURNING(table.Communication.AllColumns)
|
||||
RETURNING(table.CommunicationLogEntry.AllColumns)
|
||||
return db.ExecuteOne[model.CommunicationLogEntry](ctx, statement)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -191,6 +191,10 @@ func (res *communicationR) markCommunication(ctx context.Context, r *http.Reques
|
|||
public_report = public_reports[0]
|
||||
}
|
||||
|
||||
err = m(ctx, user, int32(comm_id))
|
||||
if err != nil {
|
||||
return communication{}, nhttp.NewError("failed to mark %d: %w", comm_id, err)
|
||||
}
|
||||
log.Info().Int("communication", comm_id).Str("status", status).Msg("Marked communication")
|
||||
return res.hydrateCommunication(*result, &public_report)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue