mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-17 05:34:04 +00:00
API with more options, includes #712
This commit is contained in:
parent
28e55f3f50
commit
ecef151f91
7 changed files with 86 additions and 38 deletions
|
|
@ -1,16 +1,18 @@
|
|||
module Api
|
||||
module V1
|
||||
class SpeakersController < Api::BaseController
|
||||
load_resource :conference, find_by: :short_title
|
||||
respond_to :json
|
||||
|
||||
def index
|
||||
if params[:conference_id].blank?
|
||||
users = User.joins(:event_users)
|
||||
else
|
||||
if @conference
|
||||
users = User.joins(event_users: { event: :conference })
|
||||
users = users.where(conferences: { guid: params[:conference_id] })
|
||||
users = users.where(conferences: { short_title: @conference.short_title })
|
||||
else
|
||||
users = User.joins(:event_users)
|
||||
end
|
||||
users = users.where(event_users: {event_role: :speaker})
|
||||
|
||||
users = users.where(event_users: {event_role: :speaker}).uniq
|
||||
render json: users, each_serializer: SpeakerSerializer
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue