Get text messages for a contact and the phone status
Some checks failed
/ golint (push) Failing after 10s

This commit is contained in:
Eli Ribble 2026-05-23 00:47:37 +00:00
parent 5d03ab0844
commit 5b0d009353
No known key found for this signature in database
6 changed files with 86 additions and 5 deletions

View file

@ -19,6 +19,13 @@ func ContactPhoneInsert(ctx context.Context, txn db.Ex, m model.ContactPhone) (m
return db.ExecuteOneTx[model.ContactPhone](ctx, txn, statement)
}
func ContactPhoneFromContactID(ctx context.Context, txn db.Ex, contact_id int64) (model.ContactPhone, error) {
statement := table.ContactPhone.SELECT(
table.ContactPhone.AllColumns,
).FROM(table.ContactPhone).
WHERE(table.ContactPhone.ContactID.EQ(postgres.Int(contact_id)))
return db.ExecuteOneTx[model.ContactPhone](ctx, txn, statement)
}
func ContactPhoneFromE164(ctx context.Context, txn db.Ex, e164 string) (model.ContactPhone, error) {
statement := table.ContactPhone.SELECT(
table.ContactPhone.AllColumns,

View file

@ -28,7 +28,8 @@ func TextLogsFromPhoneNumber(ctx context.Context, txn db.Ex, number string) ([]m
table.TextLog.AllColumns,
).FROM(table.TextLog).
WHERE(table.TextLog.Source.EQ(postgres.String(number)).OR(
table.TextLog.Destination.EQ(postgres.String(number))))
table.TextLog.Destination.EQ(postgres.String(number)))).
ORDER_BY(table.TextLog.Created.DESC())
return db.ExecuteManyTx[model.TextLog](ctx, txn, statement)
}
func TextLogWelcomeFromDestination(ctx context.Context, txn db.Ex, destination string) ([]model.TextLog, error) {