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
@@ -142,20 +142,30 @@ func (service *Service) now(location string) (time.Time, error) {
|
||||
return now, nil
|
||||
}
|
||||
|
||||
// view is the invitation as its organization reads it. The salary indicator
|
||||
// and the contact access are not derived from the candidate's minimum or from
|
||||
// a grant yet: the indicator is not_available, the least revealing value, and
|
||||
// no grant exists before an acceptance.
|
||||
func (service *Service) view(invitation domain.Invitation) (domain.OrganizationInvitationView, error) {
|
||||
// view is the invitation as its organization reads it. The contact access is
|
||||
// derived in the caller's transaction from the grant of the invitation, with
|
||||
// the checks of the contact read, so the view shows what a read would decide
|
||||
// at that time. The salary indicator is not derived from the candidate's
|
||||
// minimum yet, so it stays not_available, the least revealing value.
|
||||
func (service *Service) view(
|
||||
ctx context.Context,
|
||||
unit outbound.UnitOfWork,
|
||||
invitation domain.Invitation,
|
||||
) (domain.OrganizationInvitationView, error) {
|
||||
const location = "invitation.Service.view"
|
||||
handle, err := service.pseudonymKey.ForOrganization(invitation.OrganizationID(), invitation.CandidateID())
|
||||
if err != nil {
|
||||
return domain.OrganizationInvitationView{}, fmt.Errorf("invitation.Service.view - derive candidate alias: %w", err)
|
||||
return domain.OrganizationInvitationView{}, fmt.Errorf("%s - derive candidate alias: %w", location, err)
|
||||
}
|
||||
access, err := contactAccessOf(ctx, unit, invitation)
|
||||
if err != nil {
|
||||
return domain.OrganizationInvitationView{}, fmt.Errorf("%s - derive contact access: %w", location, err)
|
||||
}
|
||||
return domain.OrganizationInvitationView{
|
||||
InvitationSnapshot: invitation.Snapshot(),
|
||||
CandidateHandle: handle,
|
||||
SalaryFit: domain.InvitationSalaryNotAvailable,
|
||||
ContactAccess: domain.InvitationContactAccessNone,
|
||||
ContactAccess: access,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user