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

Migrate OauthToken from Sequel to AR #15840

Merged
merged 14 commits into from
Sep 21, 2020

Conversation

amiedes
Copy link
Contributor

@amiedes amiedes commented Sep 17, 2020

Story details: https://app.clubhouse.io/cartoteam/story/104097

What does this PR do?

Migrates ::OauthToken, ::AccessToken and ::RequestToken from Sequel to ActiveRecord

Main issues faced

Check https://app.clubhouse.io/cartoteam/story/104097/migrate-oauthtoken-from-sequel-to-ar#activity-105485

@amiedes amiedes marked this pull request as ready for review September 17, 2020 10:11
Copy link
Contributor

@rafatower rafatower left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

add_association_dependencies :oauth_tokens => :destroy
def tokens
Carto::OauthToken.where(client_application_id: id)
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏 👏 on cutting those associations.

Probably ClientApplication should be the next one to target.

@@ -0,0 +1,386 @@
class UserMetadataExportFactory

def self.full_export(params = {})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OMG 😄

client_application = carto_user.client_application

access_token = Carto::AccessToken.create(:user => carto_user, :client_application => client_application)
access_token.present?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor thing: I think the test does nothing if it is nil (it will fail later) unless you write something like expect(access_token.present?).to be true

Copy link
Contributor

@thedae thedae left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

The oob? method is used from the gem, and the name of the tokens association is also hardcoded there
@amiedes amiedes merged commit 892eba5 into master Sep 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants