Files
fizzy/app/controllers/boards/entropies_controller.rb
T
Rob Zolkos 8c2318e267 Add JSON response format to entropy endpoints (#2673)
* Add JSON response format to entropy endpoints

Add account settings JSON endpoint returning account info including auto_postpone_period. Add auto_postpone_period to board JSON responses. Add JSON update support to both account and board entropy controllers.

* Add auto_postpone_period to all board response examples in API docs

* Use auto_postpone_period_in_days in JSON responses and API docs

* Use valid period values in permission tests
2026-03-10 11:31:00 -04:00

24 lines
550 B
Ruby

class Boards::EntropiesController < ApplicationController
wrap_parameters :board, include: [ :auto_postpone_period_in_days ]
include BoardScoped
before_action :ensure_permission_to_admin_board
def update
@board.update!(entropy_params)
respond_to do |format|
format.turbo_stream
format.json { render "boards/show", status: :ok }
end
rescue ActiveRecord::RecordInvalid
head :unprocessable_entity
end
private
def entropy_params
params.expect(board: [ :auto_postpone_period_in_days ])
end
end