From 15f2a4d1d1f4e5c162a82bf967d6a22ed0a8fff3 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Fri, 13 Sep 2024 23:31:27 +0300 Subject: [PATCH] Limit data returned by halfnarp-friendly endpoint --- app/controllers/api/events_controller.rb | 1 - app/views/api/events/halfnarp_friendly.jbuilder | 13 +++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 app/views/api/events/halfnarp_friendly.jbuilder diff --git a/app/controllers/api/events_controller.rb b/app/controllers/api/events_controller.rb index ac7f0a8..fca1450 100644 --- a/app/controllers/api/events_controller.rb +++ b/app/controllers/api/events_controller.rb @@ -9,6 +9,5 @@ class Api::EventsController < Api::ApplicationController def halfnarp_friendly @events = current_conference.events.joins(:proposition).includes(:track, :event_type).where.not(propositions: {status: :rejected}) - render json: @events, include: [:track, :event_type] end end diff --git a/app/views/api/events/halfnarp_friendly.jbuilder b/app/views/api/events/halfnarp_friendly.jbuilder new file mode 100644 index 0000000..649d246 --- /dev/null +++ b/app/views/api/events/halfnarp_friendly.jbuilder @@ -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