feat: add admin publishing workflow and yar theme

Add Go/Postgres admin APIs, Angular admin UI, manual build flow, asset uploads, markdown import/export, configurable slug generation, and the Yar reading theme. Exclude local docs and generated development artifacts from version control.
This commit is contained in:
yarnom 2026-06-01 15:48:04 +08:00
parent b78f4b39c9
commit f0b50d13ea
121 changed files with 27139 additions and 550 deletions

View file

@ -0,0 +1,35 @@
package admin
import (
"os"
"path/filepath"
"testing"
)
func TestLoadMigrationFiles(t *testing.T) {
dir := t.TempDir()
files := map[string]string{
"002_second.sql": "select 2;",
"001_first.sql": "select 1;",
"notes.txt": "ignored",
}
for name, content := range files {
if err := os.WriteFile(filepath.Join(dir, name), []byte(content), 0o600); err != nil {
t.Fatalf("write fixture: %v", err)
}
}
migrations, err := LoadMigrationFiles(dir)
if err != nil {
t.Fatalf("load migrations: %v", err)
}
if len(migrations) != 2 {
t.Fatalf("expected 2 migrations, got %d", len(migrations))
}
if migrations[0].Version != "001_first.sql" || migrations[1].Version != "002_second.sql" {
t.Fatalf("unexpected migration order: %#v", migrations)
}
if migrations[0].Checksum == "" || migrations[0].Checksum == migrations[1].Checksum {
t.Fatalf("unexpected checksums: %#v", migrations)
}
}