feat(accounts): add admin accounts and user preferences

Remove public registration, support administrator-managed accounts, and persist personal preferences.

Refs #2 #5

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-11-20 19:54:06 +01:00
parent 1b0625f91c
commit 50bde816ed
46 changed files with 1362 additions and 256 deletions

View File

@ -0,0 +1,18 @@
package models
import (
"github.com/gin-gonic/gin/binding"
"testing"
)
func TestPreferencesValidation(t *testing.T) {
for _, language := range []string{"fr", "en", "de", "", "FR"} {
for _, mode := range []string{"title", "title_content", "unknown", ""} {
p := UserPreferences{Language: language, RankingMode: mode}
wantValid := (language == "fr" || language == "en") && (mode == "title" || mode == "title_content")
if err := binding.Validator.ValidateStruct(p); (err == nil) != wantValid {
t.Fatalf("%+v: valid=%v error=%v", p, wantValid, err)
}
}
}
}