24 lines
624 B
Ruby
24 lines
624 B
Ruby
# Copyright (C) 2024 Manuel Bustillo
|
|
|
|
require 'csv'
|
|
|
|
class GuestsController < ApplicationController
|
|
def index
|
|
@guests = Guest.all.includes(:group)
|
|
.joins(:group)
|
|
.order('groups.name' => :asc, name: :asc)
|
|
|
|
render jsonapi: @guests
|
|
end
|
|
|
|
def update
|
|
Guests::UpdateUseCase.new(guest_ids: [params[:id]], params: params.require(:guest).permit(:name)).call
|
|
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
|