defmodule OhMyExOhIrcd.Images.RequestLog do
@moduledoc """
Append-only log of authenticated ImgServ API requests and their outcome,
for debugging from the channel's image page. Only requests that pass
token auth are logged, so an empty log points at the URL or token rather
than the channel config.
"""
use Ecto.Schema
import Ecto.Changeset
alias OhMyExOhIrcd.Channels.ChannelRecord
schema "image_request_logs" do
field :who, :string
field :status, :string
field :detail, :string
belongs_to :channel, ChannelRecord
timestamps(type: :utc_datetime, updated_at: false)
end
def changeset(record, attrs) do
record
|> cast(attrs, [:channel_id, :who, :status, :detail])
|> validate_required([:channel_id, :status])
|> validate_length(:who, max: 64)
|> validate_length(:detail, max: 256)
end
end
neiam
/oh-my-ex-oh-ircd
public · Issues · Pulls · Labels · Forks · Compare · Actions success · Badges · Packages
⭐
Log in to mark this repository.
860 B · text
History
4b6fe3b