feat(accounts): add consent settings and organization management
This commit is contained in:
1 parent
24638d46d2
commit
391af7a1ef
83 files changed
+10198
-613
No files matched your search
@@ -9,6 +9,8 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
|
||||
postgresadapter "lincodex/backend/internal/adapter/secondary/postgres"
|
||||
)
|
||||
|
||||
const mailRetryMigrationVersion = 17
|
||||
@@ -23,6 +25,7 @@ func TestMailRetryMigrationKeepsAnAppendOnlyAudit(t *testing.T) {
|
||||
if _, err := migrator.Up(ctx); err != nil {
|
||||
t.Fatalf("Up() error = %v", err)
|
||||
}
|
||||
rollBackToMailRetryVersion(ctx, t, migrator)
|
||||
|
||||
deliveryID := uuid.New()
|
||||
decidedAt := time.Date(2026, 10, 7, 12, 0, 0, 0, time.UTC)
|
||||
@@ -62,6 +65,42 @@ func TestMailRetryMigrationKeepsAnAppendOnlyAudit(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func rollBackToMailRetryVersion(ctx context.Context, t *testing.T, migrator *postgresadapter.Migrator) {
|
||||
t.Helper()
|
||||
for {
|
||||
statuses, err := migrator.Status(ctx)
|
||||
if err != nil {
|
||||
t.Fatalf("Status() while preparing migration %d: %v", mailRetryMigrationVersion, err)
|
||||
}
|
||||
mailRetryApplied := false
|
||||
laterMigrationApplied := false
|
||||
for _, status := range statuses {
|
||||
if !status.Applied {
|
||||
continue
|
||||
}
|
||||
if status.Version == mailRetryMigrationVersion {
|
||||
mailRetryApplied = true
|
||||
}
|
||||
if status.Version > mailRetryMigrationVersion {
|
||||
laterMigrationApplied = true
|
||||
}
|
||||
}
|
||||
if !mailRetryApplied {
|
||||
t.Fatalf("migration %d is not applied", mailRetryMigrationVersion)
|
||||
}
|
||||
if !laterMigrationApplied {
|
||||
return
|
||||
}
|
||||
result, err := migrator.DownOne(ctx)
|
||||
if err != nil {
|
||||
t.Fatalf("DownOne() while preparing migration %d: %v", mailRetryMigrationVersion, err)
|
||||
}
|
||||
if result.Version <= mailRetryMigrationVersion {
|
||||
t.Fatalf("DownOne() rolled back migration %d while preparing migration %d", result.Version, mailRetryMigrationVersion)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func containsAll(value string, fragments ...string) bool {
|
||||
for _, fragment := range fragments {
|
||||
if !strings.Contains(value, fragment) {
|
||||
|
||||
Reference in new issue
Block a user