From 2ad4dcbbbd343a586596eac65260633230cbf611 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Menou?= Date: Tue, 10 Dec 2024 16:07:28 +0100 Subject: [PATCH] =?UTF-8?q?Registre=20d'arr=C3=AAts=20:=20premiers=20mod?= =?UTF-8?q?=C3=A8les?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See #4354. --- .../lib/registry/model/data_source.ex | 23 +++++++++ apps/transport/lib/registry/model/stop.ex | 47 +++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 apps/transport/lib/registry/model/data_source.ex create mode 100644 apps/transport/lib/registry/model/stop.ex diff --git a/apps/transport/lib/registry/model/data_source.ex b/apps/transport/lib/registry/model/data_source.ex new file mode 100644 index 0000000000..d985325ce9 --- /dev/null +++ b/apps/transport/lib/registry/model/data_source.ex @@ -0,0 +1,23 @@ +defmodule Transport.Registry.Model.DataSource do + @moduledoc """ + Common attributes describing a data source. + """ + + defstruct [ + :id, + :checksum, + :last_updated_at, + :validity_period + ] + + @type t :: %__MODULE__{ + id: data_source_id(), + checksum: binary(), + last_updated_at: DateTime.t(), + validity_period: date_time_range() + } + + @type data_source_id :: binary() + + @type date_time_range :: binary() +end diff --git a/apps/transport/lib/registry/model/stop.ex b/apps/transport/lib/registry/model/stop.ex new file mode 100644 index 0000000000..0e3038ab42 --- /dev/null +++ b/apps/transport/lib/registry/model/stop.ex @@ -0,0 +1,47 @@ +defmodule Transport.Registry.Model.StopIdentifier do + @moduledoc """ + Representation of a Stop ID. + """ + + defstruct [:id, :type] + @type t :: %__MODULE__{id: binary(), type: identifier_type()} + + @type identifier_type :: :main | :private_code | :stop_code | :other +end + +defmodule Transport.Registry.Model.Stop do + @moduledoc """ + Common attributes describing a stop. + """ + alias Transport.Registry.Model.StopIdentifier + + defstruct [ + :main_id, + :display_name, + :data_source_id, + :data_source_format, + :parent_id, + :latitude, + :longitude, + projection: :utm_wgs84, + stop_type: :stop, + secondary_ids: [] + ] + + @type t :: %__MODULE__{ + main_id: StopIdentifier.t(), + display_name: binary(), + data_source_id: Transport.Registry.Model.DataSource.data_source_id(), + data_source_format: data_source_format_type(), + parent_id: StopIdentifier.t() | nil, + latitude: float(), + longitude: float(), + projection: projection(), + stop_type: stop_type(), + secondary_ids: [StopIdentifier.t()] + } + + @type data_source_format_type :: :gtfs | :netex + @type stop_type :: :stop | :quay + @type projection :: :utm_wgs84 | :lambert93_rgf93 +end