draincloud-beam-core/lib/draincloud_core/auth/sessions.ex

22 lines
534 B
Elixir

defmodule DrainCloudCore.Auth.SessionsRepo do
use Ecto.Schema
import Ecto.Changeset
import Ecto.Query
schema "sessions" do
field :token, :string
field :user_id, :id
field :user_agent, :string
field :created_at, :utc_datetime
field :expires_at, :utc_datetime
end
def changeset(session, params \\ %{}) do
session
|> cast(params, [:id, :token, :user_id, :user_agent, :created_at, :expires_at])
|> validate_required([:id, :token, :user_id, :user_agent, :created_at, :expires_at])
end
end