Limit data returned by halfnarp-friendly endpoint

This commit is contained in:
Petko Bordjukov 2024-09-13 23:31:27 +03:00
parent 7a64633ac0
commit 15f2a4d1d1
2 changed files with 13 additions and 1 deletions

View File

@ -9,6 +9,5 @@ class Api::EventsController < Api::ApplicationController
def halfnarp_friendly def halfnarp_friendly
@events = current_conference.events.joins(:proposition).includes(:track, :event_type).where.not(propositions: {status: :rejected}) @events = current_conference.events.joins(:proposition).includes(:track, :event_type).where.not(propositions: {status: :rejected})
render json: @events, include: [:track, :event_type]
end end
end end

View File

@ -0,0 +1,13 @@
json.array! @events do |event|
json.id event.id
json.title event.title
json.abstract event.abstract
json.track_id event.track_id
json.track do
json.name = event.track.name
end
json.event_type do
json.name event.event_type.name
end
end