dawarich/app/jobs/owntracks/point_creating_job.rb

17 lines
416 B
Ruby
Raw Normal View History

# frozen_string_literal: true
2024-04-06 13:09:38 -04:00
class Owntracks::PointCreatingJob < ApplicationJob
2025-03-03 16:39:43 -05:00
include PointValidation
2025-05-21 12:57:29 -04:00
queue_as :points
2024-07-04 16:20:12 -04:00
def perform(point_params, user_id)
parsed_params = OwnTracks::Params.new(point_params).call
return if parsed_params[:timestamp].nil? || parsed_params[:lonlat].nil?
return if point_exists?(parsed_params, user_id)
2024-05-25 07:26:56 -04:00
Point.create!(parsed_params.merge(user_id:))
end
end