23 lines
671 B
Ruby
23 lines
671 B
Ruby
# Copyright (C) 2024 Manuel Bustillo
|
|
|
|
require 'csv'
|
|
|
|
class GuestsController < ApplicationController
|
|
def index
|
|
render json: Guest.all.includes(:group)
|
|
.joins(:group)
|
|
.order('groups.name' => :asc, name: :asc)
|
|
.as_json(only: %i[id name status], include: { group: { only: %i[id name] } })
|
|
end
|
|
|
|
def update
|
|
Guest.find(params[:id]).update!(params.require(:guest).permit(:name))
|
|
render json: {}, status: :ok
|
|
end
|
|
|
|
def bulk_update
|
|
Guests::UpdateUseCase.new(guest_ids: params[:guest_ids], params: params.require(:properties).permit(:status)).call
|
|
render json: {}, status: :ok
|
|
end
|
|
end
|