feat(invitations): add organization invitation drafts with salary range rules
This commit is contained in:
1 parent
28337d84cb
commit
bd23c839fd
36 files changed
+7018
-83
No files matched your search
@@ -314,6 +314,54 @@ func (service *Service) AuthorizeCategoriesSection(
|
||||
return candidateID, slices.Clone(view.Categories), nil
|
||||
}
|
||||
|
||||
// ResolveCandidateHandle turns the handle of a card of this organization into
|
||||
// the candidate it stands for, inside the caller's transaction. It applies the
|
||||
// checks of a card read under the same locks: the active membership of the
|
||||
// actor, the effective C2 publication, the hiding of this organization, and
|
||||
// the minimum cohort, so a handle of another organization, an unknown handle,
|
||||
// a candidate who revoked the publication or hid the profile from the
|
||||
// organization, and a card that the cohort rules suppress all answer
|
||||
// ErrCandidateCardNotFound. The caller cannot tell the cases apart.
|
||||
//
|
||||
// It consumes no card-view quota and writes no access history: it returns an
|
||||
// identifier for the server's own use and shows no card content, and the
|
||||
// search or the card read that produced the handle was charged when it
|
||||
// revealed the candidate. The identifier must never leave the server.
|
||||
//
|
||||
// The caller's transaction must not hold a share lock of the organization yet,
|
||||
// so that the exclusive organization lock of the quota writers is taken first.
|
||||
func (service *Service) ResolveCandidateHandle(
|
||||
ctx context.Context,
|
||||
unit outbound.UnitOfWork,
|
||||
actorID, organizationID uuid.UUID,
|
||||
handle string,
|
||||
) (uuid.UUID, error) {
|
||||
const location = "candidateview.Service.ResolveCandidateHandle"
|
||||
if actorID == uuid.Nil || organizationID == uuid.Nil {
|
||||
return uuid.Nil, ErrForbidden
|
||||
}
|
||||
if !domain.IsCandidateViewPseudonym(handle) {
|
||||
return uuid.Nil, ErrInvalidCandidateHandle
|
||||
}
|
||||
if err := lockOrganizationFirst(ctx, unit, organizationID); err != nil {
|
||||
return uuid.Nil, err
|
||||
}
|
||||
_, _, sources, err := loadCurrentVisibleCohort(ctx, unit, actorID, organizationID, location)
|
||||
if err != nil {
|
||||
return uuid.Nil, err
|
||||
}
|
||||
candidateID, err := candidateIDForHandle(service, organizationID, sources, handle, location)
|
||||
if err != nil {
|
||||
return uuid.Nil, err
|
||||
}
|
||||
// A card that the cohort rules suppress is not offered by a search, so its
|
||||
// handle is not accepted either.
|
||||
if _, err := projectedViewForHandle(service, organizationID, sources, handle, location); err != nil {
|
||||
return uuid.Nil, err
|
||||
}
|
||||
return candidateID, nil
|
||||
}
|
||||
|
||||
func (service *Service) currentOrganizationCard(
|
||||
ctx context.Context,
|
||||
unit outbound.UnitOfWork,
|
||||
|
||||
Reference in new issue
Block a user