Skip to content
This repository has been archived by the owner on Jan 4, 2022. It is now read-only.

Commit

Permalink
[aphrodite] Closing #218
Browse files Browse the repository at this point in the history
  • Loading branch information
malev committed Feb 3, 2015
1 parent 06025b2 commit 197f689
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
4 changes: 2 additions & 2 deletions aphrodite/app/controllers/api/v2/documents_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def links
uploader = LinksUploaderService.new(params[:bucket], current_user)
if uploader.valid?
@documents = uploader.call
render :index
render :shared
else
render json: {
error_messages: { files_limit: "Ha excedido el límite de documentos"}
Expand All @@ -41,7 +41,7 @@ def create
uploader = DocumentUploaderService.new(files, current_user)
if uploader.valid?
@documents = uploader.call
render :index
render :shared
else
render json: {error_messages: { files_limit: "Ha excedido el límite de documentos"}}, status: 403
end
Expand Down
19 changes: 19 additions & 0 deletions aphrodite/app/views/api/v2/documents/shared.json.rabl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
collection @documents
attributes :id, :title, :created_at, :percentage, :url

node :counters do |document|
{
people: document.context_cache.fetch('people', []).count,
organizations: document.context_cache.fetch('organizations', []).count,
places: document.context_cache.fetch('places', []).count,
dates: document.context_cache.fetch('dates', []).count
}
end

node :failed do |document|
!document.valid?
end

node :error_messages do |document|
document.errors.messages
end

0 comments on commit 197f689

Please sign in to comment.