refactor backend packages and global db service

This commit is contained in:
2026-07-18 21:58:15 +08:00
parent 62bd3d0455
commit 7800b07d42
51 changed files with 719 additions and 647 deletions

View File

@@ -0,0 +1,24 @@
//go:build integration
package models
import (
"os"
"testing"
"github.com/stretchr/testify/require"
)
func TestPostgresPing(t *testing.T) {
dsn := os.Getenv("DATABASE_DSN")
if dsn == "" {
dsn = os.Getenv("DATABASE_URL")
}
require.NotEmpty(t, dsn, "DATABASE_DSN or DATABASE_URL is required for integration tests")
database, err := Open(dsn)
require.NoError(t, err)
sqlDB, err := database.DB()
require.NoError(t, err)
require.NoError(t, sqlDB.Ping())
}