mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-12 18:21:38 -05:00
* Consider MIN_MINUTES_SPENT_IN_CITY during stats calculation * Remove raw data from visited cities api endpoint
23 lines
517 B
Ruby
23 lines
517 B
Ruby
# frozen_string_literal: true
|
|
|
|
class Api::V1::Countries::VisitedCitiesController < ApiController
|
|
before_action :validate_params
|
|
|
|
def index
|
|
start_at = DateTime.parse(params[:start_at]).to_i
|
|
end_at = DateTime.parse(params[:end_at]).to_i
|
|
|
|
points = current_api_user
|
|
.points
|
|
.without_raw_data
|
|
.where(timestamp: start_at..end_at)
|
|
|
|
render json: { data: CountriesAndCities.new(points).call }
|
|
end
|
|
|
|
private
|
|
|
|
def required_params
|
|
%i[start_at end_at]
|
|
end
|
|
end
|