feat(invitations): check contact grants on every read, cap pending invitations, and expire them at the deadline
This commit is contained in:
1 parent
676b3c6e24
commit
12a7213d4a
67 files changed
+4255
-149
No files matched your search
@@ -144,6 +144,29 @@ type InvitationRepository interface {
|
||||
// expectedVersion, at its terms version, or before its deadline. The consent
|
||||
// C4 and the contact grant are stored by the caller in the same transaction.
|
||||
Accept(ctx context.Context, expectedVersion int64, next domain.Invitation, event domain.InvitationEvent) error
|
||||
|
||||
// CountPendingNeedInvitations counts the invitations of the organization
|
||||
// under the need that wait for an answer: delivered, viewed, or counter.
|
||||
// The caller holds the organization lock, which every send takes first.
|
||||
CountPendingNeedInvitations(ctx context.Context, organizationID, needID uuid.UUID) (int64, error)
|
||||
|
||||
// LatestDeclineTime returns the time of the latest decline of the candidate
|
||||
// by the organization, across its needs and members. It reports false when
|
||||
// the pair has no decline.
|
||||
LatestDeclineTime(ctx context.Context, organizationID, candidateID uuid.UUID) (time.Time, bool, error)
|
||||
|
||||
// GetForDeadline locks the row of an invitation by its identifier alone and
|
||||
// returns it, or ErrInvitationNotFound. Only the response deadline job reads
|
||||
// an invitation without the organization or the candidate of a request.
|
||||
GetForDeadline(ctx context.Context, invitationID uuid.UUID) (domain.Invitation, error)
|
||||
|
||||
// Expire moves a delivered or viewed invitation from expectedVersion to the
|
||||
// expired version of next, when its deadline has passed at the expiry time
|
||||
// of next, and records the audit event. It returns
|
||||
// ErrInvitationVersionConflict when the stored row is not waiting for an
|
||||
// answer at expectedVersion or its deadline has not passed. Nothing else
|
||||
// changes: no consent, grant, or quota is written or returned.
|
||||
Expire(ctx context.Context, expectedVersion int64, next domain.Invitation, event domain.InvitationEvent) error
|
||||
}
|
||||
|
||||
// InvitationCreationResultRepository stores the original response of a
|
||||
|
||||
Reference in new issue
Block a user