Add start of controller testing
This commit is contained in:
parent
598af7a884
commit
096c99df92
14 changed files with 106 additions and 87 deletions
|
@ -38,9 +38,13 @@ defmodule MatrixServer.Account do
|
|||
|> Multi.insert(:device, fn %{account: account} ->
|
||||
device_id = Device.generate_device_id(account.localpart)
|
||||
|
||||
# TODO: fix device_id with UUID
|
||||
params =
|
||||
Map.update(params, :device_id, device_id, fn
|
||||
nil -> device_id
|
||||
x -> x
|
||||
end)
|
||||
|
||||
Ecto.build_assoc(account, :devices)
|
||||
|> Map.put(:device_id, device_id)
|
||||
|> Device.changeset(params)
|
||||
end)
|
||||
|> Multi.run(:device_with_access_token, &Device.insert_new_access_token/2)
|
||||
|
|
|
@ -40,6 +40,7 @@ defmodule MatrixServer.Device do
|
|||
end
|
||||
|
||||
def generate_device_id(localpart) do
|
||||
# TODO: use random string instead
|
||||
time_string =
|
||||
DateTime.utc_now()
|
||||
|> DateTime.to_unix()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue