Patch up oauth implementation (#560)

This commit is contained in:
Max Wofford
2025-10-03 18:22:37 -04:00
committed by GitHub
parent 15744b3442
commit 5ae07f5643
10 changed files with 156 additions and 1 deletions

View File

@@ -0,0 +1,6 @@
class AddForeignKeysToOauthAccess < ActiveRecord::Migration[8.0]
def change
add_foreign_key :oauth_access_grants, :users, column: :resource_owner_id
add_foreign_key :oauth_access_tokens, :users, column: :resource_owner_id
end
end

4
db/schema.rb generated
View File

@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[8.0].define(version: 2025_08_21_021751) do
ActiveRecord::Schema[8.0].define(version: 2025_10_03_161836) do
create_schema "pganalyze"
# These are extensions that must be enabled in order to support this database
@@ -584,7 +584,9 @@ ActiveRecord::Schema[8.0].define(version: 2025_08_21_021751) do
add_foreign_key "leaderboard_entries", "users"
add_foreign_key "mailing_addresses", "users"
add_foreign_key "oauth_access_grants", "oauth_applications", column: "application_id"
add_foreign_key "oauth_access_grants", "users", column: "resource_owner_id"
add_foreign_key "oauth_access_tokens", "oauth_applications", column: "application_id"
add_foreign_key "oauth_access_tokens", "users", column: "resource_owner_id"
add_foreign_key "physical_mails", "users"
add_foreign_key "project_repo_mappings", "repositories"
add_foreign_key "project_repo_mappings", "users"

View File

@@ -2,6 +2,14 @@
# development, test). The code here should be idempotent so that it can be executed at any point in every environment.
# The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup).
Doorkeeper::Application.find_or_create_by(
name: "Hackatime Desktop",
redirect_uri: "hackatime://auth/callback",
uid: "BPr5VekIV-xuQ2ZhmxbGaahJ3XVd7gM83pql-HYGYxQ",
scopes: [ "profile" ],
confidential: false,
)
# Only seed test data in development environment
if Rails.env.development?
# Creating test user