Skip to content

Commit

Permalink
Merge pull request #1 from Tinix/feat/d234a4e
Browse files Browse the repository at this point in the history
add LiveProducts to Pento
  • Loading branch information
Tinix authored Feb 10, 2024
2 parents dc40696 + b8457ca commit a3a015d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/pento_web/router.ex
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,13 @@ defmodule PentoWeb.Router do

get "/", PageController, :home
live "/guess", WrongLive
resources "/products", ProductController

live "/products", ProductLive.Index, :index
live "/products/new", ProductLive.Index, :new
live "/products/:id/edit", ProductLive.Index, :edit

live "/products/:id", ProductLive.Show, :show
live "/products/:id/show/edit", ProductLive.Show, :edit
end

# Other scopes may use custom stacks.
Expand Down
16 changes: 16 additions & 0 deletions priv/repo/migrations/20240210162636_create_products.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
defmodule Pento.Repo.Migrations.CreateProducts do
use Ecto.Migration

def change do
create table(:products) do
add :name, :string
add :description, :string
add :unit_price, :float
add :sku, :integer

timestamps(type: :utc_datetime)
end

create unique_index(:products, [:sku])
end
end

0 comments on commit a3a015d

Please sign in to comment.