dawarich/app/controllers/api/v1/visits/possible_places_controller.rb

15 lines
420 B
Ruby
Raw Permalink Normal View History

2025-03-03 14:11:21 -05:00
# frozen_string_literal: true
class Api::V1::Visits::PossiblePlacesController < ApiController
def index
visit = current_api_user.visits.find(params[:id])
possible_places = visit.suggested_places.map do |place|
Api::PlaceSerializer.new(place).call
end
2025-03-03 14:11:21 -05:00
render json: possible_places
rescue ActiveRecord::RecordNotFound
render json: { error: 'Visit not found' }, status: :not_found
end
end