chore-tracker/priv/repo/seeds.exs

78 lines
1.6 KiB
Elixir

# Script for populating the database. You can run it as:
#
# mix run priv/repo/seeds.exs
#
# Inside the script, you can read and write to any of your
# repositories directly:
#
# ChoreTracker.Repo.insert!(%ChoreTracker.SomeSchema{})
#
# We recommend using the bang functions (`insert!`, `update!`
# and so on) as they will fail if something goes wrong.
ondrej =
ChoreTracker.Accounts.register_user(
%{
username: "ondrej",
email: "ondrej@jednota.party",
password: "secret",
display_name: "Ondřej"
},
disable_password_validation: true
)
matej =
ChoreTracker.Accounts.register_user(
%{
username: "matej",
email: "matej@jednota.party",
password: "secret",
display_name: "Matěj"
},
disable_password_validation: true
)
valentyna =
ChoreTracker.Accounts.register_user(
%{
username: "valentyna",
email: "valentyna@jednota.party",
password: "secret",
display_name: "Valentýna"
},
disable_password_validation: true
)
ChoreTracker.Chores.create_chore(%{
name: "Uklidit kuchyň",
emoji: "🔪",
period: 2,
period_unit: :week,
description: """
- Umýt sporák
- Umýt lednici
- Vytřít podlahu
""",
scheduled_at: Date.utc_today(),
assignees: [
ondrej,
matej,
valentyna
]
})
ChoreTracker.Chores.create_chore(%{
name: "Uklidit obývák",
emoji: "🧹",
period: 1,
period_unit: :month,
description: """
- Vyluxovat
- Vytřít podlahu
""",
scheduled_at: Date.utc_today(),
assignees: [
ondrej,
matej
]
})