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