Skip to content

Commit

Permalink
refactor: move detour_status definition into Db.Detour
Browse files Browse the repository at this point in the history
  • Loading branch information
firestack committed Jan 31, 2025
1 parent 3304ae5 commit 45462f9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/skate/detours/db/detour.ex
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ defmodule Skate.Detours.Db.Detour do

alias Skate.Settings.Db.User

@type detour_status :: :active | :draft | :past

typed_schema "detours" do
field :state, :map
belongs_to :author, User
Expand All @@ -20,7 +22,7 @@ defmodule Skate.Detours.Db.Detour do
## Detour virtual fields
# -------------------------------------------------------
field(:status, Ecto.Enum, values: [:draft, :active, :past], virtual: true) ::
simple_status() | nil
detour_status() | nil

# Route properties
field :route_id, :string, virtual: true
Expand Down
2 changes: 1 addition & 1 deletion lib/skate/detours/detours.ex
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ defmodule Skate.Detours.Detours do
nil
end

@type detour_type :: :active | :draft | :past
@type detour_type :: Skate.Detours.Db.Detour.detour_status()

@doc """
Takes a `Skate.Detours.Db.Detour` struct and a `Skate.Settings.Db.User` id
Expand Down

0 comments on commit 45462f9

Please sign in to comment.