added seasons list

This commit is contained in:
2026-02-01 13:25:11 +11:00
parent 96d534f045
commit 81d4ceb354
17 changed files with 660 additions and 679 deletions

View File

@@ -38,6 +38,7 @@ func setupHttpServer(
"/static/js/toasts.js",
"/static/js/copytoclipboard.js",
"/static/js/theme.js",
"/static/js/pagination.js",
"/static/vendored/htmx@2.0.8.min.js",
"/static/vendored/htmx-ext-ws.min.js",
"/static/vendored/alpinejs@3.15.4.min.js",

View File

@@ -51,13 +51,14 @@ func migrateUp(ctx context.Context, migrator *migrate.Migrator, conn *bun.DB, cf
fmt.Println("[INFO] Migration validation passed ✓")
fmt.Println("[INFO] Step 2/5: Checking for pending migrations...")
// Check for pending migrations
group, err := migrator.Migrate(ctx, migrate.WithNopMigration())
// Check for pending migrations using MigrationsWithStatus (read-only)
ms, err := migrator.MigrationsWithStatus(ctx)
if err != nil {
return errors.Wrap(err, "check pending migrations")
return errors.Wrap(err, "get migration status")
}
if group.IsZero() {
unapplied := ms.Unapplied()
if len(unapplied) == 0 {
fmt.Println("[INFO] No pending migrations")
return nil
}
@@ -88,7 +89,7 @@ func migrateUp(ctx context.Context, migrator *migrate.Migrator, conn *bun.DB, cf
// Run migrations
fmt.Println("[INFO] Step 5/5: Applying migrations...")
group, err = migrator.Migrate(ctx)
group, err := migrator.Migrate(ctx)
if err != nil {
return errors.Wrap(err, "migrate")
}
@@ -290,13 +291,13 @@ import (
func init() {
Migrations.MustRegister(
// UP migration - TODO: Implement
func(ctx context.Context, db *bun.DB) error {
// UP migration
func(ctx context.Context, dbConn *bun.DB) error {
// TODO: Add your migration code here
return nil
},
// DOWN migration - TODO: Implement
func(ctx context.Context, db *bun.DB) error {
// DOWN migration
func(ctx context.Context, dbConn *bun.DB) error {
// TODO: Add your rollback code here
return nil
},

View File

@@ -62,6 +62,16 @@ func addRoutes(
Handler: handlers.NotifyTester(s),
// TODO: add login protection
},
{
Path: "/seasons",
Method: hws.MethodGET,
Handler: handlers.SeasonsPage(s, conn),
},
{
Path: "/seasons",
Method: hws.MethodPOST,
Handler: handlers.SeasonsList(s, conn),
},
}
htmxRoutes := []hws.Route{