2016-09-24 03:00:46 +00:00
|
|
|
# frozen_string_literal: true
|
2017-11-06 16:15:18 +00:00
|
|
|
|
2016-09-21 17:22:40 +00:00
|
|
|
module Api
|
|
|
|
module V2
|
|
|
|
class MapSerializer < ApplicationSerializer
|
|
|
|
attributes :id,
|
2016-09-24 03:00:46 +00:00
|
|
|
:name,
|
|
|
|
:desc,
|
|
|
|
:permission,
|
|
|
|
:screenshot,
|
2016-10-05 14:36:03 +00:00
|
|
|
:starred,
|
2016-09-24 03:00:46 +00:00
|
|
|
:created_at,
|
|
|
|
:updated_at
|
2016-09-21 17:22:40 +00:00
|
|
|
|
2016-10-05 14:36:03 +00:00
|
|
|
def starred
|
|
|
|
object.starred_by_user?(scope[:current_user])
|
|
|
|
end
|
|
|
|
|
2016-09-21 17:22:40 +00:00
|
|
|
def self.embeddable
|
|
|
|
{
|
|
|
|
user: {},
|
2017-03-09 19:24:52 +00:00
|
|
|
source: { serializer: MapSerializer },
|
2016-09-21 17:22:40 +00:00
|
|
|
topics: {},
|
|
|
|
synapses: {},
|
|
|
|
mappings: {},
|
|
|
|
contributors: { serializer: UserSerializer },
|
|
|
|
collaborators: { serializer: UserSerializer }
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2016-09-24 03:00:46 +00:00
|
|
|
class_eval do
|
2016-09-21 17:22:40 +00:00
|
|
|
embed_dat
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|