port over some more

This commit is contained in:
ra
2026-02-14 23:58:01 -07:00
parent 0222be36c5
commit 61176cd416
107 changed files with 9124 additions and 375 deletions

View File

@@ -0,0 +1,32 @@
defmodule Odinsea.Database.Schema.BbsThread do
@moduledoc """
Ecto schema for the bbs_threads table.
Represents guild BBS threads.
"""
use Ecto.Schema
import Ecto.Changeset
@primary_key {:threadid, :id, autogenerate: true}
schema "bbs_threads" do
field :postercid, :integer
field :name, :string, default: ""
field :timestamp, :integer
field :icon, :integer
field :startpost, :string
field :guildid, :integer
field :localthreadid, :integer
has_many :bbs_replies, Odinsea.Database.Schema.BbsReply, foreign_key: :threadid
end
@doc """
Changeset for creating a BBS thread.
"""
def creation_changeset(bbs_thread, attrs) do
bbs_thread
|> cast(attrs, [:postercid, :name, :timestamp, :icon, :startpost, :guildid, :localthreadid])
|> validate_required([:postercid, :timestamp, :guildid, :localthreadid])
end
end