25 lines
598 B
Ruby
25 lines
598 B
Ruby
# frozen_string_literal: true
|
|
|
|
class Api::V1::Statuses::PinsController < Api::BaseController
|
|
include Authorization
|
|
|
|
before_action -> { doorkeeper_authorize! :write, :'write:accounts' }
|
|
before_action :require_user!
|
|
before_action :set_status
|
|
|
|
def create
|
|
PinService.new.call(current_account, @status)
|
|
render json: @status, serializer: REST::StatusSerializer
|
|
end
|
|
|
|
def destroy
|
|
UnpinService.new.call(current_account, @status)
|
|
render json: @status, serializer: REST::StatusSerializer
|
|
end
|
|
|
|
private
|
|
|
|
def set_status
|
|
@status = Status.find(params[:status_id])
|
|
end
|
|
end
|