30 lines
1.1 KiB
Go
30 lines
1.1 KiB
Go
package outbound
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
|
|
"github.com/google/uuid"
|
|
|
|
"lincodex/backend/internal/domain"
|
|
)
|
|
|
|
// ErrContactGrantNotFound reports that the invitation has no contact grant of
|
|
// the organization. An accepted invitation always has one, so a missing grant
|
|
// of an accepted invitation is a storage defect.
|
|
var ErrContactGrantNotFound = errors.New("contact grant not found")
|
|
|
|
// ContactGrantRepository stores the contact grants of accepted invitations. A
|
|
// grant is created in the acceptance transaction next to its consent C4
|
|
// record; it is never updated here, and a read is always scoped by the
|
|
// organization.
|
|
type ContactGrantRepository interface {
|
|
// Create inserts the grant in the surrounding transaction. The database
|
|
// checks that the grant agrees with its consent record and invitation.
|
|
Create(ctx context.Context, grant domain.ContactGrant) error
|
|
|
|
// GetByInvitation returns the grant of one invitation of one organization,
|
|
// or ErrContactGrantNotFound.
|
|
GetByInvitation(ctx context.Context, organizationID, invitationID uuid.UUID) (domain.ContactGrant, error)
|
|
}
|