-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
275 additions
and
165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
defmodule UOF.API.Fixtures.ExtraInfo do | ||
use Ecto.Schema | ||
import Ecto.Changeset | ||
import UOF.API.EctoHelpers | ||
|
||
@type t :: %__MODULE__{ | ||
key: String.t(), | ||
value: String.t() | ||
} | ||
|
||
@primary_key false | ||
|
||
embedded_schema do | ||
field :key, :string | ||
field :value, :string | ||
end | ||
|
||
def changeset(model \\ %__MODULE__{}, params) do | ||
cast(model, params, [:key, :value]) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
defmodule UOF.API.Fixtures.Fixture do | ||
@moduledoc false | ||
|
||
use Ecto.Schema | ||
import Ecto.Changeset | ||
import UOF.API.EctoHelpers | ||
|
||
# attribute(:start_time_confirmed, cast: :boolean) | ||
# attribute(:start_time) | ||
# attribute(:liveodds) | ||
# attribute(:status) | ||
# attribute(:next_live_time) | ||
# attribute(:id) | ||
# attribute(:scheduled) | ||
# attribute(:start_time_tbd, cast: :boolean) | ||
# elements(:competitor, as: :competitors, into: %Competitor{}) | ||
# elements(:tv_channel, as: :tv_channels, into: %TVChannel{}) | ||
# elements(:info, as: :extra_info, into: %ExtraInfo{}) | ||
# elements(:reference_id, as: :references, into: %Reference{}) | ||
# element(:tournament_round, into: %TournamentRound{}) | ||
# element(:tournament, into: %Tournament{}) | ||
# element(:season, into: %Season{}) | ||
# element(:venue, into: %Venue{}) | ||
# element(:coverage_info, into: %CoverageInfo{}) | ||
# element(:product_info, into: %ProductInfo{}) | ||
|
||
@primary_key false | ||
|
||
embedded_schema do | ||
field :start_time_confirmed, :boolean | ||
field :start_time | ||
field :liveodds | ||
field :status | ||
field :next_live_time | ||
field :id | ||
field :scheduled | ||
field :start_time_tbd, :boolean | ||
# field :tv_channels, {:array, :string} | ||
embeds_one :season, UOF.API.Tournaments.Season | ||
embeds_one :tournament, UOF.API.Sports.Tournament | ||
embeds_one :tournament_round, UOF.API.Tournaments.TournamentRound | ||
embeds_many :competitors, UOF.API.Competitors.Competitor | ||
embeds_many :extra_info, UOF.API.Fixtures.ExtraInfo | ||
embeds_many :reference_ids, UOF.API.Fixtures.ReferenceId | ||
end | ||
|
||
def changeset(model \\ %__MODULE__{}, params) do | ||
model | ||
|> cast(params, [ | ||
:start_time_confirmed, | ||
:start_time, | ||
:liveodds, | ||
:status, | ||
:next_live_time, | ||
:id, | ||
:scheduled, | ||
:start_time_tbd | ||
# :tv_channels | ||
]) | ||
|> cast_embed(:season) | ||
|> cast_embed(:tournament) | ||
|> cast_embed(:tournament_round) | ||
|> cast_embed(:competitors) | ||
|> cast_embed(:extra_info) | ||
|> cast_embed(:reference_ids) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
defmodule UOF.API.Fixtures.ReferenceId do | ||
use Ecto.Schema | ||
import Ecto.Changeset | ||
import UOF.API.EctoHelpers | ||
|
||
@type t :: %__MODULE__{ | ||
name: String.t(), | ||
value: String.t() | ||
} | ||
|
||
@primary_key false | ||
|
||
embedded_schema do | ||
field :name, :string | ||
field :value, :string | ||
end | ||
|
||
def changeset(model \\ %__MODULE__{}, params) do | ||
cast(model, params, [:name, :value]) | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
defmodule UOF.API.Tournaments.TournamentRound do | ||
@moduledoc false | ||
use Ecto.Schema | ||
import Ecto.Changeset | ||
|
||
@primary_key false | ||
|
||
embedded_schema do | ||
field :betradar_id, :integer | ||
field :betradar_name | ||
field :type, :string | ||
# cup | ||
field :name, :string | ||
field :cup_round_matches, :integer | ||
field :cup_round_match_number, :integer | ||
field :other_match_id | ||
# group | ||
field :number | ||
field :group | ||
field :group_id | ||
field :group_long_name | ||
# qualification | ||
# ??? | ||
field :phase | ||
end | ||
|
||
def changeset(model \\ %__MODULE__{}, params) do | ||
model | ||
|> cast(params, [ | ||
:betradar_id, | ||
:betradar_name, | ||
:type, | ||
:name, | ||
:number, | ||
:cup_round_matches, | ||
:cup_round_match_number, | ||
:other_match_id, | ||
:group, | ||
:group_id, | ||
:group_long_name, | ||
:phase | ||
]) | ||
end | ||
end |
Oops, something went wrong.