fixup! chore(chat): create more chats/messages + set membership

This commit is contained in:
João Paulo Dubas 2025-02-04 23:40:23 +00:00
parent 7f510ba9c7
commit 2063870a9e
Signed by: joao.dubas
SSH Key Fingerprint: SHA256:V1mixgOGRc/YMhGx/DNkOSmJxgA2vHNrDZEk3wt/kOA

View File

@ -62,10 +62,13 @@ rooms_and_messages = [
room: %{name: "the-shire", topic: "A peaceful place for hobbits"},
messages: [
{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, "Full of its own comings and goings, scarcely aware of the existence of Hobbits..."},
{gandalf,
"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!"},
{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
@ -95,11 +98,13 @@ rooms_and_messages = [
for %{room: room, messages: messages} <- rooms_and_messages do
room = Room |> struct(room) |> Repo.insert!()
users =
for {user, message} <- messages do
Repo.insert!(%Message{user: user, room: room, body: message})
user
end
for user <- MapSet.new(users) do
Repo.insert!(%RoomMembership{user: user, room: room})
end