feat(invitations): accept invitations with C4 consent and contact grants; share the E0 quota across holdings
This commit is contained in:
1 parent
a5990d3fc6
commit
676b3c6e24
59 files changed
+4926
-194
No files matched your search
@@ -16,6 +16,7 @@ import (
|
||||
"lincodex/backend/internal/domain"
|
||||
"lincodex/backend/internal/port/outbound"
|
||||
"lincodex/backend/internal/usecase/candidateview"
|
||||
"lincodex/backend/internal/usecase/consent"
|
||||
)
|
||||
|
||||
type testKeyring struct{}
|
||||
@@ -47,6 +48,16 @@ type testState struct {
|
||||
// the decline outcomes kept under a key.
|
||||
declines map[uuid.UUID]domain.InvitationDecline
|
||||
declineResults map[[outbound.IdempotencyDigestSize]byte]outbound.InvitationDeclineResult
|
||||
// grants holds the contact grants by invitation, acceptResults the
|
||||
// acceptance outcomes by key, and consentRecords the C4 records by
|
||||
// invitation. profiles and publications are the candidates' profiles and
|
||||
// publication settings, and hidden the hidden organizations by candidate.
|
||||
grants map[uuid.UUID]domain.ContactGrant
|
||||
acceptResults map[[outbound.IdempotencyDigestSize]byte]outbound.InvitationAcceptResult
|
||||
consentRecords map[uuid.UUID]domain.ConsentRecord
|
||||
profiles map[uuid.UUID]domain.CandidateProfile
|
||||
publications map[uuid.UUID]domain.Publication
|
||||
hidden map[[2]uuid.UUID]bool
|
||||
// charged lists the invitations charged against the organization quota,
|
||||
// and notified the delivered invitations that were notified.
|
||||
charged []uuid.UUID
|
||||
@@ -63,6 +74,12 @@ func newTestState() testState {
|
||||
needVersions: map[[3]string]bool{},
|
||||
declines: map[uuid.UUID]domain.InvitationDecline{},
|
||||
declineResults: map[[outbound.IdempotencyDigestSize]byte]outbound.InvitationDeclineResult{},
|
||||
grants: map[uuid.UUID]domain.ContactGrant{},
|
||||
acceptResults: map[[outbound.IdempotencyDigestSize]byte]outbound.InvitationAcceptResult{},
|
||||
consentRecords: map[uuid.UUID]domain.ConsentRecord{},
|
||||
profiles: map[uuid.UUID]domain.CandidateProfile{},
|
||||
publications: map[uuid.UUID]domain.Publication{},
|
||||
hidden: map[[2]uuid.UUID]bool{},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,6 +116,24 @@ func (state testState) clone() testState {
|
||||
for scope, result := range state.declineResults {
|
||||
cloned.declineResults[scope] = result
|
||||
}
|
||||
for id, grant := range state.grants {
|
||||
cloned.grants[id] = grant
|
||||
}
|
||||
for scope, result := range state.acceptResults {
|
||||
cloned.acceptResults[scope] = result
|
||||
}
|
||||
for id, record := range state.consentRecords {
|
||||
cloned.consentRecords[id] = record
|
||||
}
|
||||
for id, profile := range state.profiles {
|
||||
cloned.profiles[id] = profile
|
||||
}
|
||||
for id, publication := range state.publications {
|
||||
cloned.publications[id] = publication
|
||||
}
|
||||
for key, hidden := range state.hidden {
|
||||
cloned.hidden[key] = hidden
|
||||
}
|
||||
cloned.charged = slices.Clone(state.charged)
|
||||
cloned.notified = slices.Clone(state.notified)
|
||||
return cloned
|
||||
@@ -417,6 +452,7 @@ func newHarness(t *testing.T) *harness {
|
||||
return outbound.CompanyQuotaDecision{Allowed: true}, nil
|
||||
},
|
||||
Notifier: testNotifier{},
|
||||
Consents: consent.NewService(test.transactor, func() time.Time { return current }),
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("NewService() error = %v", err)
|
||||
|
||||
Reference in new issue
Block a user