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

Basic seeds #502

Merged
merged 1 commit into from
Dec 28, 2023
Merged
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
35 changes: 28 additions & 7 deletions priv/repo/seeds.exs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,31 @@
#
# mix run priv/repo/seeds.exs
#
# Inside the script, you can read and write to any of your
# repositories directly:
#
# Radiator.Repo.insert!(%Radiator.SomeSchema{})
#
# We recommend using the bang functions (`insert!`, `update!`
# and so on) as they will fail if something goes wrong.
alias Radiator.{Accounts, Outline, Podcast}

{:ok, _user_bob} =
Accounts.register_user(%{email: "[email protected]", password: "supersupersecret"})

{:ok, _user_jim} =
Accounts.register_user(%{email: "[email protected]", password: "supersupersecret"})

{:ok, _node} =
Outline.create_node(%{content: "This is my first node"})

{:ok, _node} =
Outline.create_node(%{content: "Second node"})

{:ok, network} =
Podcast.create_network(%{title: "Podcast network"})

{:ok, _show} =
Podcast.create_show(%{title: "Dev Cafe", network_id: network.id})

{:ok, show} =
Podcast.create_show(%{title: "Tech Weekly", network_id: network.id})

{:ok, _episode} =
Podcast.create_episode(%{title: "past episode", show_id: show.id})

{:ok, _episode} =
Podcast.create_episode(%{title: "current episode", show_id: show.id})