~ihabunek/triglav

ref: 837d6e21f3fc80e932ea631bb402f346769c4154 triglav/lib/triglav/schemas/public_transport/platform.ex -rw-r--r-- 814 bytes
837d6e21Ivan Habunek Reorganize validator to use new data 5 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
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__{}

  @primary_key false

  schema "public_transport_platforms" do
    belongs_to :relation, Osmosis.Relation, primary_key: true
    belongs_to :stop, Zet.Stop, type: :binary
    belongs_to :route, Zet.Route, type: :binary
    belongs_to :node, Osmosis.Node
    belongs_to :way, Osmosis.Way
    field :sequence_id, :integer, primary_key: true
    field :geometry, Geo.PostGIS.Geometry

    has_one :trip, Trip, foreign_key: :relation_id, references: :relation_id
    field :distance_from_route, :float, virtual: true
  end
end