gab-social/app/controllers/api/v1/bookmark_collections_contro...

49 lines
1.3 KiB
Ruby
Raw Normal View History

2020-12-16 00:31:30 +00:00
# frozen_string_literal: true
class Api::V1::BookmarkCollectionsController < Api::BaseController
before_action :require_user!
before_action :set_bookmark_collections, only: :index
before_action :set_bookmark_collection, only: [:show, :update, :destroy, :update_status]
2020-12-16 00:31:30 +00:00
def index
render json: @bookmark_collections, each_serializer: REST::StatusBookmarkCollectionSerializer
2020-12-16 00:31:30 +00:00
end
def create
@bookmark_collection = current_account.status_bookmark_collections.create!(resource_params)
render json: @bookmark_collection, serializer: REST::StatusBookmarkCollectionSerializer
2020-12-16 00:31:30 +00:00
end
def show
render json: @bookmark_collection, serializer: REST::StatusBookmarkCollectionSerializer
2020-12-16 00:31:30 +00:00
end
def update
@bookmark_collection.update!(resource_params)
render json: @bookmark_collection, serializer: REST::StatusBookmarkCollectionSerializer
2020-12-16 00:31:30 +00:00
end
def destroy
@bookmark_collection.destroy!
render_empty_success
end
def update_status
#
end
2020-12-16 00:31:30 +00:00
private
def set_bookmark_collections
@bookmark_collections = current_account.status_bookmark_collections
2020-12-16 00:31:30 +00:00
end
def set_bookmark_collection
@bookmark_collection = current_account.status_bookmark_collections.find(params[:id])
2020-12-16 00:31:30 +00:00
end
def resource_params
params.permit(:title)
end
end