1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Conversation do
7 alias Pleroma.Conversation.Participation
11 schema "conversations" do
12 field(:ap_id, :string)
13 has_many(:participations, Participation)
18 def creation_cng(struct, params) do
20 |> cast(params, [:ap_id])
21 |> validate_required([:ap_id])
22 |> unique_constraint(:ap_id)
25 def create_for_ap_id(ap_id) do
27 |> creation_cng(%{ap_id: ap_id})