2020-07-02 17:03:29 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Api
|
|
|
|
module V1
|
|
|
|
class TableSerializer < ActiveModel::Serializer
|
|
|
|
type :tables
|
2023-07-19 09:42:40 +02:00
|
|
|
attributes :id, :name, :contents, :metadata, :position
|
2020-07-02 17:03:29 +02:00
|
|
|
|
2021-08-18 10:00:01 +02:00
|
|
|
include TimestampableModel
|
|
|
|
|
2020-07-02 17:03:29 +02:00
|
|
|
def contents
|
|
|
|
object.contents&.force_encoding(Encoding::UTF_8)
|
|
|
|
end
|
2023-07-19 09:42:40 +02:00
|
|
|
|
|
|
|
def position
|
2023-07-20 08:44:23 +02:00
|
|
|
object&.step_table&.step_orderable_element&.position
|
2023-07-19 09:42:40 +02:00
|
|
|
end
|
2020-07-02 17:03:29 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|