mirror of
https://github.com/System-End/hackatime.git
synced 2026-04-20 00:35:22 +00:00
Run rubocop fix
This commit is contained in:
parent
963f3303af
commit
583b8c2f42
5 changed files with 9 additions and 13 deletions
|
|
@ -4,7 +4,7 @@ class Avo::Resources::ApiKey < Avo::BaseResource
|
|||
# self.search = {
|
||||
# query: -> { query.ransack(id_eq: params[:q], m: "or").result(distinct: false) }
|
||||
# }
|
||||
|
||||
|
||||
def fields
|
||||
field :id, as: :id
|
||||
field :user, as: :text
|
||||
|
|
@ -12,5 +12,3 @@ class Avo::Resources::ApiKey < Avo::BaseResource
|
|||
field :token, as: :textarea
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ class Avo::Resources::Heartbeat < Avo::BaseResource
|
|||
# self.search = {
|
||||
# query: -> { query.ransack(id_eq: params[:q], m: "or").result(distinct: false) }
|
||||
# }
|
||||
|
||||
|
||||
def fields
|
||||
field :id, as: :id
|
||||
field :user, as: :text
|
||||
|
|
@ -25,5 +25,3 @@ class Avo::Resources::Heartbeat < Avo::BaseResource
|
|||
field :is_write, as: :boolean
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ class HackatimeController < ApplicationController
|
|||
# the api_key is sent in the Authorization header as a Bearer token
|
||||
api_key = request.headers["Authorization"].split(" ")[1]
|
||||
@user = Hackatime::User.find_by(api_key: api_key)
|
||||
return render json: { error: "Unauthorized" }, status: :unauthorized unless @user
|
||||
render json: { error: "Unauthorized" }, status: :unauthorized unless @user
|
||||
end
|
||||
|
||||
def heartbeat_params
|
||||
|
|
@ -43,4 +43,4 @@ class HackatimeController < ApplicationController
|
|||
:user_agent
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class OneTime::MigrateUserFromHackatimeJob < ApplicationJob
|
|||
lines: heartbeat.lines,
|
||||
cursorpos: heartbeat.cursor_position,
|
||||
project_root_count: heartbeat.project_root_count,
|
||||
is_write: heartbeat.is_write,
|
||||
is_write: heartbeat.is_write
|
||||
} }
|
||||
)
|
||||
end
|
||||
|
|
@ -50,9 +50,9 @@ class OneTime::MigrateUserFromHackatimeJob < ApplicationJob
|
|||
{
|
||||
user_id: @user.id,
|
||||
name: "Imported from Hackatime",
|
||||
token: hackatime_user.api_key,
|
||||
token: hackatime_user.api_key
|
||||
},
|
||||
unique_by: [:user_id, :token]
|
||||
unique_by: [ :user_id, :token ]
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ class CreateApiKeys < ActiveRecord::Migration[8.0]
|
|||
end
|
||||
|
||||
add_index :api_keys, :token, unique: true
|
||||
add_index :api_keys, [:user_id, :token], unique: true
|
||||
add_index :api_keys, [:user_id, :name], unique: true
|
||||
add_index :api_keys, [ :user_id, :token ], unique: true
|
||||
add_index :api_keys, [ :user_id, :name ], unique: true
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue