mirror of
http://ghproxy.cn/https://github.com/multunus/onemdm-server
synced 2025-12-06 10:14:59 +00:00
Change the app_usages API to accept array of data
- Add foreignkey to device for AppUsage - Rename the route to app_usage from app_usage/create
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
class AppUsage < ActiveRecord::Base
|
||||
validates :package_name, :usage_duration_in_seconds, :used_on, presence: true
|
||||
belongs_to :device
|
||||
end
|
||||
|
||||
@@ -11,6 +11,7 @@ class Device < ActiveRecord::Base
|
||||
|
||||
has_many :heartbeats, dependent: :destroy
|
||||
has_many :installations, dependent: :destroy
|
||||
has_many :app_usages, dependent: :nullify
|
||||
|
||||
scope :active, -> {where("last_heartbeat_recd_time > '#{Time.now.utc - ACTIVE_TIMEFRAME}'")}
|
||||
scope :missing, -> {where("last_heartbeat_recd_time < '#{Time.now.utc - ACTIVE_TIMEFRAME}'AND last_heartbeat_recd_time > '#{Time.now.utc - MISSING_TIMEFRAME}'")}
|
||||
|
||||
Reference in New Issue
Block a user