Update storage of reporter in contact

I failed to retrieve the data correctly before as part of the changeover
to contact records.

Issue: #13
This commit is contained in:
Eli Ribble 2026-05-21 16:59:44 +00:00
parent b9f2107c79
commit e3cc1e99d1
No known key found for this signature in database
9 changed files with 132 additions and 50 deletions

View file

@ -60,6 +60,20 @@ func ContactFromID(ctx context.Context, txn db.Ex, id int64) (model.Contact, err
WHERE(table.Contact.ID.EQ(postgres.Int(id)))
return db.ExecuteOne[model.Contact](ctx, statement)
}
func ContactsFromIDs(ctx context.Context, txn db.Ex, contact_ids []int64) ([]model.Contact, error) {
if len(contact_ids) == 0 {
return []model.Contact{}, nil
}
sql_ids := make([]postgres.Expression, len(contact_ids))
for i, contact_id := range contact_ids {
sql_ids[i] = postgres.Int(contact_id)
}
statement := table.Contact.SELECT(
table.Contact.AllColumns,
).FROM(table.Contact).
WHERE(table.Contact.ID.IN(sql_ids...))
return db.ExecuteManyTx[model.Contact](ctx, txn, statement)
}
func ContactUpdateName(ctx context.Context, txn db.Ex, id int64, name string) error {
statement := table.Contact.UPDATE().