fixup! chore(chat): create more chats/messages + set membership
This commit is contained in:
parent
7f510ba9c7
commit
2063870a9e
@ -62,10 +62,13 @@ rooms_and_messages = [
|
|||||||
room: %{name: "the-shire", topic: "A peaceful place for hobbits"},
|
room: %{name: "the-shire", topic: "A peaceful place for hobbits"},
|
||||||
messages: [
|
messages: [
|
||||||
{frodo, "What news of the outside world? Tell me everything!"},
|
{frodo, "What news of the outside world? Tell me everything!"},
|
||||||
{gandalf, "What can I tell you? Life in the wide world goes on much as it has this past Age..."},
|
{gandalf,
|
||||||
{gandalf, "Full of its own comings and goings, scarcely aware of the existence of Hobbits..."},
|
"What can I tell you? Life in the wide world goes on much as it has this past Age..."},
|
||||||
|
{gandalf,
|
||||||
|
"Full of its own comings and goings, scarcely aware of the existence of Hobbits..."},
|
||||||
{frodo, "You're late!"},
|
{frodo, "You're late!"},
|
||||||
{gandalf, "A wizard is never late, Frodo Baggins. Nor is he early. He arrives precisely when he means to."}
|
{gandalf,
|
||||||
|
"A wizard is never late, Frodo Baggins. Nor is he early. He arrives precisely when he means to."}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
# Moria Room
|
# Moria Room
|
||||||
@ -95,11 +98,13 @@ rooms_and_messages = [
|
|||||||
|
|
||||||
for %{room: room, messages: messages} <- rooms_and_messages do
|
for %{room: room, messages: messages} <- rooms_and_messages do
|
||||||
room = Room |> struct(room) |> Repo.insert!()
|
room = Room |> struct(room) |> Repo.insert!()
|
||||||
|
|
||||||
users =
|
users =
|
||||||
for {user, message} <- messages do
|
for {user, message} <- messages do
|
||||||
Repo.insert!(%Message{user: user, room: room, body: message})
|
Repo.insert!(%Message{user: user, room: room, body: message})
|
||||||
user
|
user
|
||||||
end
|
end
|
||||||
|
|
||||||
for user <- MapSet.new(users) do
|
for user <- MapSet.new(users) do
|
||||||
Repo.insert!(%RoomMembership{user: user, room: room})
|
Repo.insert!(%RoomMembership{user: user, room: room})
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user