feat: more completeness of spec and start at embedding

This commit is contained in:
2026-04-24 07:57:28 +02:00
parent d04117abdc
commit 88f966dae9
10 changed files with 1105 additions and 32 deletions

View File

@@ -0,0 +1,24 @@
defmodule BDS.Embeddings.DismissedDuplicatePair do
@moduledoc false
use Ecto.Schema
import Ecto.Changeset
@primary_key {:id, :string, autogenerate: false}
@foreign_key_type :string
schema "dismissed_duplicate_pairs" do
belongs_to :project, BDS.Projects.Project, type: :string
field :post_id_a, :string
field :post_id_b, :string
field :dismissed_at, :integer
end
def changeset(pair, attrs) do
pair
|> cast(attrs, [:id, :project_id, :post_id_a, :post_id_b, :dismissed_at])
|> validate_required([:id, :project_id, :post_id_a, :post_id_b, :dismissed_at])
|> foreign_key_constraint(:project_id)
|> unique_constraint(:post_id_a, name: :dismissed_pairs_idx)
end
end