Farmbot-Web-App/app/mutations/alerts/create.rb

15 lines
309 B
Ruby

module Alerts
class Create < Mutations::Command
required do
model :device
string :problem_tag, in: Alert::PROBLEM_TAGS
end
def execute
Alert.create!(device: device,
problem_tag: problem_tag,
slug: SecureRandom.uuid)
end
end
end