wedding-planner/app/controllers/guests_controller.rb
Manuel Bustillo bd5c4f5482
All checks were successful
Check usage of free licenses / build-static-assets (pull_request) Successful in 1m42s
Add copyright notice / copyright_notice (pull_request) Successful in 3m5s
Run unit tests / unit_tests (pull_request) Successful in 5m4s
Merge first and last name and expose guest update endpoint
2024-11-11 07:55:03 +01:00

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