Change Collections API shape (#37580)

This commit is contained in:
David Roetzel authored and GitHub committed 2026-01-23 10:22:37 +00:00
1 parent e12f39aa04
commit de63b61943
12 files changed
+116 -78

No files matched your search

@@ -21,7 +21,7 @@ class Api::V1Alpha::CollectionItemsController < Api::BaseController
@item = AddAccountToCollectionService.new.call(@collection, @account)
render json: @item, serializer: REST::CollectionItemSerializer
render json: @item, serializer: REST::CollectionItemSerializer, adapter: :json
end
def destroy
@@ -28,14 +28,14 @@ class Api::V1Alpha::CollectionsController < Api::BaseController
cache_if_unauthenticated!
authorize Collection, :index?
render json: @collections, each_serializer: REST::BaseCollectionSerializer
render json: @collections, each_serializer: REST::CollectionSerializer, adapter: :json
end
def show
cache_if_unauthenticated!
authorize @collection, :show?
render json: @collection, serializer: REST::CollectionSerializer
render json: @collection, serializer: REST::CollectionWithAccountsSerializer
end
def create
@@ -43,7 +43,7 @@ class Api::V1Alpha::CollectionsController < Api::BaseController
@collection = CreateCollectionService.new.call(collection_creation_params, current_user.account)
render json: @collection, serializer: REST::CollectionSerializer
render json: @collection, serializer: REST::CollectionSerializer, adapter: :json
end
def update
@@ -51,7 +51,7 @@ class Api::V1Alpha::CollectionsController < Api::BaseController
@collection.update!(collection_update_params) # TODO: Create a service for this to federate changes
render json: @collection, serializer: REST::CollectionSerializer
render json: @collection, serializer: REST::CollectionSerializer, adapter: :json
end
def destroy