feat(accounts): add consent settings and organization management

This commit is contained in:
TakuyaYagam1 committed 2026-10-07 13:00:39 +03:00
1 parent 24638d46d2
commit 391af7a1ef
83 files changed
+10198 -613

No files matched your search

@@ -0,0 +1,46 @@
package v1
import (
"testing"
"time"
"github.com/google/uuid"
"lincodex/backend/internal/domain"
"lincodex/backend/internal/port/outbound"
)
func TestConsentCursorTimeBounds(t *testing.T) {
subjectID := uuid.New()
positionID := uuid.New()
for _, grantedAt := range []time.Time{
time.Unix(0, minConsentCursorNanos).UTC(),
time.Unix(0, -1).UTC(),
time.Unix(0, 0).UTC(),
time.Unix(0, maxConsentCursorNanos).UTC(),
} {
t.Run(grantedAt.String(), func(t *testing.T) {
cursor, err := encodeConsentCursor(subjectID, domain.ConsentStateActive, outbound.ConsentListPosition{
GrantedAt: grantedAt, ID: positionID,
})
if err != nil {
t.Fatalf("encode cursor at %s: %v", grantedAt, err)
}
position, state, err := decodeConsentCursor(cursor, subjectID)
if err != nil || !position.GrantedAt.Equal(grantedAt) || position.ID != positionID || state != domain.ConsentStateActive {
t.Fatalf("decode cursor = %#v, %q, %v; want time %s and matching position", position, state, err, grantedAt)
}
})
}
for _, grantedAt := range []time.Time{
time.Unix(0, minConsentCursorNanos).Add(-time.Nanosecond),
time.Unix(0, maxConsentCursorNanos).Add(time.Nanosecond),
} {
if _, err := encodeConsentCursor(subjectID, domain.ConsentStateActive, outbound.ConsentListPosition{
GrantedAt: grantedAt, ID: positionID,
}); err == nil {
t.Fatalf("encode cursor outside Unix-nanosecond range at %s: got nil error", grantedAt)
}
}
}