Fix insertion of communication log entries when marking

This commit is contained in:
Eli Ribble 2026-05-11 22:00:17 +00:00
parent 57eea3a08a
commit 27596aff20
No known key found for this signature in database
2 changed files with 6 additions and 2 deletions

View file

@ -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)
}

View file

@ -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)
}