mirror of
https://github.com/Retrospring/retrospring.git
synced 2024-11-20 18:39:52 +01:00
29 lines
614 B
Ruby
29 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
|