feat: define anonymous match search contract
This commit is contained in:
1 parent
e4f24fa202
commit
6ad4402ff4
66 files changed
+13047
-36
No files matched your search
@@ -11712,6 +11712,269 @@ func (s *Server) handleSaveMyQuestionnaireRequest(args [0]string, argsEscaped bo
|
||||
}
|
||||
}
|
||||
|
||||
// handleSearchOrganizationMatchesRequest handles SearchOrganizationMatches operation.
|
||||
//
|
||||
// Requires the session cookie of an employer account with an active owner membership in `org_id`, the
|
||||
// CSRF token of that session in X-CSRF-Token, and an allowed Origin. The organization comes from the
|
||||
// path and the active server-side membership. Hidden profiles, revoked or missing C2 publication, and
|
||||
// the organization's visibility restrictions are applied before any result is returned.
|
||||
//
|
||||
// The body selects either a Need's `requirements_version` snapshot or the current organization-visible
|
||||
// bank with explicit filters. A need reference uses `Need.requirements_version`, not the general
|
||||
// `Need.version`; title or suggestion-only edits do not change the confirmed-requirements snapshot. An
|
||||
// empty bank filter searches all otherwise eligible specializations, returning each specialization
|
||||
// separately.
|
||||
//
|
||||
// Every entry is one candidate specialization. A confirmed result in Backend never confirms Networks
|
||||
// for the same candidate. The `main`, `near`, and `unconfirmed` arrays are separate groups. A
|
||||
// confirmed category with required-skill coverage below 0.25 belongs to `near`; other confirmed
|
||||
// entries belong to `main` (FR09). Entries in `unconfirmed` are ordered by Fit, then coverage, then a
|
||||
// stable internal tie-breaker that is never returned. Their category and strength remain null, and
|
||||
// they have no theta, T, P, or test percentile. The search result uses the organization-scoped opaque
|
||||
// `candidate_handle` as its display pseudonym and invitation reference, never a candidate account or
|
||||
// profile identifier.
|
||||
//
|
||||
// The card context is limited to safe public fields: recognized stack tags, coarse experience,
|
||||
// accepted work formats, and coarse salary compatibility. It contains no contact, candidate location,
|
||||
// salary amount or minimum, raw answer, arbitrary profile text, or reason for withheld FSP data.
|
||||
// Evidence explanations use bounded codes, not free text. When ML is unavailable, semantic similarity
|
||||
// uses the neutral 0.5 specified by FR09 and `unknown_flags` names `ml_unavailable`. For fewer than 30
|
||||
// comparable real candidates, the search uses neutral T = 0.5, returns no percentile value, and names
|
||||
// `cohort_below_30`.
|
||||
//
|
||||
// A missing, unknown, expired, or revoked session answers 401 unauthenticated; a candidate account
|
||||
// answers 403 forbidden; an unknown organization or account without active membership answers 404
|
||||
// not_found. The response is `Cache-Control: no-store`.
|
||||
//
|
||||
// POST /api/v1/organizations/{org_id}/matches
|
||||
func (s *Server) handleSearchOrganizationMatchesRequest(args [1]string, argsEscaped bool, w http.ResponseWriter, r *http.Request) {
|
||||
statusWriter := &codeRecorder{ResponseWriter: w}
|
||||
w = statusWriter
|
||||
otelAttrs := []attribute.KeyValue{
|
||||
otelogen.OperationID("SearchOrganizationMatches"),
|
||||
semconv.HTTPRequestMethodKey.String("POST"),
|
||||
semconv.HTTPRouteKey.String("/api/v1/organizations/{org_id}/matches"),
|
||||
}
|
||||
// Add attributes from config.
|
||||
otelAttrs = append(otelAttrs, s.cfg.Attributes...)
|
||||
|
||||
// Start a span for this request.
|
||||
ctx, span := s.cfg.Tracer.Start(r.Context(), SearchOrganizationMatchesOperation,
|
||||
trace.WithAttributes(otelAttrs...),
|
||||
serverSpanKind,
|
||||
)
|
||||
defer span.End()
|
||||
|
||||
// Add Labeler to context.
|
||||
labeler := &Labeler{attrs: otelAttrs}
|
||||
ctx = contextWithLabeler(ctx, labeler)
|
||||
|
||||
// Run stopwatch.
|
||||
startTime := time.Now()
|
||||
defer func() {
|
||||
elapsedDuration := time.Since(startTime)
|
||||
|
||||
attrSet := labeler.AttributeSet()
|
||||
attrs := attrSet.ToSlice()
|
||||
code := statusWriter.status
|
||||
if code != 0 {
|
||||
codeAttr := semconv.HTTPResponseStatusCode(code)
|
||||
attrs = append(attrs, codeAttr)
|
||||
span.SetAttributes(attrs...)
|
||||
}
|
||||
attrOpt := metric.WithAttributes(attrs...)
|
||||
|
||||
// Increment request counter.
|
||||
s.requests.Add(ctx, 1, attrOpt)
|
||||
|
||||
// Use floating point division here for higher precision (instead of Millisecond method).
|
||||
s.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), attrOpt)
|
||||
}()
|
||||
|
||||
var (
|
||||
recordError = func(stage string, err error) {
|
||||
span.RecordError(err)
|
||||
|
||||
// https://opentelemetry.io/docs/specs/semconv/http/http-spans/#status
|
||||
// Span Status MUST be left unset if HTTP status code was in the 1xx, 2xx or 3xx ranges,
|
||||
// unless there was another error (e.g., network error receiving the response body; or 3xx codes with
|
||||
// max redirects exceeded), in which case status MUST be set to Error.
|
||||
code := statusWriter.status
|
||||
if code < 100 || code >= 500 {
|
||||
span.SetStatus(codes.Error, stage)
|
||||
}
|
||||
|
||||
attrSet := labeler.AttributeSet()
|
||||
attrs := attrSet.ToSlice()
|
||||
if code != 0 {
|
||||
attrs = append(attrs, semconv.HTTPResponseStatusCode(code))
|
||||
}
|
||||
|
||||
s.errors.Add(ctx, 1, metric.WithAttributes(attrs...))
|
||||
}
|
||||
err error
|
||||
opErrContext = ogenerrors.OperationContext{
|
||||
Name: SearchOrganizationMatchesOperation,
|
||||
ID: "SearchOrganizationMatches",
|
||||
}
|
||||
)
|
||||
{
|
||||
type bitset = [1]uint8
|
||||
var satisfied bitset
|
||||
{
|
||||
sctx, ok, err := s.securitySessionCookie(ctx, SearchOrganizationMatchesOperation, r)
|
||||
if err != nil {
|
||||
err = &ogenerrors.SecurityError{
|
||||
OperationContext: opErrContext,
|
||||
Security: "SessionCookie",
|
||||
Err: err,
|
||||
}
|
||||
if encodeErr := encodeErrorResponse(s.h.NewError(ctx, err), w, span); encodeErr != nil {
|
||||
defer recordError("Security:SessionCookie", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
if ok {
|
||||
satisfied[0] |= 1 << 0
|
||||
ctx = sctx
|
||||
}
|
||||
}
|
||||
{
|
||||
sctx, ok, err := s.securitySessionCsrf(ctx, SearchOrganizationMatchesOperation, r)
|
||||
if err != nil {
|
||||
err = &ogenerrors.SecurityError{
|
||||
OperationContext: opErrContext,
|
||||
Security: "SessionCsrf",
|
||||
Err: err,
|
||||
}
|
||||
if encodeErr := encodeErrorResponse(s.h.NewError(ctx, err), w, span); encodeErr != nil {
|
||||
defer recordError("Security:SessionCsrf", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
if ok {
|
||||
satisfied[0] |= 1 << 1
|
||||
ctx = sctx
|
||||
}
|
||||
}
|
||||
|
||||
if ok := func() bool {
|
||||
nextRequirement:
|
||||
for _, requirement := range []bitset{
|
||||
{0b00000011},
|
||||
} {
|
||||
for i, mask := range requirement {
|
||||
if satisfied[i]&mask != mask {
|
||||
continue nextRequirement
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}(); !ok {
|
||||
err = &ogenerrors.SecurityError{
|
||||
OperationContext: opErrContext,
|
||||
Err: ogenerrors.ErrSecurityRequirementIsNotSatisfied,
|
||||
}
|
||||
if encodeErr := encodeErrorResponse(s.h.NewError(ctx, err), w, span); encodeErr != nil {
|
||||
defer recordError("Security", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
params, err := decodeSearchOrganizationMatchesParams(args, argsEscaped, r)
|
||||
if err != nil {
|
||||
err = &ogenerrors.DecodeParamsError{
|
||||
OperationContext: opErrContext,
|
||||
Err: err,
|
||||
}
|
||||
defer recordError("DecodeParams", err)
|
||||
s.cfg.ErrorHandler(ctx, w, r, err)
|
||||
return
|
||||
}
|
||||
|
||||
var rawBody []byte
|
||||
request, rawBody, close, err := s.decodeSearchOrganizationMatchesRequest(r)
|
||||
if err != nil {
|
||||
err = &ogenerrors.DecodeRequestError{
|
||||
OperationContext: opErrContext,
|
||||
Err: err,
|
||||
}
|
||||
defer recordError("DecodeRequest", err)
|
||||
s.cfg.ErrorHandler(ctx, w, r, err)
|
||||
return
|
||||
}
|
||||
defer func() {
|
||||
if err := close(); err != nil {
|
||||
recordError("CloseRequest", err)
|
||||
}
|
||||
}()
|
||||
|
||||
var response SearchOrganizationMatchesRes
|
||||
if m := s.cfg.Middleware; m != nil {
|
||||
mreq := middleware.Request{
|
||||
Context: ctx,
|
||||
OperationName: SearchOrganizationMatchesOperation,
|
||||
OperationSummary: "Search the current organization-visible candidate bank.",
|
||||
OperationID: "SearchOrganizationMatches",
|
||||
Body: request,
|
||||
RawBody: rawBody,
|
||||
Params: middleware.Parameters{
|
||||
{
|
||||
Name: "org_id",
|
||||
In: "path",
|
||||
}: params.OrgID,
|
||||
},
|
||||
Raw: r,
|
||||
}
|
||||
|
||||
type (
|
||||
Request = MatchSearchRequest
|
||||
Params = SearchOrganizationMatchesParams
|
||||
Response = SearchOrganizationMatchesRes
|
||||
)
|
||||
response, err = middleware.HookMiddleware[
|
||||
Request,
|
||||
Params,
|
||||
Response,
|
||||
](
|
||||
m,
|
||||
mreq,
|
||||
unpackSearchOrganizationMatchesParams,
|
||||
func(ctx context.Context, request Request, params Params) (response Response, err error) {
|
||||
response, err = s.h.SearchOrganizationMatches(ctx, request, params)
|
||||
return response, err
|
||||
},
|
||||
)
|
||||
} else {
|
||||
response, err = s.h.SearchOrganizationMatches(ctx, request, params)
|
||||
}
|
||||
if err != nil {
|
||||
if errRes, ok := errors.Into[*ProblemStatusCode](err); ok {
|
||||
if err := encodeErrorResponse(errRes, w, span); err != nil {
|
||||
defer recordError("Internal", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
if errors.Is(err, ht.ErrNotImplemented) {
|
||||
s.cfg.ErrorHandler(ctx, w, r, err)
|
||||
return
|
||||
}
|
||||
if err := encodeErrorResponse(s.h.NewError(ctx, err), w, span); err != nil {
|
||||
defer recordError("Internal", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if err := encodeSearchOrganizationMatchesResponse(response, w, span); err != nil {
|
||||
defer recordError("EncodeResponse", err)
|
||||
if !errors.Is(err, ht.ErrInternalServerErrorResponse) {
|
||||
s.cfg.ErrorHandler(ctx, w, r, err)
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// handleSendOrganizationInvitationRequest handles SendOrganizationInvitation operation.
|
||||
//
|
||||
// Requires the session cookie of an employer account with an active membership in `org_id`, the CSRF
|
||||
|
||||
@@ -201,6 +201,10 @@ type SaveMyQuestionnaireRes interface {
|
||||
saveMyQuestionnaireRes()
|
||||
}
|
||||
|
||||
type SearchOrganizationMatchesRes interface {
|
||||
searchOrganizationMatchesRes()
|
||||
}
|
||||
|
||||
type SendOrganizationInvitationRes interface {
|
||||
sendOrganizationInvitationRes()
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -58,6 +58,7 @@ const (
|
||||
RevokeMyOrganizationContactConsentOperation OperationName = "RevokeMyOrganizationContactConsent"
|
||||
SaveMyProfileOperation OperationName = "SaveMyProfile"
|
||||
SaveMyQuestionnaireOperation OperationName = "SaveMyQuestionnaire"
|
||||
SearchOrganizationMatchesOperation OperationName = "SearchOrganizationMatches"
|
||||
SendOrganizationInvitationOperation OperationName = "SendOrganizationInvitation"
|
||||
SetMyPublicationOperation OperationName = "SetMyPublication"
|
||||
SetMySearchStatusOperation OperationName = "SetMySearchStatus"
|
||||
|
||||
@@ -4788,6 +4788,75 @@ func decodeRevokeMyOrganizationContactConsentParams(args [1]string, argsEscaped
|
||||
return params, nil
|
||||
}
|
||||
|
||||
// SearchOrganizationMatchesParams is parameters of SearchOrganizationMatches operation.
|
||||
type SearchOrganizationMatchesParams struct {
|
||||
// Identifier of an organization. Access comes only from an active membership of the session account in
|
||||
// this organization, checked by the server on every request; the identifier itself grants nothing. An
|
||||
// organization without such a membership and an unknown identifier both answer 404 not_found, so
|
||||
// organizations cannot be enumerated.
|
||||
OrgID uuid.UUID
|
||||
}
|
||||
|
||||
func unpackSearchOrganizationMatchesParams(packed middleware.Parameters) (params SearchOrganizationMatchesParams) {
|
||||
{
|
||||
key := middleware.ParameterKey{
|
||||
Name: "org_id",
|
||||
In: "path",
|
||||
}
|
||||
params.OrgID = packed[key].(uuid.UUID)
|
||||
}
|
||||
return params
|
||||
}
|
||||
|
||||
func decodeSearchOrganizationMatchesParams(args [1]string, argsEscaped bool, r *http.Request) (params SearchOrganizationMatchesParams, _ error) {
|
||||
// Decode path: org_id.
|
||||
if err := func() error {
|
||||
param := args[0]
|
||||
if argsEscaped {
|
||||
unescaped, err := url.PathUnescape(args[0])
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "unescape path")
|
||||
}
|
||||
param = unescaped
|
||||
}
|
||||
if len(param) > 0 {
|
||||
d := uri.NewPathDecoder(uri.PathDecoderConfig{
|
||||
Param: "org_id",
|
||||
Value: param,
|
||||
Style: uri.PathStyleSimple,
|
||||
Explode: false,
|
||||
})
|
||||
|
||||
if err := func() error {
|
||||
val, err := d.DecodeValue()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
c, err := conv.ToUUID(val)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
params.OrgID = c
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
return validate.ErrFieldRequired
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return params, &ogenerrors.DecodeParamError{
|
||||
Name: "org_id",
|
||||
In: "path",
|
||||
Err: err,
|
||||
}
|
||||
}
|
||||
return params, nil
|
||||
}
|
||||
|
||||
// SendOrganizationInvitationParams is parameters of SendOrganizationInvitation operation.
|
||||
type SendOrganizationInvitationParams struct {
|
||||
// Identifier of an organization. Access comes only from an active membership of the session account in
|
||||
|
||||
@@ -1436,6 +1436,85 @@ func (s *Server) decodeSaveMyQuestionnaireRequest(r *http.Request) (
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Server) decodeSearchOrganizationMatchesRequest(r *http.Request) (
|
||||
req MatchSearchRequest,
|
||||
rawBody []byte,
|
||||
close func() error,
|
||||
rerr error,
|
||||
) {
|
||||
var closers []func() error
|
||||
close = func() error {
|
||||
var merr error
|
||||
// Close in reverse order, to match defer behavior.
|
||||
for i := len(closers) - 1; i >= 0; i-- {
|
||||
c := closers[i]
|
||||
merr = errors.Join(merr, c())
|
||||
}
|
||||
return merr
|
||||
}
|
||||
defer func() {
|
||||
if rerr != nil {
|
||||
rerr = errors.Join(rerr, close())
|
||||
}
|
||||
}()
|
||||
ct, _, err := mime.ParseMediaType(r.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
return req, rawBody, close, errors.Wrap(err, "parse media type")
|
||||
}
|
||||
switch {
|
||||
case ct == "application/json":
|
||||
if r.ContentLength == 0 {
|
||||
return req, rawBody, close, validate.ErrBodyRequired
|
||||
}
|
||||
buf, err := io.ReadAll(r.Body)
|
||||
defer func() {
|
||||
_ = r.Body.Close()
|
||||
}()
|
||||
if err != nil {
|
||||
return req, rawBody, close, err
|
||||
}
|
||||
|
||||
// Reset the body to allow for downstream reading.
|
||||
r.Body = io.NopCloser(bytes.NewBuffer(buf))
|
||||
|
||||
if len(buf) == 0 {
|
||||
return req, rawBody, close, validate.ErrBodyRequired
|
||||
}
|
||||
|
||||
rawBody = append(rawBody, buf...)
|
||||
d := jx.DecodeBytes(buf)
|
||||
|
||||
var request MatchSearchRequest
|
||||
if err := func() error {
|
||||
if err := request.Decode(d); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := d.Skip(); err != io.EOF {
|
||||
return errors.New("unexpected trailing data")
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
err = &ogenerrors.DecodeBodyError{
|
||||
ContentType: ct,
|
||||
Body: buf,
|
||||
Err: err,
|
||||
}
|
||||
return req, rawBody, close, err
|
||||
}
|
||||
if err := func() error {
|
||||
if err := request.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return req, rawBody, close, errors.Wrap(err, "validate")
|
||||
}
|
||||
return request, rawBody, close, nil
|
||||
default:
|
||||
return req, rawBody, close, validate.InvalidContentType(ct)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Server) decodeSendOrganizationInvitationRequest(r *http.Request) (
|
||||
req *InvitationCommand,
|
||||
rawBody []byte,
|
||||
|
||||
@@ -4388,6 +4388,89 @@ func encodeSaveMyQuestionnaireResponse(response SaveMyQuestionnaireRes, w http.R
|
||||
}
|
||||
}
|
||||
|
||||
func encodeSearchOrganizationMatchesResponse(response SearchOrganizationMatchesRes, w http.ResponseWriter, span trace.Span) error {
|
||||
switch response := response.(type) {
|
||||
case *MatchSearchResponseHeaders:
|
||||
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
||||
// Encoding response headers.
|
||||
{
|
||||
h := uri.NewHeaderEncoder(w.Header())
|
||||
// Encode "Cache-Control" header.
|
||||
{
|
||||
cfg := uri.HeaderParameterEncodingConfig{
|
||||
Name: "Cache-Control",
|
||||
Explode: false,
|
||||
}
|
||||
if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
|
||||
return e.EncodeValue(conv.StringToString(string(response.CacheControl)))
|
||||
}); err != nil {
|
||||
return errors.Wrap(err, "encode Cache-Control header")
|
||||
}
|
||||
}
|
||||
}
|
||||
w.WriteHeader(200)
|
||||
|
||||
e := new(jx.Encoder)
|
||||
response.Response.Encode(e)
|
||||
if _, err := e.WriteTo(w); err != nil {
|
||||
return errors.Wrap(err, "write")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
case *SearchOrganizationMatchesBadRequest:
|
||||
w.Header().Set("Content-Type", "application/problem+json")
|
||||
w.WriteHeader(400)
|
||||
|
||||
e := new(jx.Encoder)
|
||||
response.Encode(e)
|
||||
if _, err := e.WriteTo(w); err != nil {
|
||||
return errors.Wrap(err, "write")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
case *SearchOrganizationMatchesUnauthorized:
|
||||
w.Header().Set("Content-Type", "application/problem+json")
|
||||
w.WriteHeader(401)
|
||||
|
||||
e := new(jx.Encoder)
|
||||
response.Encode(e)
|
||||
if _, err := e.WriteTo(w); err != nil {
|
||||
return errors.Wrap(err, "write")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
case *SearchOrganizationMatchesForbidden:
|
||||
w.Header().Set("Content-Type", "application/problem+json")
|
||||
w.WriteHeader(403)
|
||||
|
||||
e := new(jx.Encoder)
|
||||
response.Encode(e)
|
||||
if _, err := e.WriteTo(w); err != nil {
|
||||
return errors.Wrap(err, "write")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
case *SearchOrganizationMatchesNotFound:
|
||||
w.Header().Set("Content-Type", "application/problem+json")
|
||||
w.WriteHeader(404)
|
||||
|
||||
e := new(jx.Encoder)
|
||||
response.Encode(e)
|
||||
if _, err := e.WriteTo(w); err != nil {
|
||||
return errors.Wrap(err, "write")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
default:
|
||||
return errors.Errorf("unexpected response type: %T", response)
|
||||
}
|
||||
}
|
||||
|
||||
func encodeSendOrganizationInvitationResponse(response SendOrganizationInvitationRes, w http.ResponseWriter, span trace.Span) error {
|
||||
switch response := response.(type) {
|
||||
case *OrganizationInvitationHeaders:
|
||||
|
||||
@@ -32,13 +32,13 @@ var (
|
||||
rn9AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type,Idempotency-Key,X-Csrf-Token",
|
||||
}
|
||||
rn79AllowedHeaders = map[string]string{
|
||||
rn80AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type,Idempotency-Key,X-Csrf-Token",
|
||||
}
|
||||
rn20AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type,Idempotency-Key,X-Csrf-Token",
|
||||
}
|
||||
rn78AllowedHeaders = map[string]string{
|
||||
rn79AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type,Idempotency-Key,X-Csrf-Token",
|
||||
}
|
||||
rn64AllowedHeaders = map[string]string{
|
||||
@@ -60,17 +60,17 @@ var (
|
||||
rn17AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type,Idempotency-Key,X-Csrf-Token",
|
||||
}
|
||||
rn80AllowedHeaders = map[string]string{
|
||||
rn81AllowedHeaders = map[string]string{
|
||||
"POST": "X-Csrf-Token",
|
||||
}
|
||||
rn53AllowedHeaders = map[string]string{
|
||||
"DELETE": "X-Csrf-Token",
|
||||
"PUT": "X-Csrf-Token",
|
||||
}
|
||||
rn75AllowedHeaders = map[string]string{
|
||||
rn76AllowedHeaders = map[string]string{
|
||||
"PUT": "Content-Type,X-Csrf-Token",
|
||||
}
|
||||
rn76AllowedHeaders = map[string]string{
|
||||
rn77AllowedHeaders = map[string]string{
|
||||
"PUT": "Content-Type,X-Csrf-Token",
|
||||
}
|
||||
rn36AllowedHeaders = map[string]string{
|
||||
@@ -97,12 +97,15 @@ var (
|
||||
rn63AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type,Idempotency-Key,X-Csrf-Token",
|
||||
}
|
||||
rn73AllowedHeaders = map[string]string{
|
||||
rn74AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type,Idempotency-Key,X-Csrf-Token",
|
||||
}
|
||||
rn81AllowedHeaders = map[string]string{
|
||||
rn82AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type,Idempotency-Key,X-Csrf-Token",
|
||||
}
|
||||
rn72AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type,X-Csrf-Token",
|
||||
}
|
||||
rn16AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type,Idempotency-Key,X-Csrf-Token",
|
||||
}
|
||||
@@ -554,7 +557,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "POST",
|
||||
allowedHeaders: rn79AllowedHeaders,
|
||||
allowedHeaders: rn80AllowedHeaders,
|
||||
acceptPost: "application/json",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -647,7 +650,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "POST",
|
||||
allowedHeaders: rn78AllowedHeaders,
|
||||
allowedHeaders: rn79AllowedHeaders,
|
||||
acceptPost: "application/json",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -1048,7 +1051,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "POST",
|
||||
allowedHeaders: rn80AllowedHeaders,
|
||||
allowedHeaders: rn81AllowedHeaders,
|
||||
acceptPost: "",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -1319,7 +1322,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "PUT",
|
||||
allowedHeaders: rn75AllowedHeaders,
|
||||
allowedHeaders: rn76AllowedHeaders,
|
||||
acceptPost: "",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -1346,7 +1349,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "PUT",
|
||||
allowedHeaders: rn76AllowedHeaders,
|
||||
allowedHeaders: rn77AllowedHeaders,
|
||||
acceptPost: "",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -1763,7 +1766,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "POST",
|
||||
allowedHeaders: rn73AllowedHeaders,
|
||||
allowedHeaders: rn74AllowedHeaders,
|
||||
acceptPost: "application/json",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -1793,7 +1796,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "POST",
|
||||
allowedHeaders: rn81AllowedHeaders,
|
||||
allowedHeaders: rn82AllowedHeaders,
|
||||
acceptPost: "application/json",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -1808,6 +1811,33 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
}
|
||||
|
||||
case 'm': // Prefix: "matches"
|
||||
|
||||
if l := len("matches"); len(elem) >= l && elem[0:l] == "matches" {
|
||||
elem = elem[l:]
|
||||
} else {
|
||||
break
|
||||
}
|
||||
|
||||
if len(elem) == 0 {
|
||||
// Leaf node.
|
||||
switch r.Method {
|
||||
case "POST":
|
||||
s.handleSearchOrganizationMatchesRequest([1]string{
|
||||
args[0],
|
||||
}, elemIsEscaped, w, r)
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "POST",
|
||||
allowedHeaders: rn72AllowedHeaders,
|
||||
acceptPost: "application/json",
|
||||
acceptPatch: "",
|
||||
})
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
case 'n': // Prefix: "needs"
|
||||
|
||||
if l := len("needs"); len(elem) >= l && elem[0:l] == "needs" {
|
||||
@@ -3655,6 +3685,31 @@ func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool) {
|
||||
|
||||
}
|
||||
|
||||
case 'm': // Prefix: "matches"
|
||||
|
||||
if l := len("matches"); len(elem) >= l && elem[0:l] == "matches" {
|
||||
elem = elem[l:]
|
||||
} else {
|
||||
break
|
||||
}
|
||||
|
||||
if len(elem) == 0 {
|
||||
// Leaf node.
|
||||
switch method {
|
||||
case "POST":
|
||||
r.name = SearchOrganizationMatchesOperation
|
||||
r.summary = "Search the current organization-visible candidate bank."
|
||||
r.operationID = "SearchOrganizationMatches"
|
||||
r.operationGroup = ""
|
||||
r.pathPattern = "/api/v1/organizations/{org_id}/matches"
|
||||
r.args = args
|
||||
r.count = 1
|
||||
return r, true
|
||||
default:
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
case 'n': // Prefix: "needs"
|
||||
|
||||
if l := len("needs"); len(elem) >= l && elem[0:l] == "needs" {
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -101,6 +101,7 @@ var operationRolesSessionCookie = map[string][]string{
|
||||
RevokeMyOrganizationContactConsentOperation: []string{},
|
||||
SaveMyProfileOperation: []string{},
|
||||
SaveMyQuestionnaireOperation: []string{},
|
||||
SearchOrganizationMatchesOperation: []string{},
|
||||
SendOrganizationInvitationOperation: []string{},
|
||||
SetMyPublicationOperation: []string{},
|
||||
SetMySearchStatusOperation: []string{},
|
||||
@@ -156,6 +157,7 @@ var operationRolesSessionCsrf = map[string][]string{
|
||||
RevokeMyOrganizationContactConsentOperation: []string{},
|
||||
SaveMyProfileOperation: []string{},
|
||||
SaveMyQuestionnaireOperation: []string{},
|
||||
SearchOrganizationMatchesOperation: []string{},
|
||||
SendOrganizationInvitationOperation: []string{},
|
||||
SetMyPublicationOperation: []string{},
|
||||
SetMySearchStatusOperation: []string{},
|
||||
|
||||
@@ -1442,6 +1442,42 @@ type Handler interface {
|
||||
//
|
||||
// PUT /api/v1/me/questionnaire
|
||||
SaveMyQuestionnaire(ctx context.Context, req *CandidateQuestionnaireUpdate) (SaveMyQuestionnaireRes, error)
|
||||
// SearchOrganizationMatches implements SearchOrganizationMatches operation.
|
||||
//
|
||||
// Requires the session cookie of an employer account with an active owner membership in `org_id`, the
|
||||
// CSRF token of that session in X-CSRF-Token, and an allowed Origin. The organization comes from the
|
||||
// path and the active server-side membership. Hidden profiles, revoked or missing C2 publication, and
|
||||
// the organization's visibility restrictions are applied before any result is returned.
|
||||
//
|
||||
// The body selects either a Need's `requirements_version` snapshot or the current organization-visible
|
||||
// bank with explicit filters. A need reference uses `Need.requirements_version`, not the general
|
||||
// `Need.version`; title or suggestion-only edits do not change the confirmed-requirements snapshot. An
|
||||
// empty bank filter searches all otherwise eligible specializations, returning each specialization
|
||||
// separately.
|
||||
//
|
||||
// Every entry is one candidate specialization. A confirmed result in Backend never confirms Networks
|
||||
// for the same candidate. The `main`, `near`, and `unconfirmed` arrays are separate groups. A
|
||||
// confirmed category with required-skill coverage below 0.25 belongs to `near`; other confirmed
|
||||
// entries belong to `main` (FR09). Entries in `unconfirmed` are ordered by Fit, then coverage, then a
|
||||
// stable internal tie-breaker that is never returned. Their category and strength remain null, and
|
||||
// they have no theta, T, P, or test percentile. The search result uses the organization-scoped opaque
|
||||
// `candidate_handle` as its display pseudonym and invitation reference, never a candidate account or
|
||||
// profile identifier.
|
||||
//
|
||||
// The card context is limited to safe public fields: recognized stack tags, coarse experience,
|
||||
// accepted work formats, and coarse salary compatibility. It contains no contact, candidate location,
|
||||
// salary amount or minimum, raw answer, arbitrary profile text, or reason for withheld FSP data.
|
||||
// Evidence explanations use bounded codes, not free text. When ML is unavailable, semantic similarity
|
||||
// uses the neutral 0.5 specified by FR09 and `unknown_flags` names `ml_unavailable`. For fewer than 30
|
||||
// comparable real candidates, the search uses neutral T = 0.5, returns no percentile value, and names
|
||||
// `cohort_below_30`.
|
||||
//
|
||||
// A missing, unknown, expired, or revoked session answers 401 unauthenticated; a candidate account
|
||||
// answers 403 forbidden; an unknown organization or account without active membership answers 404
|
||||
// not_found. The response is `Cache-Control: no-store`.
|
||||
//
|
||||
// POST /api/v1/organizations/{org_id}/matches
|
||||
SearchOrganizationMatches(ctx context.Context, req MatchSearchRequest, params SearchOrganizationMatchesParams) (SearchOrganizationMatchesRes, error)
|
||||
// SendOrganizationInvitation implements SendOrganizationInvitation operation.
|
||||
//
|
||||
// Requires the session cookie of an employer account with an active membership in `org_id`, the CSRF
|
||||
|
||||
@@ -1603,6 +1603,45 @@ func (UnimplementedHandler) SaveMyQuestionnaire(ctx context.Context, req *Candid
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// SearchOrganizationMatches implements SearchOrganizationMatches operation.
|
||||
//
|
||||
// Requires the session cookie of an employer account with an active owner membership in `org_id`, the
|
||||
// CSRF token of that session in X-CSRF-Token, and an allowed Origin. The organization comes from the
|
||||
// path and the active server-side membership. Hidden profiles, revoked or missing C2 publication, and
|
||||
// the organization's visibility restrictions are applied before any result is returned.
|
||||
//
|
||||
// The body selects either a Need's `requirements_version` snapshot or the current organization-visible
|
||||
// bank with explicit filters. A need reference uses `Need.requirements_version`, not the general
|
||||
// `Need.version`; title or suggestion-only edits do not change the confirmed-requirements snapshot. An
|
||||
// empty bank filter searches all otherwise eligible specializations, returning each specialization
|
||||
// separately.
|
||||
//
|
||||
// Every entry is one candidate specialization. A confirmed result in Backend never confirms Networks
|
||||
// for the same candidate. The `main`, `near`, and `unconfirmed` arrays are separate groups. A
|
||||
// confirmed category with required-skill coverage below 0.25 belongs to `near`; other confirmed
|
||||
// entries belong to `main` (FR09). Entries in `unconfirmed` are ordered by Fit, then coverage, then a
|
||||
// stable internal tie-breaker that is never returned. Their category and strength remain null, and
|
||||
// they have no theta, T, P, or test percentile. The search result uses the organization-scoped opaque
|
||||
// `candidate_handle` as its display pseudonym and invitation reference, never a candidate account or
|
||||
// profile identifier.
|
||||
//
|
||||
// The card context is limited to safe public fields: recognized stack tags, coarse experience,
|
||||
// accepted work formats, and coarse salary compatibility. It contains no contact, candidate location,
|
||||
// salary amount or minimum, raw answer, arbitrary profile text, or reason for withheld FSP data.
|
||||
// Evidence explanations use bounded codes, not free text. When ML is unavailable, semantic similarity
|
||||
// uses the neutral 0.5 specified by FR09 and `unknown_flags` names `ml_unavailable`. For fewer than 30
|
||||
// comparable real candidates, the search uses neutral T = 0.5, returns no percentile value, and names
|
||||
// `cohort_below_30`.
|
||||
//
|
||||
// A missing, unknown, expired, or revoked session answers 401 unauthenticated; a candidate account
|
||||
// answers 403 forbidden; an unknown organization or account without active membership answers 404
|
||||
// not_found. The response is `Cache-Control: no-store`.
|
||||
//
|
||||
// POST /api/v1/organizations/{org_id}/matches
|
||||
func (UnimplementedHandler) SearchOrganizationMatches(ctx context.Context, req MatchSearchRequest, params SearchOrganizationMatchesParams) (r SearchOrganizationMatchesRes, _ error) {
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// SendOrganizationInvitation implements SendOrganizationInvitation operation.
|
||||
//
|
||||
// Requires the session cookie of an employer account with an active membership in `org_id`, the CSRF
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user