|
|
@@ -6,6 +6,7 @@ defmodule Vaccins.LocationStore do
|
|
|
defstruct [
|
|
|
:id,
|
|
|
:name,
|
|
|
+ :location,
|
|
|
:availability_query,
|
|
|
:booking_page,
|
|
|
:provider,
|
|
|
@@ -54,6 +55,7 @@ defmodule Vaccins.LocationStore do
|
|
|
|
|
|
embedded_schema do
|
|
|
field(:name, :string)
|
|
|
+ field(:location, :string)
|
|
|
field(:booking_page, :string)
|
|
|
field(:raw_query, :string)
|
|
|
end
|
|
|
@@ -62,8 +64,8 @@ defmodule Vaccins.LocationStore do
|
|
|
def changeset(location \\ %__MODULE__{}, attrs),
|
|
|
do:
|
|
|
location
|
|
|
- |> cast(attrs, [:name, :booking_page, :raw_query])
|
|
|
- |> validate_required([:name, :booking_page, :raw_query])
|
|
|
+ |> cast(attrs, [:name, :location, :booking_page, :raw_query])
|
|
|
+ |> validate_required([:name, :location, :booking_page, :raw_query])
|
|
|
|
|
|
def to_query_params(%__MODULE__{raw_query: raw}) do
|
|
|
raw
|
|
|
@@ -115,6 +117,7 @@ defmodule Vaccins.LocationStore do
|
|
|
processed <-
|
|
|
%Location{
|
|
|
name: raw_location.name,
|
|
|
+ location: raw_location.location,
|
|
|
booking_page: raw_location.booking_page,
|
|
|
availability_query_params: raw_location |> LocationRaw.to_query_params(),
|
|
|
provider: Doctolib
|