Class: Dbwatcher::Services::Api::TablesDataService

Inherits:
BaseApiService show all
Defined in:
lib/dbwatcher/services/api/tables_data_service.rb

Overview

Service for handling filtered tables data

Provides tables data for the sessions tables view and API endpoints with filtering and caching support.

Instance Attribute Summary

Attributes inherited from BaseApiService

#params, #session

Instance Method Summary collapse

Methods inherited from BaseApiService

#initialize

Methods inherited from BaseService

call, #initialize

Methods included from Logging

#debug_enabled?, #log_debug, #log_error, #log_info, #log_warn

Constructor Details

This class inherits a constructor from Dbwatcher::Services::Api::BaseApiService

Instance Method Details

#callObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/dbwatcher/services/api/tables_data_service.rb', line 11

def call
  start_time = Time.now

  # Check for nil session first
  return { error: "Session not found" } unless session

  log_service_start("Getting tables data for session #{session.id}")

  validation_error = validate_session
  return validation_error if validation_error

  begin
    result = with_cache(cache_suffix) do
      build_tables_response
    end

    log_service_completion(start_time, session_id: session.id, filters: filter_params)
    result
  rescue StandardError => e
    handle_error(e)
  end
end