diff --git a/app/controllers/api/api_controller.rb b/app/controllers/api/api_controller.rb index f5cfb1e35..27141eded 100644 --- a/app/controllers/api/api_controller.rb +++ b/app/controllers/api/api_controller.rb @@ -48,26 +48,5 @@ module Api end render json: response, status: :ok end - - private - - def filter_timestamp_range(records) - from = params.dig(:create_date_start) - to = params.dig(:create_date_end) - column = 'created_at' - if from.blank? || to.blank? - from = params.dig(:update_date_start) - to = params.dig(:update_date_end) - column = 'updated_at' - end - - return records if from.blank? || to.blank? - - if column == 'created_at' - records.where(created_at: (from..to)) - else - records.where(updated_at: (from..to)) - end - end end end diff --git a/app/controllers/api/v1/assets_controller.rb b/app/controllers/api/v1/assets_controller.rb index 92532b963..24219cae7 100644 --- a/app/controllers/api/v1/assets_controller.rb +++ b/app/controllers/api/v1/assets_controller.rb @@ -9,8 +9,8 @@ module Api def index attachments = - filter_timestamp_range(@step.assets).page(params.dig(:page, :number)) - .per(params.dig(:page, :size)) + timestamps_filter(@step.assets).page(params.dig(:page, :number)) + .per(params.dig(:page, :size)) render jsonapi: attachments, each_serializer: AssetSerializer end diff --git a/app/controllers/api/v1/base_controller.rb b/app/controllers/api/v1/base_controller.rb index 87fb39cbd..674547afe 100644 --- a/app/controllers/api/v1/base_controller.rb +++ b/app/controllers/api/v1/base_controller.rb @@ -244,6 +244,25 @@ module Api raise FilterParamError end end + + def timestamps_filter(records) + from = params.dig(:created_at, :from) + to = params.dig(:created_at, :to) + return records.where(created_at: (from..to)) if + valid_date?(*from&.split('-')&.map(&:to_i)) && valid_date?(*to&.split('-')&.map(&:to_i)) + + from = params.dig(:updated_at, :from) + to = params.dig(:updated_at, :to) + + return records.where(updated_at: (from..to)) if + valid_date?(*from&.split('-')&.map(&:to_i)) && valid_date?(*to&.split('-')&.map(&:to_i)) + + records + end + + def valid_date?(year = '', month = '', day = '') + Date.new(year, month, day) rescue false + end end end end diff --git a/app/controllers/api/v1/checklist_items_controller.rb b/app/controllers/api/v1/checklist_items_controller.rb index fd52c145b..ff1980966 100644 --- a/app/controllers/api/v1/checklist_items_controller.rb +++ b/app/controllers/api/v1/checklist_items_controller.rb @@ -13,8 +13,8 @@ module Api def index checklist_items = - filter_timestamp_range(@checklist.checklist_items).page(params.dig(:page, :number)) - .per(params.dig(:page, :size)) + timestamps_filter(@checklist.checklist_items).page(params.dig(:page, :number)) + .per(params.dig(:page, :size)) render jsonapi: checklist_items, each_serializer: ChecklistItemSerializer end diff --git a/app/controllers/api/v1/checklists_controller.rb b/app/controllers/api/v1/checklists_controller.rb index b7891d4ea..c661fc035 100644 --- a/app/controllers/api/v1/checklists_controller.rb +++ b/app/controllers/api/v1/checklists_controller.rb @@ -11,8 +11,8 @@ module Api def index checklists = - filter_timestamp_range(@step.checklists).page(params.dig(:page, :number)) - .per(params.dig(:page, :size)) + timestamps_filter(@step.checklists).page(params.dig(:page, :number)) + .per(params.dig(:page, :size)) render jsonapi: checklists, each_serializer: ChecklistSerializer, include: include_params end diff --git a/app/controllers/api/v1/experiment_user_assignments_controller.rb b/app/controllers/api/v1/experiment_user_assignments_controller.rb index 4fc7eeae9..845333d12 100644 --- a/app/controllers/api/v1/experiment_user_assignments_controller.rb +++ b/app/controllers/api/v1/experiment_user_assignments_controller.rb @@ -12,9 +12,9 @@ module Api def index user_assignments = - filter_timestamp_range(@experiment.user_assignments).includes(:user_role) - .page(params.dig(:page, :number)) - .per(params.dig(:page, :size)) + timestamps_filter(@experiment.user_assignments).includes(:user_role) + .page(params.dig(:page, :number)) + .per(params.dig(:page, :size)) render jsonapi: user_assignments, each_serializer: UserAssignmentSerializer, diff --git a/app/controllers/api/v1/experiments_controller.rb b/app/controllers/api/v1/experiments_controller.rb index 799a0c60f..4030ca9a7 100644 --- a/app/controllers/api/v1/experiments_controller.rb +++ b/app/controllers/api/v1/experiments_controller.rb @@ -11,7 +11,7 @@ module Api before_action :load_experiment_for_managing, only: %i(update) def index - experiments = filter_timestamp_range(@project.experiments) + experiments = timestamps_filter(@project.experiments) experiments = archived_filter(experiments).page(params.dig(:page, :number)) .per(params.dig(:page, :size)) render jsonapi: experiments, each_serializer: ExperimentSerializer diff --git a/app/controllers/api/v1/inventories_controller.rb b/app/controllers/api/v1/inventories_controller.rb index b8b35b61c..7c4089615 100644 --- a/app/controllers/api/v1/inventories_controller.rb +++ b/app/controllers/api/v1/inventories_controller.rb @@ -12,9 +12,9 @@ module Api def index inventories = - filter_timestamp_range(@team.repositories).active - .page(params.dig(:page, :number)) - .per(params.dig(:page, :size)) + timestamps_filter(@team.repositories).active + .page(params.dig(:page, :number)) + .per(params.dig(:page, :size)) render jsonapi: inventories, each_serializer: InventorySerializer end diff --git a/app/controllers/api/v1/inventory_cells_controller.rb b/app/controllers/api/v1/inventory_cells_controller.rb index a51548d5c..1e1820c49 100644 --- a/app/controllers/api/v1/inventory_cells_controller.rb +++ b/app/controllers/api/v1/inventory_cells_controller.rb @@ -12,7 +12,7 @@ module Api def index cells = - filter_timestamp_range( + timestamps_filter( @inventory_item.repository_cells ) .preload(:repository_column, value: @inventory.cell_preload_includes) diff --git a/app/controllers/api/v1/inventory_checklist_items_controller.rb b/app/controllers/api/v1/inventory_checklist_items_controller.rb index 68952c13c..e18f7007b 100644 --- a/app/controllers/api/v1/inventory_checklist_items_controller.rb +++ b/app/controllers/api/v1/inventory_checklist_items_controller.rb @@ -12,8 +12,8 @@ module Api def index checklist_items = - filter_timestamp_range(@inventory_column.repository_checklist_items).page(params.dig(:page, :number)) - .per(params.dig(:page, :size)) + timestamps_filter(@inventory_column.repository_checklist_items).page(params.dig(:page, :number)) + .per(params.dig(:page, :size)) render jsonapi: checklist_items, each_serializer: InventoryChecklistItemSerializer end diff --git a/app/controllers/api/v1/inventory_columns_controller.rb b/app/controllers/api/v1/inventory_columns_controller.rb index d1f3a4b8a..320c2b82c 100644 --- a/app/controllers/api/v1/inventory_columns_controller.rb +++ b/app/controllers/api/v1/inventory_columns_controller.rb @@ -12,12 +12,12 @@ module Api before_action :check_create_permissions, only: %i(create) def index - columns = filter_timestamp_range(@inventory.repository_columns).includes(:repository_list_items) - .includes(:repository_status_items) - .includes(:repository_checklist_items) - .includes(:repository_stock_unit_items) - .page(params.dig(:page, :number)) - .per(params.dig(:page, :size)) + columns = timestamps_filter(@inventory.repository_columns).includes(:repository_list_items) + .includes(:repository_status_items) + .includes(:repository_checklist_items) + .includes(:repository_stock_unit_items) + .page(params.dig(:page, :number)) + .per(params.dig(:page, :size)) render jsonapi: columns, each_serializer: InventoryColumnSerializer, diff --git a/app/controllers/api/v1/inventory_items_controller.rb b/app/controllers/api/v1/inventory_items_controller.rb index 7e284ec1c..d66d966d4 100644 --- a/app/controllers/api/v1/inventory_items_controller.rb +++ b/app/controllers/api/v1/inventory_items_controller.rb @@ -13,7 +13,7 @@ module Api def index items = - filter_timestamp_range( + timestamps_filter( @inventory.repository_rows ) .active diff --git a/app/controllers/api/v1/inventory_list_items_controller.rb b/app/controllers/api/v1/inventory_list_items_controller.rb index 72e28fdfb..26be986ae 100644 --- a/app/controllers/api/v1/inventory_list_items_controller.rb +++ b/app/controllers/api/v1/inventory_list_items_controller.rb @@ -11,8 +11,8 @@ module Api before_action :check_manage_permissions, only: %i(create update destroy) def index - list_items = filter_timestamp_range(@inventory_column.repository_list_items).page(params.dig(:page, :number)) - .per(params.dig(:page, :size)) + list_items = timestamps_filter(@inventory_column.repository_list_items).page(params.dig(:page, :number)) + .per(params.dig(:page, :size)) render jsonapi: list_items, each_serializer: InventoryListItemSerializer end diff --git a/app/controllers/api/v1/inventory_status_items_controller.rb b/app/controllers/api/v1/inventory_status_items_controller.rb index 700763908..09d4cb032 100644 --- a/app/controllers/api/v1/inventory_status_items_controller.rb +++ b/app/controllers/api/v1/inventory_status_items_controller.rb @@ -9,7 +9,7 @@ module Api def index status_items = - filter_timestamp_range( + timestamps_filter( @inventory_column.repository_status_items ) .repository_status_items diff --git a/app/controllers/api/v1/inventory_stock_unit_items_controller.rb b/app/controllers/api/v1/inventory_stock_unit_items_controller.rb index 4496b47d4..3c790a1e9 100644 --- a/app/controllers/api/v1/inventory_stock_unit_items_controller.rb +++ b/app/controllers/api/v1/inventory_stock_unit_items_controller.rb @@ -12,7 +12,7 @@ module Api def index stock_unit_items = - filter_timestamp_range( + timestamps_filter( @inventory_column.repository_stock_unit_items ) .page(params.dig(:page, :number)) diff --git a/app/controllers/api/v1/project_comments_controller.rb b/app/controllers/api/v1/project_comments_controller.rb index 2de436385..51a10d6ef 100644 --- a/app/controllers/api/v1/project_comments_controller.rb +++ b/app/controllers/api/v1/project_comments_controller.rb @@ -9,8 +9,8 @@ module Api before_action :load_project_comment, only: :show def index - project_comments = filter_timestamp_range(@project.project_comments).page(params.dig(:page, :number)) - .per(params.dig(:page, :size)) + project_comments = timestamps_filter(@project.project_comments).page(params.dig(:page, :number)) + .per(params.dig(:page, :size)) render jsonapi: project_comments, each_serializer: CommentSerializer, diff --git a/app/controllers/api/v1/project_folders_controller.rb b/app/controllers/api/v1/project_folders_controller.rb index 9c46c2394..f80cb6790 100644 --- a/app/controllers/api/v1/project_folders_controller.rb +++ b/app/controllers/api/v1/project_folders_controller.rb @@ -7,8 +7,8 @@ module Api before_action :load_project_folder, only: %i(show update) def index - project_folders = filter_timestamp_range(@team.project_folders).page(params.dig(:page, :number)) - .per(params.dig(:page, :size)) + project_folders = timestamps_filter(@team.project_folders).page(params.dig(:page, :number)) + .per(params.dig(:page, :size)) render jsonapi: project_folders, each_serializer: ProjectFolderSerializer end diff --git a/app/controllers/api/v1/project_user_assignments_controller.rb b/app/controllers/api/v1/project_user_assignments_controller.rb index 1fb179952..8dfbb100f 100644 --- a/app/controllers/api/v1/project_user_assignments_controller.rb +++ b/app/controllers/api/v1/project_user_assignments_controller.rb @@ -19,9 +19,9 @@ module Api end def index - user_assignments = filter_timestamp_range(@project.user_assignments).includes(:user_role) - .page(params.dig(:page, :number)) - .per(params.dig(:page, :size)) + user_assignments = timestamps_filter(@project.user_assignments).includes(:user_role) + .page(params.dig(:page, :number)) + .per(params.dig(:page, :size)) render jsonapi: user_assignments, each_serializer: UserAssignmentSerializer, diff --git a/app/controllers/api/v1/projects_controller.rb b/app/controllers/api/v1/projects_controller.rb index 24b7b31ef..81fb6d8ed 100644 --- a/app/controllers/api/v1/projects_controller.rb +++ b/app/controllers/api/v1/projects_controller.rb @@ -11,7 +11,7 @@ module Api before_action :load_project_for_managing, only: %i(update) def index - projects = filter_timestamp_range(@team.projects.visible_to(current_user, @team)) + projects = timestamps_filter(@team.projects.visible_to(current_user, @team)) projects = archived_filter(projects).page(params.dig(:page, :number)) .per(params.dig(:page, :size)) diff --git a/app/controllers/api/v1/protocol_templates_controller.rb b/app/controllers/api/v1/protocol_templates_controller.rb index 57c841505..725ee147d 100644 --- a/app/controllers/api/v1/protocol_templates_controller.rb +++ b/app/controllers/api/v1/protocol_templates_controller.rb @@ -12,7 +12,7 @@ module Api def index protocol_templates = - filter_timestamp_range( + timestamps_filter( Protocol.latest_available_versions(@team) ) .viewable_by_user(current_user, @team) diff --git a/app/controllers/api/v1/protocols_controller.rb b/app/controllers/api/v1/protocols_controller.rb index 39e27ec29..0acc517c1 100644 --- a/app/controllers/api/v1/protocols_controller.rb +++ b/app/controllers/api/v1/protocols_controller.rb @@ -11,8 +11,8 @@ module Api end def index - protocols = filter_timestamp_range(@task.protocols).page(params.dig(:page, :number)) - .per(params.dig(:page, :size)) + protocols = timestamps_filter(@task.protocols).page(params.dig(:page, :number)) + .per(params.dig(:page, :size)) render jsonapi: protocols, each_serializer: ProtocolSerializer, rte_rendering: render_rte?, team: @team end diff --git a/app/controllers/api/v1/reports_controller.rb b/app/controllers/api/v1/reports_controller.rb index 036688ff1..a8405824a 100644 --- a/app/controllers/api/v1/reports_controller.rb +++ b/app/controllers/api/v1/reports_controller.rb @@ -8,8 +8,8 @@ module Api before_action :load_report, only: :show def index - reports = filter_timestamp_range(@project.reports).page(params.dig(:page, :number)) - .per(params.dig(:page, :size)) + reports = timestamps_filter(@project.reports).page(params.dig(:page, :number)) + .per(params.dig(:page, :size)) render jsonapi: reports, each_serializer: ReportSerializer, hide_project: true diff --git a/app/controllers/api/v1/results_controller.rb b/app/controllers/api/v1/results_controller.rb index 455b1601f..94bfd2b0d 100644 --- a/app/controllers/api/v1/results_controller.rb +++ b/app/controllers/api/v1/results_controller.rb @@ -8,8 +8,8 @@ module Api before_action :check_manage_permissions, only: %i(create update) def index - results = filter_timestamp_range(@task.results).page(params.dig(:page, :number)) - .per(params.dig(:page, :size)) + results = timestamps_filter(@task.results).page(params.dig(:page, :number)) + .per(params.dig(:page, :size)) render jsonapi: results, each_serializer: ResultSerializer, include: (%i(text table file) << include_params).flatten.compact end diff --git a/app/controllers/api/v1/step_texts_controller.rb b/app/controllers/api/v1/step_texts_controller.rb index 4d9ac583a..dc69f4228 100644 --- a/app/controllers/api/v1/step_texts_controller.rb +++ b/app/controllers/api/v1/step_texts_controller.rb @@ -10,8 +10,8 @@ module Api before_action :load_step_text_for_managing, only: %i(update destroy) def index - step_texts = filter_timestamp_range(@step.step_texts).page(params.dig(:page, :number)) - .per(params.dig(:page, :size)) + step_texts = timestamps_filter(@step.step_texts).page(params.dig(:page, :number)) + .per(params.dig(:page, :size)) render jsonapi: step_texts, each_serializer: StepTextSerializer, include: include_params end diff --git a/app/controllers/api/v1/steps_controller.rb b/app/controllers/api/v1/steps_controller.rb index a5486c2d2..f7a50a276 100644 --- a/app/controllers/api/v1/steps_controller.rb +++ b/app/controllers/api/v1/steps_controller.rb @@ -13,8 +13,8 @@ module Api before_action :check_delete_permissions, only: :destroy def index - steps = filter_timestamp_range(@protocol.steps).page(params.dig(:page, :number)) - .per(params.dig(:page, :size)) + steps = timestamps_filter(@protocol.steps).page(params.dig(:page, :number)) + .per(params.dig(:page, :size)) render jsonapi: steps, each_serializer: StepSerializer, include: include_params, diff --git a/app/controllers/api/v1/tables_controller.rb b/app/controllers/api/v1/tables_controller.rb index 76b8830eb..60dcd40df 100644 --- a/app/controllers/api/v1/tables_controller.rb +++ b/app/controllers/api/v1/tables_controller.rb @@ -10,8 +10,8 @@ module Api before_action :load_table_for_managing, only: %i(update destroy) def index - tables = filter_timestamp_range(@step.tables).page(params.dig(:page, :number)) - .per(params.dig(:page, :size)) + tables = timestamps_filter(@step.tables).page(params.dig(:page, :number)) + .per(params.dig(:page, :size)) render jsonapi: tables, each_serializer: TableSerializer end diff --git a/app/controllers/api/v1/task_assignments_controller.rb b/app/controllers/api/v1/task_assignments_controller.rb index 3fc18da11..1fd409b9d 100644 --- a/app/controllers/api/v1/task_assignments_controller.rb +++ b/app/controllers/api/v1/task_assignments_controller.rb @@ -10,10 +10,10 @@ module Api before_action :check_manage_permissions, only: %i(create destroy) def index - users = filter_timestamp_range(User).joins(:user_my_modules) - .where(user_my_modules: { my_module_id: @task.id }) - .page(params.dig(:page, :number)) - .per(params.dig(:page, :size)) + users = timestamps_filter(User).joins(:user_my_modules) + .where(user_my_modules: { my_module_id: @task.id }) + .page(params.dig(:page, :number)) + .per(params.dig(:page, :size)) render jsonapi: users, each_serializer: UserSerializer end diff --git a/app/controllers/api/v1/task_groups_controller.rb b/app/controllers/api/v1/task_groups_controller.rb index 3358c7211..042d80605 100644 --- a/app/controllers/api/v1/task_groups_controller.rb +++ b/app/controllers/api/v1/task_groups_controller.rb @@ -9,8 +9,8 @@ module Api before_action :load_task_group, only: :show def index - task_groups = filter_timestamp_range(@experiment.my_module_groups).page(params.dig(:page, :number)) - .per(params.dig(:page, :size)) + task_groups = timestamps_filter(@experiment.my_module_groups).page(params.dig(:page, :number)) + .per(params.dig(:page, :size)) render jsonapi: task_groups, each_serializer: TaskGroupSerializer, include: include_params end diff --git a/app/controllers/api/v1/task_inventory_items_controller.rb b/app/controllers/api/v1/task_inventory_items_controller.rb index 0e8827d8d..d09a47cc6 100644 --- a/app/controllers/api/v1/task_inventory_items_controller.rb +++ b/app/controllers/api/v1/task_inventory_items_controller.rb @@ -12,10 +12,10 @@ module Api def index items = - filter_timestamp_range(@task.repository_rows).includes(repository_cells: :repository_column) - .preload(repository_cells: :value) - .page(params.dig(:page, :number)) - .per(params.dig(:page, :size)) + timestamps_filter(@task.repository_rows).includes(repository_cells: :repository_column) + .preload(repository_cells: :value) + .page(params.dig(:page, :number)) + .per(params.dig(:page, :size)) render jsonapi: items, each_serializer: TaskInventoryItemSerializer, show_repository: true, diff --git a/app/controllers/api/v1/task_tags_controller.rb b/app/controllers/api/v1/task_tags_controller.rb index eaae10d4b..dc5d79f7c 100644 --- a/app/controllers/api/v1/task_tags_controller.rb +++ b/app/controllers/api/v1/task_tags_controller.rb @@ -10,8 +10,8 @@ module Api before_action :load_tag, only: :show def index - tags = filter_timestamp_range(@task.tags).page(params.dig(:page, :number)) - .per(params.dig(:page, :size)) + tags = timestamps_filter(@task.tags).page(params.dig(:page, :number)) + .per(params.dig(:page, :size)) render jsonapi: tags, each_serializer: TagSerializer end diff --git a/app/controllers/api/v1/task_user_assignments_controller.rb b/app/controllers/api/v1/task_user_assignments_controller.rb index de84da9e4..a4db78839 100644 --- a/app/controllers/api/v1/task_user_assignments_controller.rb +++ b/app/controllers/api/v1/task_user_assignments_controller.rb @@ -12,9 +12,9 @@ module Api before_action :load_user_assignment_for_managing, only: %i(update show) def index - user_assignments = filter_timestamp_range(@task.user_assignments).includes(:user_role) - .page(params.dig(:page, :number)) - .per(params.dig(:page, :size)) + user_assignments = timestamps_filter(@task.user_assignments).includes(:user_role) + .page(params.dig(:page, :number)) + .per(params.dig(:page, :size)) render jsonapi: user_assignments, each_serializer: UserAssignmentSerializer, diff --git a/app/controllers/api/v1/task_users_controller.rb b/app/controllers/api/v1/task_users_controller.rb index 3d167afc6..693a3a7c0 100644 --- a/app/controllers/api/v1/task_users_controller.rb +++ b/app/controllers/api/v1/task_users_controller.rb @@ -10,8 +10,8 @@ module Api before_action :load_user, only: :show def index - users = filter_timestamp_range(@task.users).page(params.dig(:page, :number)) - .per(params.dig(:page, :size)) + users = timestamps_filter(@task.users).page(params.dig(:page, :number)) + .per(params.dig(:page, :size)) render jsonapi: users, each_serializer: UserSerializer end diff --git a/app/controllers/api/v1/tasks_controller.rb b/app/controllers/api/v1/tasks_controller.rb index 20730b26e..ea4400a7a 100644 --- a/app/controllers/api/v1/tasks_controller.rb +++ b/app/controllers/api/v1/tasks_controller.rb @@ -16,7 +16,7 @@ module Api def index tasks = - filter_timestamp_range( + timestamps_filter( @experiment.my_modules ).includes(:my_module_status, :my_modules, :my_module_antecessors) tasks = archived_filter(tasks).page(params.dig(:page, :number)) diff --git a/app/controllers/api/v1/teams_controller.rb b/app/controllers/api/v1/teams_controller.rb index 52a25927e..37d6e0e37 100644 --- a/app/controllers/api/v1/teams_controller.rb +++ b/app/controllers/api/v1/teams_controller.rb @@ -8,8 +8,8 @@ module Api end def index - teams = filter_timestamp_range(current_user.teams).page(params.dig(:page, :number)) - .per(params.dig(:page, :size)) + teams = timestamps_filter(current_user.teams).page(params.dig(:page, :number)) + .per(params.dig(:page, :size)) render jsonapi: teams, each_serializer: TeamSerializer end diff --git a/app/controllers/api/v1/user_identities_controller.rb b/app/controllers/api/v1/user_identities_controller.rb index dca01dbcf..9f917b65c 100644 --- a/app/controllers/api/v1/user_identities_controller.rb +++ b/app/controllers/api/v1/user_identities_controller.rb @@ -7,8 +7,8 @@ module Api before_action :load_user_identity, only: %i(show update destroy) def index - identities = filter_timestamp_range(@user.user_identities).page(params.dig(:page, :number)) - .per(params.dig(:page, :size)) + identities = timestamps_filter(@user.user_identities).page(params.dig(:page, :number)) + .per(params.dig(:page, :size)) render jsonapi: identities, each_serializer: UserIdentitySerializer end diff --git a/app/controllers/api/v1/users_controller.rb b/app/controllers/api/v1/users_controller.rb index e50e1d6ff..02a7cf596 100644 --- a/app/controllers/api/v1/users_controller.rb +++ b/app/controllers/api/v1/users_controller.rb @@ -7,8 +7,8 @@ module Api before_action :load_user, only: :show def index - users = filter_timestamp_range(@team.users).page(params.dig(:page, :number)) - .per(params.dig(:page, :size)) + users = timestamps_filter(@team.users).page(params.dig(:page, :number)) + .per(params.dig(:page, :size)) render jsonapi: users, each_serializer: UserSerializer end diff --git a/app/controllers/api/v1/workflow_statuses_controller.rb b/app/controllers/api/v1/workflow_statuses_controller.rb index 38f4ceb11..3a0026ce2 100644 --- a/app/controllers/api/v1/workflow_statuses_controller.rb +++ b/app/controllers/api/v1/workflow_statuses_controller.rb @@ -6,7 +6,7 @@ module Api before_action :load_workflow def index - statuses = filter_timestamp_range(@workflow.my_module_statuses) + statuses = timestamps_filter(@workflow.my_module_statuses) render jsonapi: statuses, each_serializer: WorkflowStatusSerializer end end diff --git a/app/controllers/api/v1/workflows_controller.rb b/app/controllers/api/v1/workflows_controller.rb index 59a839782..3d59797ec 100644 --- a/app/controllers/api/v1/workflows_controller.rb +++ b/app/controllers/api/v1/workflows_controller.rb @@ -8,7 +8,7 @@ module Api end def index - workflows = filter_timestamp_range(MyModuleStatusFlow.all) + workflows = timestamps_filter(MyModuleStatusFlow.all) render jsonapi: workflows, each_serializer: WorkflowSerializer end