defmodule OhMyExOhIrcd.Links.Click do
@moduledoc """
One clickthrough on a short link. Immutable event; carries only the
request's own Referer / User-Agent headers (no client IP).
"""
use Ecto.Schema
import Ecto.Changeset
alias OhMyExOhIrcd.Links.ShortLink
@primary_key {:id, :id, autogenerate: true}
schema "short_link_clicks" do
field :referer, :string
field :user_agent, :string
belongs_to :short_link, ShortLink
timestamps(type: :utc_datetime, updated_at: false)
end
def changeset(record, attrs) do
record
|> cast(attrs, [:short_link_id, :referer, :user_agent])
|> validate_required([:short_link_id])
end
end
neiam
/oh-my-ex-oh-ircd
public · Issues · Pulls · Labels · Forks · Compare · Actions success · Badges · Packages
⭐
Log in to mark this repository.
671 B · text
History
4b6fe3b