2020-03-13 15:44:24 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module TimeFrameArguments
|
|
|
|
extend ActiveSupport::Concern
|
|
|
|
|
|
|
|
included do
|
2021-01-03 14:25:43 +05:30
|
|
|
argument :timeframe, Types::TimeframeInputType,
|
|
|
|
required: false,
|
2021-03-08 18:12:59 +05:30
|
|
|
description: 'List items overlapping the given timeframe.'
|
2020-03-13 15:44:24 +05:30
|
|
|
end
|
|
|
|
|
2021-09-04 01:27:46 +05:30
|
|
|
def transform_timeframe_parameters(args)
|
2023-07-09 08:55:56 +05:30
|
|
|
return {} unless args[:timeframe]
|
|
|
|
|
|
|
|
args[:timeframe].to_h.transform_keys { |k| :"#{k}_date" }
|
2021-09-04 01:27:46 +05:30
|
|
|
end
|
2020-03-13 15:44:24 +05:30
|
|
|
end
|