~ihabunek/triglav

ref: 1a8ba58407fc58b933347c9bec5bcb4358191cbb triglav/lib/triglav/schemas/public_transport/platform.ex -rw-r--r-- 804 bytes
1a8ba584Ivan Habunek Use derived data for route detail view 4 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
defmodule Triglav.Schemas.PublicTransport.Platform do
  @moduledoc """
  Contains extended information for a public transport stop.
  """
  use Ecto.Schema

  alias Triglav.Schemas.Osmosis
  alias Triglav.Schemas.PublicTransport.Trip
  alias Triglav.Schemas.Zet

  @type t :: %__MODULE__{}

  schema "public_transport_platforms" do
    belongs_to :trip, Trip
    belongs_to :relation, Osmosis.Relation

    # These are optional, populated if relation is matched to route
    belongs_to :stop, Zet.Stop, type: :binary
    belongs_to :route, Zet.Route, type: :binary

    # Platform can be either a way or node
    belongs_to :node, Osmosis.Node
    belongs_to :way, Osmosis.Way

    field :sequence_id, :integer
    field :geometry, Geo.PostGIS.Geometry
    field :distance_from_route, :integer
  end
end