Skip to content

Commit

Permalink
Merge branch 'main' into update_testdb
Browse files Browse the repository at this point in the history
  • Loading branch information
rowanseymour committed Sep 12, 2023
2 parents cb120b8 + 1b46d4e commit b59dea3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
v8.3.16 (2023-09-12)
-------------------------
* Stop reading ContactURN.auth and remove from model

v8.3.15 (2023-09-11)
-------------------------
* Start reading and writing ContactURN.auth_tokens
Expand Down
11 changes: 5 additions & 6 deletions core/models/contacts.go
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,6 @@ type ContactURN struct {
Scheme string `json:"scheme" db:"scheme"`
Path string `json:"path" db:"path"`
Display null.String `json:"display" db:"display"`
Auth null.String `json:"auth" db:"auth"`
AuthTokens null.Map[string] `json:"auth_tokens" db:"auth_tokens"`
ChannelID ChannelID `json:"channel_id" db:"channel_id"`
}
Expand Down Expand Up @@ -872,7 +871,7 @@ func insertContactAndURNs(ctx context.Context, db DBorTx, orgID OrgID, userID Us
func URNForURN(ctx context.Context, db Queryer, oa *OrgAssets, u urns.URN) (urns.URN, error) {
urn := &ContactURN{}
rows, err := db.QueryContext(ctx,
`SELECT row_to_json(r) FROM (SELECT id, scheme, path, display, auth, auth_tokens, channel_id, priority FROM contacts_contacturn WHERE identity = $1 AND org_id = $2) r;`,
`SELECT row_to_json(r) FROM (SELECT id, scheme, path, display, auth_tokens, channel_id, priority FROM contacts_contacturn WHERE identity = $1 AND org_id = $2) r;`,
u.Identity(), oa.OrgID(),
)
if err != nil {
Expand Down Expand Up @@ -932,7 +931,7 @@ func GetOrCreateURN(ctx context.Context, db DBorTx, oa *OrgAssets, contactID Con
func URNForID(ctx context.Context, db Queryer, oa *OrgAssets, urnID URNID) (urns.URN, error) {
urn := &ContactURN{}
rows, err := db.QueryContext(ctx,
`SELECT row_to_json(r) FROM (SELECT id, scheme, path, display, auth, auth_tokens, channel_id, priority FROM contacts_contacturn WHERE id = $1) r;`,
`SELECT row_to_json(r) FROM (SELECT id, scheme, path, display, auth_tokens, channel_id, priority FROM contacts_contacturn WHERE id = $1) r;`,
urnID,
)
if err != nil {
Expand Down Expand Up @@ -1091,7 +1090,7 @@ UPDATE contacts_contact
WHERE id = $1`

const sqlSelectURNsByID = `
SELECT id, org_id, contact_id, identity, priority, scheme, path, display, auth, auth_tokens, channel_id
SELECT id, org_id, contact_id, identity, priority, scheme, path, display, auth_tokens, channel_id
FROM contacts_contacturn
WHERE id = ANY($1)`

Expand Down Expand Up @@ -1317,8 +1316,8 @@ WHERE

const sqlInsertContactURN = `
INSERT INTO
contacts_contacturn(contact_id, identity, path, display, auth, auth_tokens, scheme, priority, org_id)
VALUES(:contact_id, :identity, :path, :display, :auth, :auth_tokens, :scheme, :priority, :org_id)
contacts_contacturn(contact_id, identity, path, display, auth_tokens, scheme, priority, org_id)
VALUES(:contact_id, :identity, :path, :display, :auth_tokens, :scheme, :priority, :org_id)
ON CONFLICT(identity, org_id)
DO
UPDATE
Expand Down

0 comments on commit b59dea3

Please sign in to comment.