29 lines
734 B
Elixir
29 lines
734 B
Elixir
defmodule Odinsea.Database.Schema.MtsItem do
|
|
@moduledoc """
|
|
Ecto schema for the mts_items table.
|
|
Represents MTS (Maple Trading System) listings.
|
|
"""
|
|
|
|
use Ecto.Schema
|
|
import Ecto.Changeset
|
|
|
|
@primary_key {:id, :integer, autogenerate: false}
|
|
|
|
schema "mts_items" do
|
|
field :tab, :integer, default: 1
|
|
field :price, :integer, default: 0
|
|
field :characterid, :integer, default: 0
|
|
field :seller, :string, default: ""
|
|
field :expiration, :integer, default: 0
|
|
end
|
|
|
|
@doc """
|
|
Changeset for creating an MTS item listing.
|
|
"""
|
|
def changeset(mts_item, attrs) do
|
|
mts_item
|
|
|> cast(attrs, [:id, :tab, :price, :characterid, :seller, :expiration])
|
|
|> validate_required([:id, :characterid])
|
|
end
|
|
end
|