diff --git a/lib/tradex/schema.ex b/lib/tradex/schema.ex index 9b4c73f..33061bf 100644 --- a/lib/tradex/schema.ex +++ b/lib/tradex/schema.ex @@ -1,6 +1,6 @@ defmodule Tradex.Schema do @moduledoc false - defmacro __using__(opts) do + defmacro __using__(_opts) do quote do use Ecto.Schema diff --git a/lib/tradex_web/router.ex b/lib/tradex_web/router.ex index c211158..1d8dd79 100644 --- a/lib/tradex_web/router.ex +++ b/lib/tradex_web/router.ex @@ -1,6 +1,7 @@ defmodule TradexWeb.Router do use TradexWeb, :router + import Oban.Web.Router import TradexWeb.UserAuth pipeline :browser do @@ -40,6 +41,7 @@ defmodule TradexWeb.Router do scope "/dev" do pipe_through :browser + oban_dashboard("/oban") live_dashboard "/dashboard", metrics: TradexWeb.Telemetry forward "/mailbox", Plug.Swoosh.MailboxPreview end diff --git a/mix.exs b/mix.exs index 3fdabad..17af429 100644 --- a/mix.exs +++ b/mix.exs @@ -57,6 +57,7 @@ defmodule Tradex.MixProject do {:uuidv7, "~> 1.0"}, {:igniter, "~> 0.5"}, {:oban, "~> 2.19"}, + {:oban_web, "~> 2.11"}, {:styler, "~> 1.2", only: [:dev, :test], runtime: false} ] end diff --git a/mix.lock b/mix.lock index 156f923..fd8eda4 100644 --- a/mix.lock +++ b/mix.lock @@ -26,6 +26,8 @@ "nimble_options": {:hex, :nimble_options, "1.1.1", "e3a492d54d85fc3fd7c5baf411d9d2852922f66e69476317787a7b2bb000a61b", [:mix], [], "hexpm", "821b2470ca9442c4b6984882fe9bb0389371b8ddec4d45a9504f00a66f650b44"}, "nimble_pool": {:hex, :nimble_pool, "1.1.0", "bf9c29fbdcba3564a8b800d1eeb5a3c58f36e1e11d7b7fb2e084a643f645f06b", [:mix], [], "hexpm", "af2e4e6b34197db81f7aad230c1118eac993acc0dae6bc83bac0126d4ae0813a"}, "oban": {:hex, :oban, "2.19.1", "fc376dcb04782973e384ce675539271363eef65222b23b2a8611e78c0744e5f7", [:mix], [{:ecto_sql, "~> 3.10", [hex: :ecto_sql, repo: "hexpm", optional: false]}, {:ecto_sqlite3, "~> 0.9", [hex: :ecto_sqlite3, repo: "hexpm", optional: true]}, {:igniter, "~> 0.5", [hex: :igniter, repo: "hexpm", optional: true]}, {:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: true]}, {:myxql, "~> 0.7", [hex: :myxql, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.16", [hex: :postgrex, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "5f27ba9e79b9af623dacd79d597504176e8a7d24f3f8b5570ead2f6cedd3c5ec"}, + "oban_met": {:hex, :oban_met, "1.0.1", "737db0064567b923d3f35efd1d3009dd1435d60ee6f98dbb55dbb83db8f4f4fa", [:mix], [{:oban, "~> 2.18", [hex: :oban, repo: "hexpm", optional: false]}], "hexpm", "0492d841f880b76c5b73081bc70ebea20ebacc08e871345f72c2270513f09957"}, + "oban_web": {:hex, :oban_web, "2.11.0", "8b2a23331ef7e60eabb4118a141880d89812820321b21f289f1696bcf3058810", [:mix], [{:jason, "~> 1.2", [hex: :jason, repo: "hexpm", optional: false]}, {:oban, "~> 2.19", [hex: :oban, repo: "hexpm", optional: false]}, {:oban_met, "~> 1.0", [hex: :oban_met, repo: "hexpm", optional: false]}, {:phoenix, "~> 1.7", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 3.3 or ~> 4.0", [hex: :phoenix_html, repo: "hexpm", optional: false]}, {:phoenix_live_view, "~> 1.0", [hex: :phoenix_live_view, repo: "hexpm", optional: false]}, {:phoenix_pubsub, "~> 2.1", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}], "hexpm", "a573f27bf7cb054ff2a694116428dc6fedc18e20a20d10a74934b7c9e473e562"}, "owl": {:hex, :owl, "0.12.1", "d3146087315c4528ee32411495ba10ec88102597b638d4d1455cf9d245dfb57a", [:mix], [{:ucwidth, "~> 0.2", [hex: :ucwidth, repo: "hexpm", optional: true]}], "hexpm", "d7eb9746aa89c40c46b479d6c2a70b82b94993520e40f21d0b09654f23eebf35"}, "phoenix": {:hex, :phoenix, "1.7.18", "5310c21443514be44ed93c422e15870aef254cf1b3619e4f91538e7529d2b2e4", [:mix], [{:castore, ">= 0.0.0", [hex: :castore, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 2.1", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:phoenix_template, "~> 1.0", [hex: :phoenix_template, repo: "hexpm", optional: false]}, {:phoenix_view, "~> 2.0", [hex: :phoenix_view, repo: "hexpm", optional: true]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.7", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:plug_crypto, "~> 1.2 or ~> 2.0", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}, {:websock_adapter, "~> 0.5.3", [hex: :websock_adapter, repo: "hexpm", optional: false]}], "hexpm", "1797fcc82108442a66f2c77a643a62980f342bfeb63d6c9a515ab8294870004e"}, "phoenix_ecto": {:hex, :phoenix_ecto, "4.6.3", "f686701b0499a07f2e3b122d84d52ff8a31f5def386e03706c916f6feddf69ef", [:mix], [{:ecto, "~> 3.5", [hex: :ecto, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 2.14.2 or ~> 3.0 or ~> 4.1", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:plug, "~> 1.9", [hex: :plug, repo: "hexpm", optional: false]}, {:postgrex, "~> 0.16 or ~> 1.0", [hex: :postgrex, repo: "hexpm", optional: true]}], "hexpm", "909502956916a657a197f94cc1206d9a65247538de8a5e186f7537c895d95764"}, diff --git a/priv/repo/migrations/20250127154056_add_securities_table.exs b/priv/repo/migrations/20250127154056_add_securities_table.exs new file mode 100644 index 0000000..a2dca71 --- /dev/null +++ b/priv/repo/migrations/20250127154056_add_securities_table.exs @@ -0,0 +1,19 @@ +defmodule Tradex.Repo.Migrations.AddSecuritiesTable do + use Ecto.Migration + + def change do + create table(:securities, primary_key: false) do + add :id, :binary_id, primary_key: true + add :name, :string, null: false + add :ticker, :string + add :wkn, :string + add :isin, :string + add :expiration_date, :date + add :strike_price, :decimal + + timestamps(type: :utc_datetime) + end + + create unique_index(:securities, [:name]) + end +end diff --git a/priv/repo/migrations/20250127162154_add_accounts_table.exs b/priv/repo/migrations/20250127162154_add_accounts_table.exs new file mode 100644 index 0000000..0df299a --- /dev/null +++ b/priv/repo/migrations/20250127162154_add_accounts_table.exs @@ -0,0 +1,15 @@ +defmodule Tradex.Repo.Migrations.AddAccountsTable do + use Ecto.Migration + + def change do + create table(:accounts, primary_key: false) do + add :id, :binary_id, primary_key: true + add :name, :string, null: false + + add :owner_id, references(:users, type: :binary_id), null: false + timestamps(type: :utc_datetime) + end + + create index(:accounts, [:owner_id]) + end +end diff --git a/test/support/conn_case.ex b/test/support/conn_case.ex index cb8dffe..2e5b9d1 100644 --- a/test/support/conn_case.ex +++ b/test/support/conn_case.ex @@ -20,6 +20,7 @@ defmodule TradexWeb.ConnCase do using do quote do use TradexWeb, :verified_routes + import Phoenix.ConnTest import Plug.Conn import TradexWeb.ConnCase