Sha256: 5df440a255917ddb6db514f087a366e00192de8494982e5cdb5033df072eeff3

Contents?: true

Size: 785 Bytes

Versions: 19

Compression:

Stored size: 785 Bytes

Contents

module Shipit
  module Api
    class LocksController < BaseController
      require_permission :lock, :stack

      params do
        requires :reason, String, presence: true
      end
      def create
        if stack.locked?
          render json: {message: 'Already locked'}, status: :conflict
        else
          stack.update(lock_reason: params.reason, lock_author: current_user)
          render_resource stack
        end
      end

      params do
        requires :reason, String, presence: true
      end
      def update
        stack.update(lock_reason: params.reason, lock_author: current_user)
        render_resource stack
      end

      def destroy
        stack.update(lock_reason: nil, lock_author: nil)
        render_resource stack
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
shipit-engine-0.11.0 app/controllers/shipit/api/locks_controller.rb
shipit-engine-0.10.0 app/controllers/shipit/api/locks_controller.rb
shipit-engine-0.9.0 app/controllers/shipit/api/locks_controller.rb
shipit-engine-0.8.9 app/controllers/shipit/api/locks_controller.rb
shipit-engine-0.8.8 app/controllers/shipit/api/locks_controller.rb
shipit-engine-0.8.7 app/controllers/shipit/api/locks_controller.rb
shipit-engine-0.8.6 app/controllers/shipit/api/locks_controller.rb
shipit-engine-0.8.5 app/controllers/shipit/api/locks_controller.rb
shipit-engine-0.8.4 app/controllers/shipit/api/locks_controller.rb
shipit-engine-0.8.3 app/controllers/shipit/api/locks_controller.rb
shipit-engine-0.8.2 app/controllers/shipit/api/locks_controller.rb
shipit-engine-0.8.1 app/controllers/shipit/api/locks_controller.rb
shipit-engine-0.8.0 app/controllers/shipit/api/locks_controller.rb
shipit-engine-0.7.0 app/controllers/shipit/api/locks_controller.rb
shipit-engine-0.6.4 app/controllers/shipit/api/locks_controller.rb
shipit-engine-0.6.3 app/controllers/shipit/api/locks_controller.rb
shipit-engine-0.6.2 app/controllers/shipit/api/locks_controller.rb
shipit-engine-0.6.1 app/controllers/shipit/api/locks_controller.rb
shipit-engine-0.6.0 app/controllers/shipit/api/locks_controller.rb