mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-10 01:01:39 -05:00
25 lines
458 B
Ruby
25 lines
458 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Api
|
|
class PlaceSerializer
|
|
include Alba::Resource
|
|
|
|
attributes :id, :name, :latitude, :longitude, :source, :created_at
|
|
|
|
attribute :icon do |place|
|
|
place.tags.first&.icon
|
|
end
|
|
|
|
attribute :color do |place|
|
|
place.tags.first&.color
|
|
end
|
|
|
|
many :tags do
|
|
attributes :id, :name, :icon, :color
|
|
end
|
|
|
|
attribute :visits_count do |place|
|
|
place.visits.count
|
|
end
|
|
end
|
|
end
|