From dc40696e94ae729d387e70dd8c4012be964309c4 Mon Sep 17 00:00:00 2001 From: Daniel Tinivella Date: Sat, 10 Feb 2024 00:23:22 -0300 Subject: [PATCH] Add seeds to Products --- priv/repo/seeds.exs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/priv/repo/seeds.exs b/priv/repo/seeds.exs index a1fc9ae..91feb23 100644 --- a/priv/repo/seeds.exs +++ b/priv/repo/seeds.exs @@ -9,3 +9,30 @@ # # We recommend using the bang functions (`insert!`, `update!` # and so on) as they will fail if something goes wrong. + +alias Pento.Catalog + +products = [ + %{ + name: "Chess", + description: "The classic game of chess", + sku: 5_678_901, + unit_price: 10 + }, + %{ + name: "Tic-Tac-Toe", + description: "The game of cats and dogs", + sku: 11_121_314, + unit_price: 3.00 + }, + %{ + name: "Table Tennis", + description: "Bat and ball back and forth. Don't miss!", + sku: 15_222_324, + unit_price: 12.00 + } +] + +Enum.each(products, fn product -> + Catalog.create_product(product) +end)