Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add LiveProducts to Pento #1

Merged
merged 2 commits into from
Feb 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading