port over some more
This commit is contained in:
34
lib/odinsea/database/schema/donor_log.ex
Normal file
34
lib/odinsea/database/schema/donor_log.ex
Normal file
@@ -0,0 +1,34 @@
|
||||
defmodule Odinsea.Database.Schema.DonorLog do
|
||||
@moduledoc """
|
||||
Ecto schema for the donorlog table.
|
||||
Represents donation transaction logs.
|
||||
"""
|
||||
|
||||
use Ecto.Schema
|
||||
import Ecto.Changeset
|
||||
|
||||
@primary_key {:id, :id, autogenerate: true}
|
||||
|
||||
schema "donorlog" do
|
||||
field :accname, :string, default: ""
|
||||
field :acc_id, :integer, default: 0, source: :accId
|
||||
field :chrname, :string, default: ""
|
||||
field :chr_id, :integer, default: 0, source: :chrId
|
||||
field :log, :string, default: ""
|
||||
field :time, :string, default: ""
|
||||
field :previous_points, :integer, default: 0, source: :previousPoints
|
||||
field :current_points, :integer, default: 0, source: :currentPoints
|
||||
end
|
||||
|
||||
@doc """
|
||||
Changeset for creating a donor log entry.
|
||||
"""
|
||||
def changeset(donor_log, attrs) do
|
||||
donor_log
|
||||
|> cast(attrs, [
|
||||
:accname, :acc_id, :chrname, :chr_id, :log, :time,
|
||||
:previous_points, :current_points
|
||||
])
|
||||
|> validate_required([:acc_id])
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user