remove step contexts and context notes
This commit is contained in:
		| @@ -5,8 +5,7 @@ defmodule Memex.Pipelines.Step do | ||||
|   use Ecto.Schema | ||||
|   import Ecto.Changeset | ||||
|   alias Ecto.{Changeset, UUID} | ||||
|   alias Memex.{Accounts.User, Contexts.Context} | ||||
|   alias Memex.Pipelines.{Pipeline, StepContext} | ||||
|   alias Memex.{Accounts.User, Pipelines.Pipeline} | ||||
|  | ||||
|   @primary_key {:id, :binary_id, autogenerate: true} | ||||
|   @foreign_key_type :binary_id | ||||
| @@ -18,8 +17,6 @@ defmodule Memex.Pipelines.Step do | ||||
|     belongs_to :pipeline, Pipeline | ||||
|     belongs_to :user, User | ||||
|  | ||||
|     many_to_many :contexts, Context, join_through: StepContext | ||||
|  | ||||
|     timestamps() | ||||
|   end | ||||
|  | ||||
|   | ||||
| @@ -1,41 +0,0 @@ | ||||
| defmodule Memex.Pipelines.StepContext do | ||||
|   @moduledoc """ | ||||
|   Represents a has-many relation between a step and related contexts | ||||
|   """ | ||||
|  | ||||
|   use Ecto.Schema | ||||
|   import Ecto.Changeset | ||||
|   alias Ecto.{Changeset, UUID} | ||||
|   alias Memex.{Contexts.Context, Pipelines.Step} | ||||
|  | ||||
|   @primary_key {:id, :binary_id, autogenerate: true} | ||||
|   @foreign_key_type :binary_id | ||||
|   schema "step_contexts" do | ||||
|     belongs_to :step, Step | ||||
|     belongs_to :context, Context | ||||
|  | ||||
|     timestamps() | ||||
|   end | ||||
|  | ||||
|   @type t :: %__MODULE__{ | ||||
|           step: Step.t() | Ecto.Association.NotLoaded.t(), | ||||
|           step_id: Step.id(), | ||||
|           context: Context.t() | Ecto.Association.NotLoaded.t(), | ||||
|           context_id: Context.id(), | ||||
|           inserted_at: NaiveDateTime.t(), | ||||
|           updated_at: NaiveDateTime.t() | ||||
|         } | ||||
|   @type id :: UUID.t() | ||||
|   @type changeset :: Changeset.t(t()) | ||||
|  | ||||
|   @doc false | ||||
|   @spec create_changeset(Step.t(), Context.t()) :: changeset() | ||||
|   def create_changeset( | ||||
|         %Step{id: step_id, user_id: user_id}, | ||||
|         %Context{id: context_id, user_id: user_id} | ||||
|       ) do | ||||
|     %__MODULE__{} | ||||
|     |> change(step_id: step_id, context_id: context_id) | ||||
|     |> validate_required([:step_id, :context_id]) | ||||
|   end | ||||
| end | ||||
		Reference in New Issue
	
	Block a user