feat: Add cursor-based pagination for subscribers and parameterize test password

- Add ListSubscribersCursor method to Database with ID-based cursor pagination
- Add cursor, hasMore, and nextCursor support for efficient pagination
- Add status, organizationID, and search filters to cursor-based query
- Add limit+1 fetch strategy to detect additional results
- Add fmt import to database/crud.go
- Add TEST_PASSWORD environment variable support in integration tests with default fallback
- Replace hard
This commit is contained in:
nutcas3
2026-05-01 09:04:41 +03:00
parent 4b04048c9b
commit 5b6cee5618
2 changed files with 53 additions and 1 deletions
@@ -5,6 +5,7 @@ import (
"encoding/json"
"net/http"
"net/http/httptest"
"os"
"testing"
"github.com/gin-gonic/gin"
@@ -68,7 +69,11 @@ func setupTest(t *testing.T) *TestSetup {
for _, user := range testUsers {
// Hash the password properly for testing
hashedPassword, err := bcrypt.GenerateFromPassword([]byte("password123"), bcrypt.DefaultCost)
testPassword := os.Getenv("TEST_PASSWORD")
if testPassword == "" {
testPassword = "default_test_password_change_me"
}
hashedPassword, err := bcrypt.GenerateFromPassword([]byte(testPassword), bcrypt.DefaultCost)
require.NoError(t, err)
user.Password = string(hashedPassword)
err = db.Create(user).Error