Move properties of phones to the phone, not contact_phone
This makes sense because there will naturally be cases where multiple districts have the same phone number mapped to different contacts.
This commit is contained in:
parent
f957dc6982
commit
7b04822a9b
14 changed files with 143 additions and 104 deletions
|
|
@ -15,21 +15,17 @@ func EnsureInDB(ctx context.Context, txn db.Ex, contact modelcomms.Contact, dst
|
|||
}
|
||||
func ensureInDB(ctx context.Context, txn db.Ex, contact modelcomms.Contact, destination string) (err error) {
|
||||
contact_phone := modelcomms.ContactPhone{
|
||||
CanSms: true,
|
||||
ConfirmedMessageID: nil,
|
||||
ContactID: contact.ID,
|
||||
E164: destination,
|
||||
IsSubscribed: false,
|
||||
StopMessageID: nil,
|
||||
ContactID: contact.ID,
|
||||
E164: destination,
|
||||
}
|
||||
_, err = querycomms.ContactPhoneInsert(ctx, txn, contact_phone)
|
||||
return err
|
||||
}
|
||||
func ensurePhoneInDB(ctx context.Context, txn db.Ex, number *types.E164) (modelcomms.Phone, error) {
|
||||
return querycomms.PhoneInsertIfNotExists(ctx, txn, modelcomms.Phone{
|
||||
CanSms: false,
|
||||
E164: number.PhoneString(),
|
||||
IsSubscribed: false,
|
||||
Status: modelcomms.Phonestatustype_Unconfirmed,
|
||||
CanSms: false,
|
||||
ConfirmedMessageID: nil,
|
||||
E164: number.PhoneString(),
|
||||
StopMessageID: nil,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue