Farmbot-Web-App/app/controllers/api/sequences_controller.rb

22 lines
519 B
Ruby
Raw Normal View History

module Api
class SequencesController < Api::AbstractController
def index
render json: Sequence.where(user: current_user)
end
def create
mutate Sequences::Create.run(params, user: current_user)
end
2015-01-14 05:53:12 -07:00
def destroy
# TODO: If you touch this again, add a mutation.
seq = Sequence.find(params[:id])
if (seq.user == current_user) && seq.destroy
render nothing: true
else
raise Errors::Forbidden, "Not your Sequence object."
end
end
end
end