architex/lib/matrix_server/quick_check.ex
2021-08-06 23:14:27 +02:00

14 lines
487 B
Elixir

defmodule MatrixServer.QuickCheck do
import Ecto.Query
alias MatrixServer.{Repo, Room, Account, RoomServer}
alias MatrixServerWeb.Request.CreateRoom
def create_room(name \\ nil, topic \\ nil) do
account = Repo.one!(from a in Account, limit: 1)
input = %CreateRoom{name: name, topic: topic}
%Room{id: room_id} = Repo.insert!(Room.create_changeset(input))
{:ok, pid} = RoomServer.get_room_server(room_id)
RoomServer.create_room(pid, account, input)
end
end