class Api::V1::BookingsMissionsController < ApplicationController
  before_action :find_booking

  def index
    @missions = MissionsService::CreateMissionsFromListing.new(@booking.listing).call
    render json: @missions, each_serializer: MissionSerializer,
      layout: false
  end

    private

  def permitted_params
    params.permit(:booking_id)
  end

  def find_booking
    @booking = Booking.find(permitted_params[:booking_id])
  end
end
