mirror of
http://ghproxy.cn/https://github.com/multunus/onemdm-server
synced 2025-12-06 02:04:57 +00:00
Add API installation status update
This commit is contained in:
17
app/admin/app.rb
Normal file
17
app/admin/app.rb
Normal file
@@ -0,0 +1,17 @@
|
||||
ActiveAdmin.register App do
|
||||
permit_params :name, :package_name
|
||||
# See permitted parameters documentation:
|
||||
# https://github.com/activeadmin/activeadmin/blob/master/docs/2-resource-customization.md#setting-up-strong-parameters
|
||||
#
|
||||
# permit_params :list, :of, :attributes, :on, :model
|
||||
#
|
||||
# or
|
||||
#
|
||||
# permit_params do
|
||||
# permitted = [:permitted, :attributes]
|
||||
# permitted << :other if resource.something?
|
||||
# permitted
|
||||
# end
|
||||
|
||||
|
||||
end
|
||||
14
app/controllers/installations_controller.rb
Normal file
14
app/controllers/installations_controller.rb
Normal file
@@ -0,0 +1,14 @@
|
||||
class InstallationsController < ApplicationController
|
||||
before_action :authenticate_device
|
||||
respond_to :json
|
||||
|
||||
def downloaded
|
||||
Installation.find(params[:id]).downloaded!
|
||||
render json:{}, status: :ok
|
||||
end
|
||||
|
||||
def installed
|
||||
Installation.find(params[:id]).installed!
|
||||
render json:{}, status: :ok
|
||||
end
|
||||
end
|
||||
@@ -1,5 +1,7 @@
|
||||
class App < ActiveRecord::Base
|
||||
|
||||
default_scope {order("name")}
|
||||
|
||||
has_many :batch_installations, dependent: :destroy
|
||||
|
||||
validates :name, :package_name, presence: true
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
class Device < ActiveRecord::Base
|
||||
default_scope {order ('id desc')}
|
||||
|
||||
enum status: [:active,:missing,:dead]
|
||||
|
||||
attr_accessor :status
|
||||
|
||||
Reference in New Issue
Block a user