mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-11 09:41:40 -05:00
Rename params
This commit is contained in:
parent
3fd7634657
commit
ab765a4370
5 changed files with 22 additions and 20 deletions
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
module Maps
|
module Maps
|
||||||
class H3HexagonRenderer
|
class H3HexagonRenderer
|
||||||
def initialize(params:, current_api_user: nil)
|
def initialize(params:, user: nil)
|
||||||
@params = params
|
@params = params
|
||||||
@current_api_user = current_api_user
|
@user = user
|
||||||
end
|
end
|
||||||
|
|
||||||
def call
|
def call
|
||||||
|
|
@ -18,12 +18,12 @@ module Maps
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
attr_reader :params, :current_api_user
|
attr_reader :params, :user
|
||||||
|
|
||||||
def resolve_context
|
def resolve_context
|
||||||
Maps::HexagonContextResolver.call(
|
Maps::HexagonContextResolver.call(
|
||||||
params: params,
|
params: params,
|
||||||
current_api_user: current_api_user
|
user: user
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,13 +4,13 @@ module Maps
|
||||||
class HexagonContextResolver
|
class HexagonContextResolver
|
||||||
class SharedStatsNotFoundError < StandardError; end
|
class SharedStatsNotFoundError < StandardError; end
|
||||||
|
|
||||||
def self.call(params:, current_api_user: nil)
|
def self.call(params:, user: nil)
|
||||||
new(params: params, current_api_user: current_api_user).call
|
new(params: params, user: user).call
|
||||||
end
|
end
|
||||||
|
|
||||||
def initialize(params:, current_api_user: nil)
|
def initialize(params:, user: nil)
|
||||||
@params = params
|
@params = params
|
||||||
@current_api_user = current_api_user
|
@user = user
|
||||||
end
|
end
|
||||||
|
|
||||||
def call
|
def call
|
||||||
|
|
@ -21,7 +21,7 @@ module Maps
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
attr_reader :params, :current_api_user
|
attr_reader :params, :user
|
||||||
|
|
||||||
def public_sharing_request?
|
def public_sharing_request?
|
||||||
params[:uuid].present?
|
params[:uuid].present?
|
||||||
|
|
@ -46,7 +46,7 @@ module Maps
|
||||||
|
|
||||||
def resolve_authenticated_context
|
def resolve_authenticated_context
|
||||||
{
|
{
|
||||||
target_user: current_api_user,
|
user: user,
|
||||||
start_date: params[:start_date],
|
start_date: params[:start_date],
|
||||||
end_date: params[:end_date],
|
end_date: params[:end_date],
|
||||||
stat: nil
|
stat: nil
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ RSpec.describe Maps::BoundsCalculator do
|
||||||
describe '.call' do
|
describe '.call' do
|
||||||
subject(:calculate_bounds) do
|
subject(:calculate_bounds) do
|
||||||
described_class.new(
|
described_class.new(
|
||||||
target_user: target_user,
|
user: target_user,
|
||||||
start_date: start_date,
|
start_date: start_date,
|
||||||
end_date: end_date
|
end_date: end_date
|
||||||
).call
|
).call
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ RSpec.describe Maps::HexagonContextResolver do
|
||||||
subject(:resolve_context) do
|
subject(:resolve_context) do
|
||||||
described_class.call(
|
described_class.call(
|
||||||
params: params,
|
params: params,
|
||||||
current_api_user: current_api_user
|
user: current_api_user
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -25,12 +25,14 @@ RSpec.describe Maps::HexagonContextResolver do
|
||||||
it 'resolves authenticated context' do
|
it 'resolves authenticated context' do
|
||||||
result = resolve_context
|
result = resolve_context
|
||||||
|
|
||||||
expect(result).to match({
|
expect(result).to match(
|
||||||
target_user: current_api_user,
|
{
|
||||||
start_date: '2024-06-01T00:00:00Z',
|
user: current_api_user,
|
||||||
end_date: '2024-06-30T23:59:59Z',
|
start_date: '2024-06-01T00:00:00Z',
|
||||||
stat: nil
|
end_date: '2024-06-30T23:59:59Z',
|
||||||
})
|
stat: nil
|
||||||
|
}
|
||||||
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -99,4 +101,4 @@ RSpec.describe Maps::HexagonContextResolver do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ RSpec.describe Maps::HexagonRequestHandler do
|
||||||
subject(:handle_request) do
|
subject(:handle_request) do
|
||||||
described_class.new(
|
described_class.new(
|
||||||
params: params,
|
params: params,
|
||||||
current_api_user: current_api_user
|
user: current_api_user
|
||||||
).call
|
).call
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue