dawarich/app/controllers/api/v1/overland/batches_controller.rb

23 lines
646 B
Ruby
Raw Permalink Normal View History

# frozen_string_literal: true
2024-08-25 14:19:02 -04:00
class Api::V1::Overland::BatchesController < ApiController
before_action :authenticate_active_api_user!, only: %i[create]
2025-05-16 12:51:48 -04:00
before_action :validate_points_limit, only: %i[create]
2024-04-06 13:09:38 -04:00
def create
Overland::PointsCreator.new(batch_params, current_api_user.id).call
2024-04-06 13:09:38 -04:00
render json: { result: 'ok' }, status: :created
2026-01-11 12:51:17 -05:00
rescue StandardError => e
Sentry.capture_exception(e) if defined?(Sentry)
render json: { error: 'Batch creation failed' }, status: :internal_server_error
2024-04-06 13:09:38 -04:00
end
private
def batch_params
params.permit(locations: [:type, { geometry: {}, properties: {} }], batch: {})
2024-04-06 13:09:38 -04:00
end
end