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
@@ -33,6 +33,10 @@ var (
|
||||
// ErrMembershipNotFound reports that the account has no membership in the
|
||||
// organization, in any state.
|
||||
ErrMembershipNotFound = errors.New("membership not found")
|
||||
|
||||
// ErrOrganizationCreationResultNotFound reports a missing immutable result
|
||||
// snapshot for a live organization creation idempotency record.
|
||||
ErrOrganizationCreationResultNotFound = errors.New("organization creation result not found")
|
||||
)
|
||||
|
||||
// MaxOrganizationPageSize matches the largest page of the contract.
|
||||
@@ -65,6 +69,16 @@ type OrganizationRepository interface {
|
||||
// ErrUserNotFound, and the caller's transaction is aborted.
|
||||
CreateWithOwner(ctx context.Context, organization domain.Organization, owner domain.Membership) error
|
||||
|
||||
// SaveCreationResult stores the immutable domain snapshot returned by the
|
||||
// original create command. The scope is the HMAC key of a live generic
|
||||
// idempotency record. The snapshot is bounded and expires with that record;
|
||||
// it does not follow later profile edits or membership changes.
|
||||
SaveCreationResult(ctx context.Context, scope [IdempotencyDigestSize]byte, result OrganizationCreationResult) error
|
||||
|
||||
// GetCreationResult returns the original snapshot for a live idempotency
|
||||
// scope. It never reads the current organization or membership rows.
|
||||
GetCreationResult(ctx context.Context, scope [IdempotencyDigestSize]byte) (OrganizationCreationResult, error)
|
||||
|
||||
// GetForMember returns the organization with its representatives and the
|
||||
// active membership of the account in it, read from one snapshot in one
|
||||
// statement, so the profile and the list never come from two states. It
|
||||
@@ -100,6 +114,14 @@ type OrganizationRepository interface {
|
||||
UpdateProfile(ctx context.Context, actorID uuid.UUID, organization domain.Organization) (domain.Organization, error)
|
||||
}
|
||||
|
||||
// OrganizationCreationResult is the original business result of creating an
|
||||
// organization. Keeping the domain values lets storage replay the response
|
||||
// without depending on generated HTTP types or a later profile state.
|
||||
type OrganizationCreationResult struct {
|
||||
Organization domain.Organization
|
||||
Owner domain.Membership
|
||||
}
|
||||
|
||||
// MembershipRepository stores memberships. A membership is unique per account
|
||||
// and organization.
|
||||
type MembershipRepository interface {
|
||||
|
||||
Reference in new issue
Block a user