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