Fakultas Ilmu Komputer UI

Commit 96a396ff authored by Muhammad Rafif Elfazri's avatar Muhammad Rafif Elfazri
Browse files

Create seeds for dev

parent f48013bb
......@@ -10,23 +10,25 @@
# We recommend using the bang functions (`insert!`, `update!`
# and so on) as they will fail if something goes wrong.
alias Diskuy.Repo
alias Diskuy.Account.User
alias Diskuy.Forum.Topic
alias Diskuy.Forum.Thread
alias Diskuy.Forum
alias Diskuy.Account
# Repo.insert!(%User{
# username: "rafif",
# email: "rafif@gmail.com"
# })
# Repo.insert!(%Topic{
# name: "Gaming",
# })
# Repo.insert!(%Thread{
# title: "Klee Gaming",
# points: 0,
# topic_id: "86284ef4-a22e-4c4b-8e46-212fa8a7a3f3",
# user_id: "rafif@gmail.com"
# })
{:ok, user} = Account.create_user(%{"username" => "admin",
"email" => "admin@gmail.com",
"picture" => "None"})
{:ok, topic} = Forum.create_topic(%{"name" => "random"})
Enum.each(0..200, fn(_x) ->
Forum.create_thread(
%{
"title" => :crypto.strong_rand_bytes(32) |> Base.encode64 |> binary_part(0, 32),
"points" => 0,
"content" => :crypto.strong_rand_bytes(32) |> Base.encode64 |> binary_part(0, 32),
"topic_id" => topic.id,
"user_id" => user.id
}
)
end)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment