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

22 lines
529 B
Elixir
Raw Normal View History

2024-09-18 21:09:09 +00:00
defmodule DrainCloudCore.Auth.Session 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