wedding-planner/app/controllers/guests_controller.rb

23 lines
671 B
Ruby
Raw Permalink Normal View History

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
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] } })
2024-07-11 20:08:26 +02:00
end
def update
Guest.find(params[:id]).update!(params.require(:guest).permit(:name))
render json: {}, status: :ok
2024-07-25 10:47:49 +02:00
end
def bulk_update
Guests::UpdateUseCase.new(guest_ids: params[:guest_ids], params: params.require(:properties).permit(:status)).call
render json: {}, status: :ok
end
2024-07-11 20:08:26 +02:00
end