From 0796af2331a4243af173fa94b2e8781203ee209b Mon Sep 17 00:00:00 2001 From: Rowan Seymour Date: Tue, 12 Sep 2023 10:38:14 -0500 Subject: [PATCH] Stop reading ContactURN.auth and remove from model --- core/models/contacts.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/core/models/contacts.go b/core/models/contacts.go index 5a63b55f0..4c034f761 100644 --- a/core/models/contacts.go +++ b/core/models/contacts.go @@ -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"` } @@ -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 { @@ -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 { @@ -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)` @@ -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