feat(date-filter): introduce DateFilter module with URL codec and Ash query expressions

This commit is contained in:
Moritz 2026-05-20 16:24:08 +02:00
parent 143c0c5c24
commit ddd4a9a878
7 changed files with 1195 additions and 0 deletions

View file

@ -26,6 +26,18 @@ defmodule Mv.Constants do
@fee_type_filter_prefix "fee_type_"
@join_date_from_param "jd_from"
@join_date_to_param "jd_to"
@exit_date_mode_param "ed_mode"
@exit_date_from_param "ed_from"
@exit_date_to_param "ed_to"
@custom_date_filter_prefix "cdf_"
@max_boolean_filters 50
@max_uuid_length 36
@ -84,6 +96,70 @@ defmodule Mv.Constants do
"""
def fee_type_filter_prefix, do: @fee_type_filter_prefix
@doc """
Returns the URL parameter name for the join_date lower bound filter.
## Examples
iex> Mv.Constants.join_date_from_param()
"jd_from"
"""
def join_date_from_param, do: @join_date_from_param
@doc """
Returns the URL parameter name for the join_date upper bound filter.
## Examples
iex> Mv.Constants.join_date_to_param()
"jd_to"
"""
def join_date_to_param, do: @join_date_to_param
@doc """
Returns the URL parameter name for the exit_date filter mode
(`active_only` | `inactive_only` | `all` | `custom`).
## Examples
iex> Mv.Constants.exit_date_mode_param()
"ed_mode"
"""
def exit_date_mode_param, do: @exit_date_mode_param
@doc """
Returns the URL parameter name for the exit_date lower bound filter
(only relevant when ed_mode=custom).
## Examples
iex> Mv.Constants.exit_date_from_param()
"ed_from"
"""
def exit_date_from_param, do: @exit_date_from_param
@doc """
Returns the URL parameter name for the exit_date upper bound filter
(only relevant when ed_mode=custom).
## Examples
iex> Mv.Constants.exit_date_to_param()
"ed_to"
"""
def exit_date_to_param, do: @exit_date_to_param
@doc """
Returns the prefix for custom date field filter URL parameters
(e.g. cdf_<uuid>_from / cdf_<uuid>_to).
## Examples
iex> Mv.Constants.custom_date_filter_prefix()
"cdf_"
"""
def custom_date_filter_prefix, do: @custom_date_filter_prefix
@doc """
Returns the maximum number of boolean custom field filters allowed per request.