Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop reading ContactURN.auth and remove from model #127

Merged
merged 1 commit into from
Sep 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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