Add public codes for player URLs and admin endgame search

Player-facing endgame links now use a 10-character Crockford base32 public code instead of the database UUID; admin routes keep the UUID. Existing rows are backfilled by migration, and the admin Show page displays and copies the code.

The admin endgame index gains its own search box: exact database id, exact public code, or a FEN / FEN fragment. A single match opens the endgame; multiple matches list below; nothing found says so.

Closes #44
Closes #45
This commit is contained in:
2026-11-03 22:46:38 +01:00
parent 160e8629b7
commit 49736d186c
18 changed files with 544 additions and 64 deletions
@@ -38,7 +38,7 @@ defmodule ChesstrainerWeb.EndgameLive.FormTest do
attrs = %{fen: @fen, color: :white, result: :win, rating: 1625}
{:ok, endgame} = Endgames.create_endgame(attrs)
{:ok, view, _html} = live(conn, ~p"/admin/endgames/#{endgame}/edit")
{:ok, view, _html} = live(conn, ~p"/admin/endgames/#{endgame.id}/edit")
html = view |> element("#endgame-form input[name='endgame[rating]']") |> render()
@@ -103,7 +103,7 @@ defmodule ChesstrainerWeb.EndgameLive.FormTest do
attrs = %{fen: @fen, color: :white, result: :win, rating: 1500}
{:ok, endgame} = Endgames.create_endgame(attrs, [theme])
{:ok, view, _html} = live(conn, ~p"/admin/endgames/#{endgame}/edit")
{:ok, view, _html} = live(conn, ~p"/admin/endgames/#{endgame.id}/edit")
assert render(view) =~ "Lucena"