2022-10-08 13:01:11 +09:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class PrivacyPolicy < ActiveModelSerializers::Model
|
2024-01-19 20:22:23 +09:00
|
|
|
DEFAULT_PRIVACY_POLICY = Rails.root.join('config', 'templates', 'privacy-policy.md').read
|
2022-10-08 13:01:11 +09:00
|
|
|
DEFAULT_UPDATED_AT = DateTime.new(2022, 10, 7).freeze
|
|
|
|
|
|
|
|
attributes :updated_at, :text
|
|
|
|
|
|
|
|
def self.current
|
|
|
|
custom = Setting.find_by(var: 'site_terms')
|
|
|
|
|
2022-10-08 15:34:00 +09:00
|
|
|
if custom&.value.present?
|
2022-10-08 13:01:11 +09:00
|
|
|
new(text: custom.value, updated_at: custom.updated_at)
|
|
|
|
else
|
|
|
|
new(text: DEFAULT_PRIVACY_POLICY, updated_at: DEFAULT_UPDATED_AT)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|