feat(identity): confirm registration email atomically
This commit is contained in:
1 parent
8e7ce8d71c
commit
fade4e76e4
75 files changed
+4188
-403
No files matched your search
@@ -153,13 +153,15 @@ func (service *Service) GrantAtRegistration(
|
||||
ctx context.Context,
|
||||
repositories outbound.ConsentRepositories,
|
||||
subjectID uuid.UUID,
|
||||
registrationVersion int64,
|
||||
version domain.ConsentTextVersion,
|
||||
) (GrantResult, error) {
|
||||
result, err := service.grant(ctx, repositories, grantRequest{
|
||||
subjectID: subjectID,
|
||||
purpose: domain.ConsentPurposePersonalData,
|
||||
version: version,
|
||||
source: domain.ConsentSourceRegistration,
|
||||
subjectID: subjectID,
|
||||
purpose: domain.ConsentPurposePersonalData,
|
||||
version: version,
|
||||
source: domain.ConsentSourceRegistration,
|
||||
registrationVersion: registrationVersion,
|
||||
})
|
||||
if err != nil {
|
||||
return GrantResult{}, fmt.Errorf("Service.GrantAtRegistration - %w", err)
|
||||
@@ -236,10 +238,11 @@ func (service *Service) GrantInSettingsInNewTransaction(ctx context.Context, inp
|
||||
// grantRequest is a grant of C1, C2, C3, or C5 with its source, which the
|
||||
// public entry points fix.
|
||||
type grantRequest struct {
|
||||
subjectID uuid.UUID
|
||||
purpose domain.ConsentPurpose
|
||||
version domain.ConsentTextVersion
|
||||
source domain.ConsentSource
|
||||
subjectID uuid.UUID
|
||||
purpose domain.ConsentPurpose
|
||||
version domain.ConsentTextVersion
|
||||
source domain.ConsentSource
|
||||
registrationVersion int64
|
||||
}
|
||||
|
||||
func (service *Service) grant(ctx context.Context, repositories outbound.ConsentRepositories, request grantRequest) (GrantResult, error) {
|
||||
@@ -259,12 +262,13 @@ func (service *Service) grant(ctx context.Context, repositories outbound.Consent
|
||||
return GrantResult{}, fmt.Errorf("check text version: %w", err)
|
||||
}
|
||||
grant, err := domain.NewConsentGrant(domain.ConsentGrantInput{
|
||||
SubjectID: request.subjectID,
|
||||
Purpose: request.purpose,
|
||||
TextVersion: text.Version(),
|
||||
TextHash: text.Hash(),
|
||||
Source: request.source,
|
||||
GrantedAt: now,
|
||||
SubjectID: request.subjectID,
|
||||
Purpose: request.purpose,
|
||||
TextVersion: text.Version(),
|
||||
TextHash: text.Hash(),
|
||||
Source: request.source,
|
||||
RegistrationVersion: request.registrationVersion,
|
||||
GrantedAt: now,
|
||||
})
|
||||
if err != nil {
|
||||
return GrantResult{}, fmt.Errorf("build grant: %w", err)
|
||||
|
||||
Reference in new issue
Block a user