Retrospring/lib/use_case/data_export/theme.rb

30 lines
614 B
Ruby

# frozen_string_literal: true
module UseCase
module DataExport
class Theme < UseCase::DataExport::Base
include ThemeHelper
MODEL_FIELDS = %i[id user_id created_at updated_at].freeze
def files
return {} unless user.theme
{
"theme.json" => json_file!(
theme: theme_data,
),
}
end
def theme_data
{}.tap do |obj|
(column_names(::Theme) - MODEL_FIELDS).each do |field|
obj[field] = "##{get_hex_color_from_theme_value(user.theme[field])}"
end
end
end
end
end
end