2024-10-27 21:42:45 +00:00
|
|
|
# Copyright (C) 2024 Manuel Bustillo
|
|
|
|
|
2024-07-25 10:47:49 +02:00
|
|
|
require 'csv'
|
|
|
|
|
2024-07-11 20:08:26 +02:00
|
|
|
class GuestsController < ApplicationController
|
|
|
|
def index
|
2024-11-01 19:07:12 +01:00
|
|
|
@guests = Guest.all.includes(:group)
|
2024-08-11 18:25:12 +02:00
|
|
|
.joins(:group)
|
2024-11-11 07:43:42 +01:00
|
|
|
.order('groups.name' => :asc, name: :asc)
|
2024-08-11 18:25:12 +02:00
|
|
|
|
2024-11-01 19:07:12 +01:00
|
|
|
render jsonapi: @guests
|
2024-07-11 20:08:26 +02:00
|
|
|
end
|
|
|
|
|
2024-11-11 07:43:42 +01:00
|
|
|
def update
|
|
|
|
Guests::UpdateUseCase.new(guest_ids: [params[:id]], params: params.require(:guest).permit(:name)).call
|
|
|
|
render json: {}, status: :ok
|
2024-07-25 10:47:49 +02:00
|
|
|
end
|
|
|
|
|
2024-10-27 14:03:13 +01:00
|
|
|
def bulk_update
|
2024-11-03 09:25:50 +01:00
|
|
|
Guests::UpdateUseCase.new(guest_ids: params[:guest_ids], params: params.require(:properties).permit(:status)).call
|
2024-10-27 14:03:13 +01:00
|
|
|
render json: {}, status: :ok
|
|
|
|
end
|
2024-07-11 20:08:26 +02:00
|
|
|
end
|