FarmBot/Farmbot-Web-App

View on GitHub
app/mutations/sensors/update.rb

Summary

Maintainability
A
0 mins
Test Coverage
module Sensors
  class Update < Mutations::Command
    required { model :sensor, class: Sensor }

    optional do
      integer :pin
      string :label
      integer :mode, in: CeleryScriptSettingsBag::ALLOWED_PIN_MODES
    end

    def execute
      sensor.update!(inputs.except(:sensor))
      sensor
    end
  end
end