oc fixes
This commit is contained in:
parent
02d6262a08
commit
4baafe313d
3 changed files with 3 additions and 11 deletions
|
|
@ -99,16 +99,9 @@ defmodule Pleroma.Web.OAuth.Token do
|
||||||
|
|
||||||
@spec update_activity(Token.t()) :: {:ok, Token.t()} | {:error, Ecto.Changeset.t()}
|
@spec update_activity(Token.t()) :: {:ok, Token.t()} | {:error, Ecto.Changeset.t()}
|
||||||
def update_activity(token) do
|
def update_activity(token) do
|
||||||
last_active = NaiveDateTime.utc_now()
|
token
|
||||||
|
|> Ecto.Changeset.change(last_active: NaiveDateTime.utc_now())
|
||||||
changeset = Ecto.Changeset.change(token)
|
|> Repo.update()
|
||||||
|
|
||||||
changeset
|
|
||||||
|> change(%{last_active: last_active})
|
|
||||||
|> validate_required([:last_active])
|
|
||||||
|> Repo.insert()
|
|
||||||
|
|
||||||
{:ok, token}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@spec create(App.t(), User.t(), map()) :: {:ok, Token.t()} | {:error, Ecto.Changeset.t()}
|
@spec create(App.t(), User.t(), map()) :: {:ok, Token.t()} | {:error, Ecto.Changeset.t()}
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ defmodule Pleroma.Repo.Migrations.CreateOAuthToken do
|
||||||
add(:token, :string)
|
add(:token, :string)
|
||||||
add(:refresh_token, :string)
|
add(:refresh_token, :string)
|
||||||
add(:valid_until, :naive_datetime_usec)
|
add(:valid_until, :naive_datetime_usec)
|
||||||
add(:last_active, :naive_datetime_usec)
|
|
||||||
|
|
||||||
timestamps()
|
timestamps()
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue