cover/Elixir.DaProductApp.Transactions.ReqChkTxnEvent.html

1 defmodule DaProductApp.Transactions.ReqChkTxnEvent do
2 @moduledoc """
3 Event rows for ReqChkTxn lifecycle. Stores seq, event_type, payload and
4 hashed request/response XML for compact audit.
5 """
6
7 use Ecto.Schema
8 import Ecto.Changeset
9
10 22 schema "req_chk_txn_events" do
11 field :req_chk_txn_id, :integer
12 field :transaction_id, :integer
13 field :seq, :integer
14 field :event_type, :string
15 field :payload, :map
16 field :prev_hash, :binary
17 field :hash, :binary
18 field :req_xml_hash, :binary
19 field :resp_xml_hash, :binary
20
21 timestamps(type: :utc_datetime)
22 end
23
24 @required ~w(req_chk_txn_id transaction_id seq event_type hash)a
25
26 def changeset(struct, attrs) do
27 struct
28 |> cast(attrs, [:req_chk_txn_id, :transaction_id, :seq, :event_type, :payload, :prev_hash, :hash, :req_xml_hash, :resp_xml_hash])
29 1 |> validate_required(@required)
30 end
31 end
Line Hits Source