Update reporter contact on report update
This is as a complicated one because it involves merging contact information in tricky cases. I assume that phone should override email, primarily because setting up phones is more tightly regulated. This may be a terrible assumption. Issue: #13
This commit is contained in:
parent
dcce7cda1c
commit
6175e1a811
5 changed files with 139 additions and 30 deletions
|
|
@ -126,3 +126,11 @@ func ReportsFromReporterPhone(ctx context.Context, txn db.Ex, destination string
|
|||
)
|
||||
return db.ExecuteManyTx[model.Report](ctx, txn, statement)
|
||||
}
|
||||
func ReportUpdateReporterContactID(ctx context.Context, txn db.Ex, id int64, contact_id int64) error {
|
||||
statement := table.Report.UPDATE().
|
||||
SET(
|
||||
table.Report.ReporterContactID.SET(postgres.Int(contact_id)),
|
||||
).
|
||||
WHERE(table.Report.ID.EQ(postgres.Int(id)))
|
||||
return db.ExecuteNoneTx(ctx, txn, statement)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue