Rename Tag to Theme across code and schema

Rename the endgame-label concept from Tag to Theme to match the glossary:
the context becomes Chesstrainer.Themes, the schema Chesstrainer.Themes.Theme,
and the Endgame association is :themes. The category enum
(endgame/opening/tactic) is preserved.

Rewrite the original migrations in place so themes / endgames_themes
(with theme_id) are created directly, instead of adding a transition
migration.

Closes #12
This commit is contained in:
2026-11-02 09:14:17 +01:00
parent 645f65f2a3
commit cd2e7f0164
21 changed files with 387 additions and 382 deletions
-26
View File
@@ -1,26 +0,0 @@
defmodule Chesstrainer.TagsFixtures do
@moduledoc """
This module defines test helpers for creating
entities via the `Chesstrainer.Tags` context.
"""
@doc """
Generate a unique tag name.
"""
def unique_tag_name, do: "some name#{System.unique_integer([:positive])}"
@doc """
Generate a tag.
"""
def tag_fixture(attrs \\ %{}) do
{:ok, tag} =
attrs
|> Enum.into(%{
category: :endgame,
name: unique_tag_name()
})
|> Chesstrainer.Tags.create_tag()
tag
end
end
+26
View File
@@ -0,0 +1,26 @@
defmodule Chesstrainer.ThemesFixtures do
@moduledoc """
This module defines test helpers for creating
entities via the `Chesstrainer.Themes` context.
"""
@doc """
Generate a unique theme name.
"""
def unique_theme_name, do: "some name#{System.unique_integer([:positive])}"
@doc """
Generate a theme.
"""
def theme_fixture(attrs \\ %{}) do
{:ok, theme} =
attrs
|> Enum.into(%{
category: :endgame,
name: unique_theme_name()
})
|> Chesstrainer.Themes.create_theme()
theme
end
end