mirror of
https://github.com/SrIzan10/hc-harbor.git
synced 2026-05-01 10:45:21 +00:00
Add ip address to heartbeats
This commit is contained in:
@@ -61,7 +61,11 @@ class Api::Hackatime::V1::HackatimeController < ApplicationController
|
||||
source_type = :test_entry
|
||||
end
|
||||
|
||||
attrs = heartbeat.merge({ user_id: @user.id, source_type: source_type })
|
||||
attrs = heartbeat.merge({
|
||||
user_id: @user.id,
|
||||
source_type: source_type,
|
||||
ip_address: request.remote_ip
|
||||
})
|
||||
new_heartbeat = Heartbeat.find_or_create_by(attrs)
|
||||
results << [ new_heartbeat.attributes, 201 ]
|
||||
rescue => e
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
class AddIpAddressToHeartbeats < ActiveRecord::Migration[8.0]
|
||||
def change
|
||||
add_column :heartbeats, :ip_address, :inet
|
||||
end
|
||||
end
|
||||
2
db/schema.rb
generated
2
db/schema.rb
generated
@@ -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_03_13_205725) do
|
||||
ActiveRecord::Schema[8.0].define(version: 2025_03_14_153542) do
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "pg_catalog.plpgsql"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user