feat(evidence): project skill evidence from confirmed assessments
This commit is contained in:
1 parent
4761508f13
commit
c2a8d17195
94 files changed
+10077
-151
No files matched your search
@@ -4511,6 +4511,13 @@ func (s *Server) handleGetMyAssessmentSignalNoticeRequest(args [0]string, argsEs
|
||||
// formats appear only through their separate explicit publication choices, and self-assessment never
|
||||
// becomes a confirmed category. Salary compatibility is nullable and contains no salary amount.
|
||||
//
|
||||
// `evidence` shows what an organization would read in the evidence section of the card
|
||||
// (`GetOrganizationCandidateEvidence`): for each category of the card, the one assessment fact that
|
||||
// supports its confirmed grade, with its skill, the passed grade, the trust level, the year, and the
|
||||
// basis and calibration (`synthetic_demo`, `uncalibrated`). It is null while `card` is null, and an
|
||||
// empty list when the card shows no category or no visible fact supports one. The preview applies no
|
||||
// organization or cohort, so an organization can still receive less.
|
||||
//
|
||||
// A missing, unknown, expired, or revoked session answers 401 unauthenticated; an employer account
|
||||
// answers 403 forbidden.
|
||||
//
|
||||
@@ -6379,6 +6386,243 @@ func (s *Server) handleGetOrganizationCandidateCardRequest(args [2]string, argsE
|
||||
}
|
||||
}
|
||||
|
||||
// handleGetOrganizationCandidateEvidenceRequest handles GetOrganizationCandidateEvidence operation.
|
||||
//
|
||||
// Requires the session cookie of an employer account with an active membership in `org_id`. The
|
||||
// organization and membership come from the current server-side session and path, never from cached
|
||||
// search data.
|
||||
//
|
||||
// `candidate_handle` is the organization-scoped opaque alias issued by the current anonymous-card
|
||||
// projection. The server runs the same checks as the card read on every request: active membership,
|
||||
// effective C2 publication, the candidate's hiding of this organization, and the minimum cohort. In
|
||||
// addition the card must publish the `categories` field and show at least one category after the
|
||||
// cohort rules, because the evidence explains those categories and discloses nothing beyond them. An
|
||||
// unknown handle, a handle of another organization, a closed or revoked publication, a profile hidden
|
||||
// from this organization, a profile suppressed by the minimum cohort, and a card without categories
|
||||
// all answer the same 404 not_found. Closing C2 or hiding the organization blocks this read
|
||||
// immediately, and a cached response proves nothing.
|
||||
//
|
||||
// The response lists, for each category of the card, the one visible fact that supports its confirmed
|
||||
// grade: the earliest assessment that passed exactly that grade, so a lower grade or a retake adds
|
||||
// nothing. A fact the candidate hid is absent. Each fact carries only the skill, the passed grade, the
|
||||
// trust level, the year of the assessment, and the basis and calibration of the method
|
||||
// (`synthetic_demo`, `uncalibrated`), which are the same for every candidate and say that the fact is
|
||||
// a demonstration, not a validated measurement. It carries no identifier of the fact, event, result,
|
||||
// or candidate, no month or exact time, and never an answer, item, score, failed attempt, review band,
|
||||
// or anti-cheat signal. An express training run and a failed attempt create no fact. The answer has no
|
||||
// key that joins it to a person, but it is not unlinkable: with the other values of the card it can
|
||||
// narrow a small pool of candidates.
|
||||
//
|
||||
// Reading the evidence is a view of the candidate card: it consumes the organization's current
|
||||
// card-view quota with the same distinct-card rule and is recorded in the access history with the
|
||||
// `categories` field. When the quota is exhausted the operation answers 429 with Retry-After. The
|
||||
// response is `Cache-Control: no-store`.
|
||||
//
|
||||
// A missing, unknown, expired, or revoked session answers 401 unauthenticated; a candidate account
|
||||
// answers 403 forbidden; an unknown organization or account without an active membership answers 404
|
||||
// not_found. An `org_id` that is not a UUID or a malformed candidate handle answers 400
|
||||
// validation_failed.
|
||||
//
|
||||
// GET /api/v1/organizations/{org_id}/candidate-cards/{candidate_handle}/evidence
|
||||
func (s *Server) handleGetOrganizationCandidateEvidenceRequest(args [2]string, argsEscaped bool, w http.ResponseWriter, r *http.Request) {
|
||||
statusWriter := &codeRecorder{ResponseWriter: w}
|
||||
w = statusWriter
|
||||
otelAttrs := []attribute.KeyValue{
|
||||
otelogen.OperationID("GetOrganizationCandidateEvidence"),
|
||||
semconv.HTTPRequestMethodKey.String("GET"),
|
||||
semconv.HTTPRouteKey.String("/api/v1/organizations/{org_id}/candidate-cards/{candidate_handle}/evidence"),
|
||||
}
|
||||
// Add attributes from config.
|
||||
otelAttrs = append(otelAttrs, s.cfg.Attributes...)
|
||||
|
||||
// Start a span for this request.
|
||||
ctx, span := s.cfg.Tracer.Start(r.Context(), GetOrganizationCandidateEvidenceOperation,
|
||||
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: GetOrganizationCandidateEvidenceOperation,
|
||||
ID: "GetOrganizationCandidateEvidence",
|
||||
}
|
||||
)
|
||||
{
|
||||
type bitset = [1]uint8
|
||||
var satisfied bitset
|
||||
{
|
||||
sctx, ok, err := s.securitySessionCookie(ctx, GetOrganizationCandidateEvidenceOperation, 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
|
||||
}
|
||||
}
|
||||
|
||||
if ok := func() bool {
|
||||
nextRequirement:
|
||||
for _, requirement := range []bitset{
|
||||
{0b00000001},
|
||||
} {
|
||||
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 := decodeGetOrganizationCandidateEvidenceParams(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
|
||||
|
||||
var response GetOrganizationCandidateEvidenceRes
|
||||
if m := s.cfg.Middleware; m != nil {
|
||||
mreq := middleware.Request{
|
||||
Context: ctx,
|
||||
OperationName: GetOrganizationCandidateEvidenceOperation,
|
||||
OperationSummary: "Read the permitted skill evidence of one currently visible candidate card.",
|
||||
OperationID: "GetOrganizationCandidateEvidence",
|
||||
Body: nil,
|
||||
RawBody: rawBody,
|
||||
Params: middleware.Parameters{
|
||||
{
|
||||
Name: "org_id",
|
||||
In: "path",
|
||||
}: params.OrgID,
|
||||
{
|
||||
Name: "candidate_handle",
|
||||
In: "path",
|
||||
}: params.CandidateHandle,
|
||||
},
|
||||
Raw: r,
|
||||
}
|
||||
|
||||
type (
|
||||
Request = struct{}
|
||||
Params = GetOrganizationCandidateEvidenceParams
|
||||
Response = GetOrganizationCandidateEvidenceRes
|
||||
)
|
||||
response, err = middleware.HookMiddleware[
|
||||
Request,
|
||||
Params,
|
||||
Response,
|
||||
](
|
||||
m,
|
||||
mreq,
|
||||
unpackGetOrganizationCandidateEvidenceParams,
|
||||
func(ctx context.Context, request Request, params Params) (response Response, err error) {
|
||||
response, err = s.h.GetOrganizationCandidateEvidence(ctx, params)
|
||||
return response, err
|
||||
},
|
||||
)
|
||||
} else {
|
||||
response, err = s.h.GetOrganizationCandidateEvidence(ctx, 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 := encodeGetOrganizationCandidateEvidenceResponse(response, w, span); err != nil {
|
||||
defer recordError("EncodeResponse", err)
|
||||
if !errors.Is(err, ht.ErrInternalServerErrorResponse) {
|
||||
s.cfg.ErrorHandler(ctx, w, r, err)
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// handleGetOrganizationInvitationRequest handles GetOrganizationInvitation operation.
|
||||
//
|
||||
// Requires the session cookie of an employer account with an active membership in `org_id`. The
|
||||
@@ -8367,6 +8611,228 @@ func (s *Server) handleListMyConsentsRequest(args [0]string, argsEscaped bool, w
|
||||
}
|
||||
}
|
||||
|
||||
// handleListMyEvidenceRequest handles ListMyEvidence operation.
|
||||
//
|
||||
// Requires the session cookie of a candidate account. The candidate comes from the session, so the
|
||||
// response holds only the caller's own facts. Returns a page, newest event first with the fact
|
||||
// identifier as the tie-breaker, with cursor pagination. The response is `Cache-Control: no-store`.
|
||||
//
|
||||
// A fact is derived from the immutable result of a confirmed real assessment (root or corrective), in
|
||||
// the same transaction that stores the result. Each fact names its source (the event and the result,
|
||||
// which the candidate can open at `GetMyAssessmentResult`), the skills of the event, the grade that
|
||||
// was passed with its basis and calibration, the attribution, the date, the visibility, and the trust
|
||||
// level. An online assessment without a reliable confirmation of the identity has trust 1. One source
|
||||
// event is one fact: its skills are tags of that fact, so several tags never make several facts.
|
||||
//
|
||||
// The list never carries raw answers, items, scores, failed attempts, or anti-cheat data. A failed
|
||||
// attempt, a result without a reviewed category source, and an express training run (`demo_express`)
|
||||
// create no fact, so reading the list before and after an express run shows no new fact. The list
|
||||
// includes facts the candidate hid, with `visibility` `hidden`.
|
||||
//
|
||||
// A missing, unknown, expired, or revoked session answers 401 unauthenticated; an employer account, or
|
||||
// a candidate with an unverified email, answers 403 forbidden. A malformed `limit` or `cursor`, or a
|
||||
// cursor of another candidate, answers 400 validation_failed.
|
||||
//
|
||||
// GET /api/v1/me/evidence
|
||||
func (s *Server) handleListMyEvidenceRequest(args [0]string, argsEscaped bool, w http.ResponseWriter, r *http.Request) {
|
||||
statusWriter := &codeRecorder{ResponseWriter: w}
|
||||
w = statusWriter
|
||||
otelAttrs := []attribute.KeyValue{
|
||||
otelogen.OperationID("ListMyEvidence"),
|
||||
semconv.HTTPRequestMethodKey.String("GET"),
|
||||
semconv.HTTPRouteKey.String("/api/v1/me/evidence"),
|
||||
}
|
||||
// Add attributes from config.
|
||||
otelAttrs = append(otelAttrs, s.cfg.Attributes...)
|
||||
|
||||
// Start a span for this request.
|
||||
ctx, span := s.cfg.Tracer.Start(r.Context(), ListMyEvidenceOperation,
|
||||
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: ListMyEvidenceOperation,
|
||||
ID: "ListMyEvidence",
|
||||
}
|
||||
)
|
||||
{
|
||||
type bitset = [1]uint8
|
||||
var satisfied bitset
|
||||
{
|
||||
sctx, ok, err := s.securitySessionCookie(ctx, ListMyEvidenceOperation, 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
|
||||
}
|
||||
}
|
||||
|
||||
if ok := func() bool {
|
||||
nextRequirement:
|
||||
for _, requirement := range []bitset{
|
||||
{0b00000001},
|
||||
} {
|
||||
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 := decodeListMyEvidenceParams(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
|
||||
|
||||
var response ListMyEvidenceRes
|
||||
if m := s.cfg.Middleware; m != nil {
|
||||
mreq := middleware.Request{
|
||||
Context: ctx,
|
||||
OperationName: ListMyEvidenceOperation,
|
||||
OperationSummary: "List the skill evidence of the current candidate.",
|
||||
OperationID: "ListMyEvidence",
|
||||
Body: nil,
|
||||
RawBody: rawBody,
|
||||
Params: middleware.Parameters{
|
||||
{
|
||||
Name: "limit",
|
||||
In: "query",
|
||||
}: params.Limit,
|
||||
{
|
||||
Name: "cursor",
|
||||
In: "query",
|
||||
}: params.Cursor,
|
||||
},
|
||||
Raw: r,
|
||||
}
|
||||
|
||||
type (
|
||||
Request = struct{}
|
||||
Params = ListMyEvidenceParams
|
||||
Response = ListMyEvidenceRes
|
||||
)
|
||||
response, err = middleware.HookMiddleware[
|
||||
Request,
|
||||
Params,
|
||||
Response,
|
||||
](
|
||||
m,
|
||||
mreq,
|
||||
unpackListMyEvidenceParams,
|
||||
func(ctx context.Context, request Request, params Params) (response Response, err error) {
|
||||
response, err = s.h.ListMyEvidence(ctx, params)
|
||||
return response, err
|
||||
},
|
||||
)
|
||||
} else {
|
||||
response, err = s.h.ListMyEvidence(ctx, 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 := encodeListMyEvidenceResponse(response, w, span); err != nil {
|
||||
defer recordError("EncodeResponse", err)
|
||||
if !errors.Is(err, ht.ErrInternalServerErrorResponse) {
|
||||
s.cfg.ErrorHandler(ctx, w, r, err)
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// handleListMyHiddenOrganizationsRequest handles ListMyHiddenOrganizations operation.
|
||||
//
|
||||
// Requires the session cookie of a candidate account. The candidate comes from the session, so the
|
||||
|
||||
@@ -105,6 +105,10 @@ type GetOrganizationCandidateCardRes interface {
|
||||
getOrganizationCandidateCardRes()
|
||||
}
|
||||
|
||||
type GetOrganizationCandidateEvidenceRes interface {
|
||||
getOrganizationCandidateEvidenceRes()
|
||||
}
|
||||
|
||||
type GetOrganizationInvitationContactsRes interface {
|
||||
getOrganizationInvitationContactsRes()
|
||||
}
|
||||
@@ -141,6 +145,10 @@ type ListMyConsentsRes interface {
|
||||
listMyConsentsRes()
|
||||
}
|
||||
|
||||
type ListMyEvidenceRes interface {
|
||||
listMyEvidenceRes()
|
||||
}
|
||||
|
||||
type ListMyHiddenOrganizationsRes interface {
|
||||
listMyHiddenOrganizationsRes()
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -34,6 +34,7 @@ const (
|
||||
GetMySupportCaseOperation OperationName = "GetMySupportCase"
|
||||
GetOrganizationOperation OperationName = "GetOrganization"
|
||||
GetOrganizationCandidateCardOperation OperationName = "GetOrganizationCandidateCard"
|
||||
GetOrganizationCandidateEvidenceOperation OperationName = "GetOrganizationCandidateEvidence"
|
||||
GetOrganizationInvitationOperation OperationName = "GetOrganizationInvitation"
|
||||
GetOrganizationInvitationContactsOperation OperationName = "GetOrganizationInvitationContacts"
|
||||
GetOrganizationNeedOperation OperationName = "GetOrganizationNeed"
|
||||
@@ -43,6 +44,7 @@ const (
|
||||
ListMyAssessmentResultsOperation OperationName = "ListMyAssessmentResults"
|
||||
ListMyCardAccessHistoryOperation OperationName = "ListMyCardAccessHistory"
|
||||
ListMyConsentsOperation OperationName = "ListMyConsents"
|
||||
ListMyEvidenceOperation OperationName = "ListMyEvidence"
|
||||
ListMyHiddenOrganizationsOperation OperationName = "ListMyHiddenOrganizations"
|
||||
ListMyInvitationsOperation OperationName = "ListMyInvitations"
|
||||
ListMyOrganizationsOperation OperationName = "ListMyOrganizations"
|
||||
|
||||
@@ -1917,6 +1917,147 @@ func decodeGetOrganizationCandidateCardParams(args [2]string, argsEscaped bool,
|
||||
return params, nil
|
||||
}
|
||||
|
||||
// GetOrganizationCandidateEvidenceParams is parameters of GetOrganizationCandidateEvidence operation.
|
||||
type GetOrganizationCandidateEvidenceParams 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
|
||||
// Organization-scoped opaque candidate alias issued by the current visible card projection. The server
|
||||
// resolves it only for the organization in the path and rechecks current membership, publication
|
||||
// consent, and hiding on every read. Unknown, hidden, unpublished, and suppressed candidates all
|
||||
// answer the same 404.
|
||||
CandidateHandle CandidateHandle
|
||||
}
|
||||
|
||||
func unpackGetOrganizationCandidateEvidenceParams(packed middleware.Parameters) (params GetOrganizationCandidateEvidenceParams) {
|
||||
{
|
||||
key := middleware.ParameterKey{
|
||||
Name: "org_id",
|
||||
In: "path",
|
||||
}
|
||||
params.OrgID = packed[key].(uuid.UUID)
|
||||
}
|
||||
{
|
||||
key := middleware.ParameterKey{
|
||||
Name: "candidate_handle",
|
||||
In: "path",
|
||||
}
|
||||
params.CandidateHandle = packed[key].(CandidateHandle)
|
||||
}
|
||||
return params
|
||||
}
|
||||
|
||||
func decodeGetOrganizationCandidateEvidenceParams(args [2]string, argsEscaped bool, r *http.Request) (params GetOrganizationCandidateEvidenceParams, _ 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,
|
||||
}
|
||||
}
|
||||
// Decode path: candidate_handle.
|
||||
if err := func() error {
|
||||
param := args[1]
|
||||
if argsEscaped {
|
||||
unescaped, err := url.PathUnescape(args[1])
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "unescape path")
|
||||
}
|
||||
param = unescaped
|
||||
}
|
||||
if len(param) > 0 {
|
||||
d := uri.NewPathDecoder(uri.PathDecoderConfig{
|
||||
Param: "candidate_handle",
|
||||
Value: param,
|
||||
Style: uri.PathStyleSimple,
|
||||
Explode: false,
|
||||
})
|
||||
|
||||
if err := func() error {
|
||||
var paramsDotCandidateHandleVal string
|
||||
if err := func() error {
|
||||
val, err := d.DecodeValue()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
c, err := conv.ToString(val)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
paramsDotCandidateHandleVal = c
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return err
|
||||
}
|
||||
params.CandidateHandle = CandidateHandle(paramsDotCandidateHandleVal)
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := func() error {
|
||||
if err := params.CandidateHandle.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
return validate.ErrFieldRequired
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return params, &ogenerrors.DecodeParamError{
|
||||
Name: "candidate_handle",
|
||||
In: "path",
|
||||
Err: err,
|
||||
}
|
||||
}
|
||||
return params, nil
|
||||
}
|
||||
|
||||
// GetOrganizationInvitationParams is parameters of GetOrganizationInvitation operation.
|
||||
type GetOrganizationInvitationParams struct {
|
||||
// Identifier of an organization. Access comes only from an active membership of the session account in
|
||||
@@ -3027,6 +3168,182 @@ func decodeListMyConsentsParams(args [0]string, argsEscaped bool, r *http.Reques
|
||||
return params, nil
|
||||
}
|
||||
|
||||
// ListMyEvidenceParams is parameters of ListMyEvidence operation.
|
||||
type ListMyEvidenceParams struct {
|
||||
// Maximum number of items in the page. The server may return fewer items even when more remain; use
|
||||
// `page.has_more` to detect the end.
|
||||
Limit OptInt32 `json:",omitempty,omitzero"`
|
||||
// Opaque `page.next_cursor` value from the previous page of the same listing. Omit it to read the
|
||||
// first page. A malformed or foreign cursor returns 400 with code validation_failed.
|
||||
Cursor OptString `json:",omitempty,omitzero"`
|
||||
}
|
||||
|
||||
func unpackListMyEvidenceParams(packed middleware.Parameters) (params ListMyEvidenceParams) {
|
||||
{
|
||||
key := middleware.ParameterKey{
|
||||
Name: "limit",
|
||||
In: "query",
|
||||
}
|
||||
if v, ok := packed[key]; ok {
|
||||
params.Limit = v.(OptInt32)
|
||||
}
|
||||
}
|
||||
{
|
||||
key := middleware.ParameterKey{
|
||||
Name: "cursor",
|
||||
In: "query",
|
||||
}
|
||||
if v, ok := packed[key]; ok {
|
||||
params.Cursor = v.(OptString)
|
||||
}
|
||||
}
|
||||
return params
|
||||
}
|
||||
|
||||
func decodeListMyEvidenceParams(args [0]string, argsEscaped bool, r *http.Request) (params ListMyEvidenceParams, _ error) {
|
||||
q := uri.NewQueryDecoder(r.URL.Query())
|
||||
// Set default value for query: limit.
|
||||
{
|
||||
val := int32(20)
|
||||
params.Limit.SetTo(val)
|
||||
}
|
||||
// Decode query: limit.
|
||||
if err := func() error {
|
||||
cfg := uri.QueryParameterDecodingConfig{
|
||||
Name: "limit",
|
||||
Style: uri.QueryStyleForm,
|
||||
Explode: true,
|
||||
}
|
||||
|
||||
if err := q.HasParam(cfg); err == nil {
|
||||
if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
|
||||
var paramsDotLimitVal int32
|
||||
if err := func() error {
|
||||
val, err := d.DecodeValue()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
c, err := conv.ToInt32(val)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
paramsDotLimitVal = c
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return err
|
||||
}
|
||||
params.Limit.SetTo(paramsDotLimitVal)
|
||||
return nil
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := func() error {
|
||||
if value, ok := params.Limit.Get(); ok {
|
||||
if err := func() error {
|
||||
if err := (validate.Int{
|
||||
MinSet: true,
|
||||
Min: 1,
|
||||
MaxSet: true,
|
||||
Max: 100,
|
||||
MinExclusive: false,
|
||||
MaxExclusive: false,
|
||||
MultipleOfSet: false,
|
||||
MultipleOf: 0,
|
||||
Pattern: nil,
|
||||
}).Validate(int64(value)); err != nil {
|
||||
return errors.Wrap(err, "int")
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return params, &ogenerrors.DecodeParamError{
|
||||
Name: "limit",
|
||||
In: "query",
|
||||
Err: err,
|
||||
}
|
||||
}
|
||||
// Decode query: cursor.
|
||||
if err := func() error {
|
||||
cfg := uri.QueryParameterDecodingConfig{
|
||||
Name: "cursor",
|
||||
Style: uri.QueryStyleForm,
|
||||
Explode: true,
|
||||
}
|
||||
|
||||
if err := q.HasParam(cfg); err == nil {
|
||||
if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
|
||||
var paramsDotCursorVal string
|
||||
if err := func() error {
|
||||
val, err := d.DecodeValue()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
c, err := conv.ToString(val)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
paramsDotCursorVal = c
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return err
|
||||
}
|
||||
params.Cursor.SetTo(paramsDotCursorVal)
|
||||
return nil
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := func() error {
|
||||
if value, ok := params.Cursor.Get(); ok {
|
||||
if err := func() error {
|
||||
if err := (validate.String{
|
||||
MinLength: 1,
|
||||
MinLengthSet: true,
|
||||
MaxLength: 512,
|
||||
MaxLengthSet: true,
|
||||
Email: false,
|
||||
Hostname: false,
|
||||
Regex: regexMap["^[A-Za-z0-9_-]+$"],
|
||||
MinNumeric: 0,
|
||||
MinNumericSet: false,
|
||||
MaxNumeric: 0,
|
||||
MaxNumericSet: false,
|
||||
}).Validate(string(value)); err != nil {
|
||||
return errors.Wrap(err, "string")
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return params, &ogenerrors.DecodeParamError{
|
||||
Name: "cursor",
|
||||
In: "query",
|
||||
Err: err,
|
||||
}
|
||||
}
|
||||
return params, nil
|
||||
}
|
||||
|
||||
// ListMyHiddenOrganizationsParams is parameters of ListMyHiddenOrganizations operation.
|
||||
type ListMyHiddenOrganizationsParams struct {
|
||||
// Maximum number of items in the page. The server may return fewer items even when more remain; use
|
||||
|
||||
@@ -2472,6 +2472,121 @@ func encodeGetOrganizationCandidateCardResponse(response GetOrganizationCandidat
|
||||
}
|
||||
}
|
||||
|
||||
func encodeGetOrganizationCandidateEvidenceResponse(response GetOrganizationCandidateEvidenceRes, w http.ResponseWriter, span trace.Span) error {
|
||||
switch response := response.(type) {
|
||||
case *OrganizationEvidenceHeaders:
|
||||
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 *GetOrganizationCandidateEvidenceBadRequest:
|
||||
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 *GetOrganizationCandidateEvidenceUnauthorized:
|
||||
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 *GetOrganizationCandidateEvidenceForbidden:
|
||||
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 *GetOrganizationCandidateEvidenceNotFound:
|
||||
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
|
||||
|
||||
case *TooManyRequestsHeaders:
|
||||
w.Header().Set("Content-Type", "application/problem+json")
|
||||
w.Header().Set("Access-Control-Expose-Headers", "Retry-After")
|
||||
// Encoding response headers.
|
||||
{
|
||||
h := uri.NewHeaderEncoder(w.Header())
|
||||
// Encode "Retry-After" header.
|
||||
{
|
||||
cfg := uri.HeaderParameterEncodingConfig{
|
||||
Name: "Retry-After",
|
||||
Explode: false,
|
||||
}
|
||||
if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
|
||||
if val, ok := response.RetryAfter.Get(); ok {
|
||||
return e.EncodeValue(conv.Int32ToString(val))
|
||||
}
|
||||
return nil
|
||||
}); err != nil {
|
||||
return errors.Wrap(err, "encode Retry-After header")
|
||||
}
|
||||
}
|
||||
}
|
||||
w.WriteHeader(429)
|
||||
|
||||
e := new(jx.Encoder)
|
||||
response.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 encodeGetOrganizationInvitationResponse(response GetOrganizationInvitationRes, w http.ResponseWriter, span trace.Span) error {
|
||||
switch response := response.(type) {
|
||||
case *OrganizationInvitationHeaders:
|
||||
@@ -3133,6 +3248,77 @@ func encodeListMyConsentsResponse(response ListMyConsentsRes, w http.ResponseWri
|
||||
}
|
||||
}
|
||||
|
||||
func encodeListMyEvidenceResponse(response ListMyEvidenceRes, w http.ResponseWriter, span trace.Span) error {
|
||||
switch response := response.(type) {
|
||||
case *EvidenceFactListHeaders:
|
||||
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 *ListMyEvidenceBadRequest:
|
||||
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 *ListMyEvidenceUnauthorized:
|
||||
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 *ListMyEvidenceForbidden:
|
||||
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
|
||||
|
||||
default:
|
||||
return errors.Errorf("unexpected response type: %T", response)
|
||||
}
|
||||
}
|
||||
|
||||
func encodeListMyHiddenOrganizationsResponse(response ListMyHiddenOrganizationsRes, w http.ResponseWriter, span trace.Span) error {
|
||||
switch response := response.(type) {
|
||||
case *HiddenOrganizationListHeaders:
|
||||
|
||||
@@ -11,46 +11,46 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
rn72AllowedHeaders = map[string]string{
|
||||
rn74AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type",
|
||||
}
|
||||
rn9AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type,Origin",
|
||||
}
|
||||
rn68AllowedHeaders = map[string]string{
|
||||
rn70AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type,Idempotency-Key",
|
||||
}
|
||||
rn64AllowedHeaders = map[string]string{
|
||||
rn66AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type",
|
||||
}
|
||||
rn27AllowedHeaders = map[string]string{
|
||||
"DELETE": "X-Csrf-Token",
|
||||
}
|
||||
rn70AllowedHeaders = map[string]string{
|
||||
rn72AllowedHeaders = map[string]string{
|
||||
"POST": "X-Csrf-Token",
|
||||
}
|
||||
rn11AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type,Idempotency-Key,X-Csrf-Token",
|
||||
}
|
||||
rn83AllowedHeaders = map[string]string{
|
||||
rn85AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type,Idempotency-Key,X-Csrf-Token",
|
||||
}
|
||||
rn22AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type,Idempotency-Key,X-Csrf-Token",
|
||||
}
|
||||
rn82AllowedHeaders = map[string]string{
|
||||
rn84AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type,Idempotency-Key,X-Csrf-Token",
|
||||
}
|
||||
rn67AllowedHeaders = map[string]string{
|
||||
rn69AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type,Idempotency-Key,X-Csrf-Token",
|
||||
}
|
||||
rn5AllowedHeaders = map[string]string{
|
||||
"PUT": "Content-Type,X-Csrf-Token",
|
||||
}
|
||||
rn74AllowedHeaders = map[string]string{
|
||||
rn76AllowedHeaders = map[string]string{
|
||||
"DELETE": "X-Csrf-Token",
|
||||
}
|
||||
rn52AllowedHeaders = map[string]string{
|
||||
rn53AllowedHeaders = map[string]string{
|
||||
"DELETE": "X-Csrf-Token",
|
||||
"PUT": "Content-Type,X-Csrf-Token",
|
||||
}
|
||||
@@ -63,17 +63,17 @@ var (
|
||||
rn19AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type,Idempotency-Key,X-Csrf-Token",
|
||||
}
|
||||
rn84AllowedHeaders = map[string]string{
|
||||
rn86AllowedHeaders = map[string]string{
|
||||
"POST": "X-Csrf-Token",
|
||||
}
|
||||
rn55AllowedHeaders = map[string]string{
|
||||
rn56AllowedHeaders = map[string]string{
|
||||
"DELETE": "X-Csrf-Token",
|
||||
"PUT": "X-Csrf-Token",
|
||||
}
|
||||
rn79AllowedHeaders = map[string]string{
|
||||
rn81AllowedHeaders = map[string]string{
|
||||
"PUT": "Content-Type,X-Csrf-Token",
|
||||
}
|
||||
rn80AllowedHeaders = map[string]string{
|
||||
rn82AllowedHeaders = map[string]string{
|
||||
"PUT": "Content-Type,X-Csrf-Token",
|
||||
}
|
||||
rn38AllowedHeaders = map[string]string{
|
||||
@@ -94,25 +94,25 @@ var (
|
||||
rn16AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type,Idempotency-Key,X-Csrf-Token",
|
||||
}
|
||||
rn45AllowedHeaders = map[string]string{
|
||||
rn46AllowedHeaders = map[string]string{
|
||||
"PATCH": "Content-Type,X-Csrf-Token",
|
||||
}
|
||||
rn66AllowedHeaders = map[string]string{
|
||||
rn68AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type,Idempotency-Key,X-Csrf-Token",
|
||||
}
|
||||
rn79AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type,Idempotency-Key,X-Csrf-Token",
|
||||
}
|
||||
rn87AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type,Idempotency-Key,X-Csrf-Token",
|
||||
}
|
||||
rn77AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type,Idempotency-Key,X-Csrf-Token",
|
||||
}
|
||||
rn85AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type,Idempotency-Key,X-Csrf-Token",
|
||||
}
|
||||
rn75AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type,X-Csrf-Token",
|
||||
}
|
||||
rn18AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type,Idempotency-Key,X-Csrf-Token",
|
||||
}
|
||||
rn48AllowedHeaders = map[string]string{
|
||||
rn49AllowedHeaders = map[string]string{
|
||||
"PATCH": "Content-Type,X-Csrf-Token",
|
||||
}
|
||||
)
|
||||
@@ -269,7 +269,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "POST",
|
||||
allowedHeaders: rn72AllowedHeaders,
|
||||
allowedHeaders: rn74AllowedHeaders,
|
||||
acceptPost: "application/json",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -346,7 +346,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "POST",
|
||||
allowedHeaders: rn68AllowedHeaders,
|
||||
allowedHeaders: rn70AllowedHeaders,
|
||||
acceptPost: "application/json",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -370,7 +370,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "POST",
|
||||
allowedHeaders: rn64AllowedHeaders,
|
||||
allowedHeaders: rn66AllowedHeaders,
|
||||
acceptPost: "application/json",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -450,7 +450,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "POST",
|
||||
allowedHeaders: rn70AllowedHeaders,
|
||||
allowedHeaders: rn72AllowedHeaders,
|
||||
acceptPost: "",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -572,7 +572,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "POST",
|
||||
allowedHeaders: rn83AllowedHeaders,
|
||||
allowedHeaders: rn85AllowedHeaders,
|
||||
acceptPost: "application/json",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -665,7 +665,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "POST",
|
||||
allowedHeaders: rn82AllowedHeaders,
|
||||
allowedHeaders: rn84AllowedHeaders,
|
||||
acceptPost: "application/json",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -692,7 +692,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "POST",
|
||||
allowedHeaders: rn67AllowedHeaders,
|
||||
allowedHeaders: rn69AllowedHeaders,
|
||||
acceptPost: "application/json",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -903,7 +903,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "DELETE",
|
||||
allowedHeaders: rn74AllowedHeaders,
|
||||
allowedHeaders: rn76AllowedHeaders,
|
||||
acceptPost: "",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -937,7 +937,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "DELETE,PUT",
|
||||
allowedHeaders: rn52AllowedHeaders,
|
||||
allowedHeaders: rn53AllowedHeaders,
|
||||
acceptPost: "",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -950,6 +950,31 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
}
|
||||
|
||||
case 'e': // Prefix: "evidence"
|
||||
|
||||
if l := len("evidence"); len(elem) >= l && elem[0:l] == "evidence" {
|
||||
elem = elem[l:]
|
||||
} else {
|
||||
break
|
||||
}
|
||||
|
||||
if len(elem) == 0 {
|
||||
// Leaf node.
|
||||
switch r.Method {
|
||||
case "GET":
|
||||
s.handleListMyEvidenceRequest([0]string{}, elemIsEscaped, w, r)
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "GET",
|
||||
allowedHeaders: nil,
|
||||
acceptPost: "",
|
||||
acceptPatch: "",
|
||||
})
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
case 'i': // Prefix: "invitations"
|
||||
|
||||
if l := len("invitations"); len(elem) >= l && elem[0:l] == "invitations" {
|
||||
@@ -1120,7 +1145,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "POST",
|
||||
allowedHeaders: rn84AllowedHeaders,
|
||||
allowedHeaders: rn86AllowedHeaders,
|
||||
acceptPost: "",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -1300,7 +1325,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "DELETE,PUT",
|
||||
allowedHeaders: rn55AllowedHeaders,
|
||||
allowedHeaders: rn56AllowedHeaders,
|
||||
acceptPost: "",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -1391,7 +1416,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "PUT",
|
||||
allowedHeaders: rn79AllowedHeaders,
|
||||
allowedHeaders: rn81AllowedHeaders,
|
||||
acceptPost: "",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -1418,7 +1443,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "PUT",
|
||||
allowedHeaders: rn80AllowedHeaders,
|
||||
allowedHeaders: rn82AllowedHeaders,
|
||||
acceptPost: "",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -1637,16 +1662,15 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
// Param: "candidate_handle"
|
||||
// Leaf parameter, slashes are prohibited
|
||||
// Match until "/"
|
||||
idx := strings.IndexByte(elem, '/')
|
||||
if idx >= 0 {
|
||||
break
|
||||
if idx < 0 {
|
||||
idx = len(elem)
|
||||
}
|
||||
args[1] = elem
|
||||
elem = ""
|
||||
args[1] = elem[:idx]
|
||||
elem = elem[idx:]
|
||||
|
||||
if len(elem) == 0 {
|
||||
// Leaf node.
|
||||
switch r.Method {
|
||||
case "GET":
|
||||
s.handleGetOrganizationCandidateCardRequest([2]string{
|
||||
@@ -1664,6 +1688,36 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
return
|
||||
}
|
||||
switch elem[0] {
|
||||
case '/': // Prefix: "/evidence"
|
||||
|
||||
if l := len("/evidence"); len(elem) >= l && elem[0:l] == "/evidence" {
|
||||
elem = elem[l:]
|
||||
} else {
|
||||
break
|
||||
}
|
||||
|
||||
if len(elem) == 0 {
|
||||
// Leaf node.
|
||||
switch r.Method {
|
||||
case "GET":
|
||||
s.handleGetOrganizationCandidateEvidenceRequest([2]string{
|
||||
args[0],
|
||||
args[1],
|
||||
}, elemIsEscaped, w, r)
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "GET",
|
||||
allowedHeaders: nil,
|
||||
acceptPost: "",
|
||||
acceptPatch: "",
|
||||
})
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
case 'i': // Prefix: "invitations"
|
||||
|
||||
@@ -1727,7 +1781,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "GET,PATCH",
|
||||
allowedHeaders: rn45AllowedHeaders,
|
||||
allowedHeaders: rn46AllowedHeaders,
|
||||
acceptPost: "",
|
||||
acceptPatch: "application/json",
|
||||
})
|
||||
@@ -1807,7 +1861,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "POST",
|
||||
allowedHeaders: rn66AllowedHeaders,
|
||||
allowedHeaders: rn68AllowedHeaders,
|
||||
acceptPost: "application/json",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -1835,7 +1889,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "POST",
|
||||
allowedHeaders: rn77AllowedHeaders,
|
||||
allowedHeaders: rn79AllowedHeaders,
|
||||
acceptPost: "application/json",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -1865,7 +1919,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "POST",
|
||||
allowedHeaders: rn85AllowedHeaders,
|
||||
allowedHeaders: rn87AllowedHeaders,
|
||||
acceptPost: "application/json",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -1898,7 +1952,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "POST",
|
||||
allowedHeaders: rn75AllowedHeaders,
|
||||
allowedHeaders: rn77AllowedHeaders,
|
||||
acceptPost: "application/json",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -1970,7 +2024,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "GET,PATCH",
|
||||
allowedHeaders: rn48AllowedHeaders,
|
||||
allowedHeaders: rn49AllowedHeaders,
|
||||
acceptPost: "",
|
||||
acceptPatch: "application/json",
|
||||
})
|
||||
@@ -2893,6 +2947,31 @@ func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool) {
|
||||
|
||||
}
|
||||
|
||||
case 'e': // Prefix: "evidence"
|
||||
|
||||
if l := len("evidence"); len(elem) >= l && elem[0:l] == "evidence" {
|
||||
elem = elem[l:]
|
||||
} else {
|
||||
break
|
||||
}
|
||||
|
||||
if len(elem) == 0 {
|
||||
// Leaf node.
|
||||
switch method {
|
||||
case "GET":
|
||||
r.name = ListMyEvidenceOperation
|
||||
r.summary = "List the skill evidence of the current candidate."
|
||||
r.operationID = "ListMyEvidence"
|
||||
r.operationGroup = ""
|
||||
r.pathPattern = "/api/v1/me/evidence"
|
||||
r.args = args
|
||||
r.count = 0
|
||||
return r, true
|
||||
default:
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
case 'i': // Prefix: "invitations"
|
||||
|
||||
if l := len("invitations"); len(elem) >= l && elem[0:l] == "invitations" {
|
||||
@@ -3595,16 +3674,15 @@ func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool) {
|
||||
}
|
||||
|
||||
// Param: "candidate_handle"
|
||||
// Leaf parameter, slashes are prohibited
|
||||
// Match until "/"
|
||||
idx := strings.IndexByte(elem, '/')
|
||||
if idx >= 0 {
|
||||
break
|
||||
if idx < 0 {
|
||||
idx = len(elem)
|
||||
}
|
||||
args[1] = elem
|
||||
elem = ""
|
||||
args[1] = elem[:idx]
|
||||
elem = elem[idx:]
|
||||
|
||||
if len(elem) == 0 {
|
||||
// Leaf node.
|
||||
switch method {
|
||||
case "GET":
|
||||
r.name = GetOrganizationCandidateCardOperation
|
||||
@@ -3619,6 +3697,33 @@ func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool) {
|
||||
return
|
||||
}
|
||||
}
|
||||
switch elem[0] {
|
||||
case '/': // Prefix: "/evidence"
|
||||
|
||||
if l := len("/evidence"); len(elem) >= l && elem[0:l] == "/evidence" {
|
||||
elem = elem[l:]
|
||||
} else {
|
||||
break
|
||||
}
|
||||
|
||||
if len(elem) == 0 {
|
||||
// Leaf node.
|
||||
switch method {
|
||||
case "GET":
|
||||
r.name = GetOrganizationCandidateEvidenceOperation
|
||||
r.summary = "Read the permitted skill evidence of one currently visible candidate card."
|
||||
r.operationID = "GetOrganizationCandidateEvidence"
|
||||
r.operationGroup = ""
|
||||
r.pathPattern = "/api/v1/organizations/{org_id}/candidate-cards/{candidate_handle}/evidence"
|
||||
r.args = args
|
||||
r.count = 2
|
||||
return r, true
|
||||
default:
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
case 'i': // Prefix: "invitations"
|
||||
|
||||
|
||||
@@ -7117,7 +7117,11 @@ func (s *CardCategoryStrength) UnmarshalText(data []byte) error {
|
||||
// leave only through the contact grant of an accepted invitation (C4), and the lowest salary never
|
||||
// leaves.
|
||||
//
|
||||
// - categories: specialization and grade confirmed by an authoritative assessment result.
|
||||
// - categories: specialization and grade confirmed by an authoritative assessment result. With it an
|
||||
// organization receives the confirmed category and, with each category of the card, one supporting
|
||||
// assessment fact: its skill, the passed grade, the trust level, the year of the assessment, and
|
||||
// the basis and calibration that mark a synthetic, uncalibrated demonstration
|
||||
// (`GetOrganizationCandidateEvidence`). The candidate sees the same on `GetMyCardPreview`.
|
||||
// - self_assessment: the candidate's declared specialization and grade, separate from confirmed
|
||||
// categories.
|
||||
// - stack: only recognized technology codes from the server's closed taxonomy.
|
||||
@@ -7231,12 +7235,15 @@ type CardFieldSet []CardField
|
||||
// pseudonym uses a separate preview context and is not an organization's alias. Organization-specific
|
||||
// visibility filters and cohort checks can further generalize or suppress the organization-facing
|
||||
// card. This read creates no view or history record and never reaches an organization. `card` is null
|
||||
// while the profile is closed.
|
||||
// while the profile is closed. `evidence` is what an organization would read in the evidence section
|
||||
// of the card, one supporting assessment fact for each category of the card, and is null exactly when
|
||||
// `card` is null; the organization-facing section can still be generalized or suppressed.
|
||||
// Ref: #/components/schemas/CardPreview
|
||||
type CardPreview struct {
|
||||
State PublicationState `json:"state"`
|
||||
Fields CardFieldSet `json:"fields"`
|
||||
Card NilAnonymousCardContent `json:"card"`
|
||||
Evidence NilOrganizationEvidence `json:"evidence"`
|
||||
GeneratedAt Timestamp `json:"generated_at"`
|
||||
}
|
||||
|
||||
@@ -7255,6 +7262,11 @@ func (s *CardPreview) GetCard() NilAnonymousCardContent {
|
||||
return s.Card
|
||||
}
|
||||
|
||||
// GetEvidence returns the value of Evidence.
|
||||
func (s *CardPreview) GetEvidence() NilOrganizationEvidence {
|
||||
return s.Evidence
|
||||
}
|
||||
|
||||
// GetGeneratedAt returns the value of GeneratedAt.
|
||||
func (s *CardPreview) GetGeneratedAt() Timestamp {
|
||||
return s.GeneratedAt
|
||||
@@ -7275,6 +7287,11 @@ func (s *CardPreview) SetCard(val NilAnonymousCardContent) {
|
||||
s.Card = val
|
||||
}
|
||||
|
||||
// SetEvidence sets the value of Evidence.
|
||||
func (s *CardPreview) SetEvidence(val NilOrganizationEvidence) {
|
||||
s.Evidence = val
|
||||
}
|
||||
|
||||
// SetGeneratedAt sets the value of GeneratedAt.
|
||||
func (s *CardPreview) SetGeneratedAt(val Timestamp) {
|
||||
s.GeneratedAt = val
|
||||
@@ -9672,6 +9689,651 @@ func (EmailVerificationResultEmailVerified) AllValues() []EmailVerificationResul
|
||||
}
|
||||
}
|
||||
|
||||
// Whose contribution the fact is.
|
||||
//
|
||||
// - personal: the candidate's own result. Every assessment fact is personal.
|
||||
// - team_role: a team result with a confirmed role of the candidate.
|
||||
// - team_unattributed: a team result without a confirmed role; it is not a personal skill.
|
||||
//
|
||||
// Only `personal` is produced today.
|
||||
// Ref: #/components/schemas/EvidenceAttribution
|
||||
type EvidenceAttribution string
|
||||
|
||||
const (
|
||||
EvidenceAttributionPersonal EvidenceAttribution = "personal"
|
||||
EvidenceAttributionTeamRole EvidenceAttribution = "team_role"
|
||||
EvidenceAttributionTeamUnattributed EvidenceAttribution = "team_unattributed"
|
||||
)
|
||||
|
||||
// AllValues returns all EvidenceAttribution values.
|
||||
func (EvidenceAttribution) AllValues() []EvidenceAttribution {
|
||||
return []EvidenceAttribution{
|
||||
EvidenceAttributionPersonal,
|
||||
EvidenceAttributionTeamRole,
|
||||
EvidenceAttributionTeamUnattributed,
|
||||
}
|
||||
}
|
||||
|
||||
// MarshalText implements encoding.TextMarshaler.
|
||||
func (s EvidenceAttribution) MarshalText() ([]byte, error) {
|
||||
switch s {
|
||||
case EvidenceAttributionPersonal:
|
||||
return []byte(s), nil
|
||||
case EvidenceAttributionTeamRole:
|
||||
return []byte(s), nil
|
||||
case EvidenceAttributionTeamUnattributed:
|
||||
return []byte(s), nil
|
||||
default:
|
||||
return nil, errors.Errorf("invalid value: %q", s)
|
||||
}
|
||||
}
|
||||
|
||||
// UnmarshalText implements encoding.TextUnmarshaler.
|
||||
func (s *EvidenceAttribution) UnmarshalText(data []byte) error {
|
||||
switch EvidenceAttribution(data) {
|
||||
case EvidenceAttributionPersonal:
|
||||
*s = EvidenceAttributionPersonal
|
||||
return nil
|
||||
case EvidenceAttributionTeamRole:
|
||||
*s = EvidenceAttributionTeamRole
|
||||
return nil
|
||||
case EvidenceAttributionTeamUnattributed:
|
||||
*s = EvidenceAttributionTeamUnattributed
|
||||
return nil
|
||||
default:
|
||||
return errors.Errorf("invalid value: %q", data)
|
||||
}
|
||||
}
|
||||
|
||||
// What the measurement rests on.
|
||||
//
|
||||
// - synthetic_demo: a demonstration category from a synthetic reviewed bank. It shows the mechanics
|
||||
// and is not a validated measurement.
|
||||
//
|
||||
// Ref: #/components/schemas/EvidenceBasis
|
||||
type EvidenceBasis string
|
||||
|
||||
const (
|
||||
EvidenceBasisSyntheticDemo EvidenceBasis = "synthetic_demo"
|
||||
)
|
||||
|
||||
// AllValues returns all EvidenceBasis values.
|
||||
func (EvidenceBasis) AllValues() []EvidenceBasis {
|
||||
return []EvidenceBasis{
|
||||
EvidenceBasisSyntheticDemo,
|
||||
}
|
||||
}
|
||||
|
||||
// MarshalText implements encoding.TextMarshaler.
|
||||
func (s EvidenceBasis) MarshalText() ([]byte, error) {
|
||||
switch s {
|
||||
case EvidenceBasisSyntheticDemo:
|
||||
return []byte(s), nil
|
||||
default:
|
||||
return nil, errors.Errorf("invalid value: %q", s)
|
||||
}
|
||||
}
|
||||
|
||||
// UnmarshalText implements encoding.TextUnmarshaler.
|
||||
func (s *EvidenceBasis) UnmarshalText(data []byte) error {
|
||||
switch EvidenceBasis(data) {
|
||||
case EvidenceBasisSyntheticDemo:
|
||||
*s = EvidenceBasisSyntheticDemo
|
||||
return nil
|
||||
default:
|
||||
return errors.Errorf("invalid value: %q", data)
|
||||
}
|
||||
}
|
||||
|
||||
// Calibration of the method behind the result.
|
||||
//
|
||||
// - uncalibrated: the thresholds are initial values that no measurement has validated.
|
||||
//
|
||||
// Ref: #/components/schemas/EvidenceCalibrationStatus
|
||||
type EvidenceCalibrationStatus string
|
||||
|
||||
const (
|
||||
EvidenceCalibrationStatusUncalibrated EvidenceCalibrationStatus = "uncalibrated"
|
||||
)
|
||||
|
||||
// AllValues returns all EvidenceCalibrationStatus values.
|
||||
func (EvidenceCalibrationStatus) AllValues() []EvidenceCalibrationStatus {
|
||||
return []EvidenceCalibrationStatus{
|
||||
EvidenceCalibrationStatusUncalibrated,
|
||||
}
|
||||
}
|
||||
|
||||
// MarshalText implements encoding.TextMarshaler.
|
||||
func (s EvidenceCalibrationStatus) MarshalText() ([]byte, error) {
|
||||
switch s {
|
||||
case EvidenceCalibrationStatusUncalibrated:
|
||||
return []byte(s), nil
|
||||
default:
|
||||
return nil, errors.Errorf("invalid value: %q", s)
|
||||
}
|
||||
}
|
||||
|
||||
// UnmarshalText implements encoding.TextUnmarshaler.
|
||||
func (s *EvidenceCalibrationStatus) UnmarshalText(data []byte) error {
|
||||
switch EvidenceCalibrationStatus(data) {
|
||||
case EvidenceCalibrationStatusUncalibrated:
|
||||
*s = EvidenceCalibrationStatusUncalibrated
|
||||
return nil
|
||||
default:
|
||||
return errors.Errorf("invalid value: %q", data)
|
||||
}
|
||||
}
|
||||
|
||||
// One independent fact of the current candidate. `occurred_at` is when the source event ended; for an
|
||||
// assessment it is the time of the decision. A fact is one source event; the skills of that event are
|
||||
// tags of the fact, so a second tag never makes a second fact. Hidden facts are listed here with their
|
||||
// visibility, because the candidate owns them.
|
||||
// Ref: #/components/schemas/EvidenceFact
|
||||
type EvidenceFact struct {
|
||||
// Identifier of the fact.
|
||||
ID uuid.UUID `json:"id"`
|
||||
Kind EvidenceKind `json:"kind"`
|
||||
Source EvidenceSource `json:"source"`
|
||||
// Skill tags of the event in ascending order.
|
||||
Skills []EvidenceSkillCode `json:"skills"`
|
||||
Result EvidenceResult `json:"result"`
|
||||
Attribution EvidenceAttribution `json:"attribution"`
|
||||
Trust EvidenceTrustLevel `json:"trust"`
|
||||
OccurredAt Timestamp `json:"occurred_at"`
|
||||
Visibility EvidenceVisibility `json:"visibility"`
|
||||
}
|
||||
|
||||
// GetID returns the value of ID.
|
||||
func (s *EvidenceFact) GetID() uuid.UUID {
|
||||
return s.ID
|
||||
}
|
||||
|
||||
// GetKind returns the value of Kind.
|
||||
func (s *EvidenceFact) GetKind() EvidenceKind {
|
||||
return s.Kind
|
||||
}
|
||||
|
||||
// GetSource returns the value of Source.
|
||||
func (s *EvidenceFact) GetSource() EvidenceSource {
|
||||
return s.Source
|
||||
}
|
||||
|
||||
// GetSkills returns the value of Skills.
|
||||
func (s *EvidenceFact) GetSkills() []EvidenceSkillCode {
|
||||
return s.Skills
|
||||
}
|
||||
|
||||
// GetResult returns the value of Result.
|
||||
func (s *EvidenceFact) GetResult() EvidenceResult {
|
||||
return s.Result
|
||||
}
|
||||
|
||||
// GetAttribution returns the value of Attribution.
|
||||
func (s *EvidenceFact) GetAttribution() EvidenceAttribution {
|
||||
return s.Attribution
|
||||
}
|
||||
|
||||
// GetTrust returns the value of Trust.
|
||||
func (s *EvidenceFact) GetTrust() EvidenceTrustLevel {
|
||||
return s.Trust
|
||||
}
|
||||
|
||||
// GetOccurredAt returns the value of OccurredAt.
|
||||
func (s *EvidenceFact) GetOccurredAt() Timestamp {
|
||||
return s.OccurredAt
|
||||
}
|
||||
|
||||
// GetVisibility returns the value of Visibility.
|
||||
func (s *EvidenceFact) GetVisibility() EvidenceVisibility {
|
||||
return s.Visibility
|
||||
}
|
||||
|
||||
// SetID sets the value of ID.
|
||||
func (s *EvidenceFact) SetID(val uuid.UUID) {
|
||||
s.ID = val
|
||||
}
|
||||
|
||||
// SetKind sets the value of Kind.
|
||||
func (s *EvidenceFact) SetKind(val EvidenceKind) {
|
||||
s.Kind = val
|
||||
}
|
||||
|
||||
// SetSource sets the value of Source.
|
||||
func (s *EvidenceFact) SetSource(val EvidenceSource) {
|
||||
s.Source = val
|
||||
}
|
||||
|
||||
// SetSkills sets the value of Skills.
|
||||
func (s *EvidenceFact) SetSkills(val []EvidenceSkillCode) {
|
||||
s.Skills = val
|
||||
}
|
||||
|
||||
// SetResult sets the value of Result.
|
||||
func (s *EvidenceFact) SetResult(val EvidenceResult) {
|
||||
s.Result = val
|
||||
}
|
||||
|
||||
// SetAttribution sets the value of Attribution.
|
||||
func (s *EvidenceFact) SetAttribution(val EvidenceAttribution) {
|
||||
s.Attribution = val
|
||||
}
|
||||
|
||||
// SetTrust sets the value of Trust.
|
||||
func (s *EvidenceFact) SetTrust(val EvidenceTrustLevel) {
|
||||
s.Trust = val
|
||||
}
|
||||
|
||||
// SetOccurredAt sets the value of OccurredAt.
|
||||
func (s *EvidenceFact) SetOccurredAt(val Timestamp) {
|
||||
s.OccurredAt = val
|
||||
}
|
||||
|
||||
// SetVisibility sets the value of Visibility.
|
||||
func (s *EvidenceFact) SetVisibility(val EvidenceVisibility) {
|
||||
s.Visibility = val
|
||||
}
|
||||
|
||||
// One page of the facts of the current candidate, newest event first.
|
||||
// Ref: #/components/schemas/EvidenceFactList
|
||||
type EvidenceFactList struct {
|
||||
// Facts of the page.
|
||||
Items []EvidenceFact `json:"items"`
|
||||
Page PageInfo `json:"page"`
|
||||
}
|
||||
|
||||
// GetItems returns the value of Items.
|
||||
func (s *EvidenceFactList) GetItems() []EvidenceFact {
|
||||
return s.Items
|
||||
}
|
||||
|
||||
// GetPage returns the value of Page.
|
||||
func (s *EvidenceFactList) GetPage() PageInfo {
|
||||
return s.Page
|
||||
}
|
||||
|
||||
// SetItems sets the value of Items.
|
||||
func (s *EvidenceFactList) SetItems(val []EvidenceFact) {
|
||||
s.Items = val
|
||||
}
|
||||
|
||||
// SetPage sets the value of Page.
|
||||
func (s *EvidenceFactList) SetPage(val PageInfo) {
|
||||
s.Page = val
|
||||
}
|
||||
|
||||
// EvidenceFactListHeaders wraps EvidenceFactList with response headers.
|
||||
type EvidenceFactListHeaders struct {
|
||||
CacheControl CacheControlNoStore
|
||||
Response EvidenceFactList
|
||||
}
|
||||
|
||||
// GetCacheControl returns the value of CacheControl.
|
||||
func (s *EvidenceFactListHeaders) GetCacheControl() CacheControlNoStore {
|
||||
return s.CacheControl
|
||||
}
|
||||
|
||||
// GetResponse returns the value of Response.
|
||||
func (s *EvidenceFactListHeaders) GetResponse() EvidenceFactList {
|
||||
return s.Response
|
||||
}
|
||||
|
||||
// SetCacheControl sets the value of CacheControl.
|
||||
func (s *EvidenceFactListHeaders) SetCacheControl(val CacheControlNoStore) {
|
||||
s.CacheControl = val
|
||||
}
|
||||
|
||||
// SetResponse sets the value of Response.
|
||||
func (s *EvidenceFactListHeaders) SetResponse(val EvidenceFactList) {
|
||||
s.Response = val
|
||||
}
|
||||
|
||||
func (*EvidenceFactListHeaders) listMyEvidenceRes() {}
|
||||
|
||||
// Whether a fact is a statement or an observation.
|
||||
//
|
||||
// - claim: something the candidate stated that nothing confirmed separately. Its trust is 0.
|
||||
// - measurement: a result that a system observed, such as a confirmed assessment. Its trust is 1 to
|
||||
// 3.
|
||||
//
|
||||
// Assessments produce measurements only. A claim never becomes a measurement by repetition, and the
|
||||
// two kinds are stored apart.
|
||||
// Ref: #/components/schemas/EvidenceKind
|
||||
type EvidenceKind string
|
||||
|
||||
const (
|
||||
EvidenceKindClaim EvidenceKind = "claim"
|
||||
EvidenceKindMeasurement EvidenceKind = "measurement"
|
||||
)
|
||||
|
||||
// AllValues returns all EvidenceKind values.
|
||||
func (EvidenceKind) AllValues() []EvidenceKind {
|
||||
return []EvidenceKind{
|
||||
EvidenceKindClaim,
|
||||
EvidenceKindMeasurement,
|
||||
}
|
||||
}
|
||||
|
||||
// MarshalText implements encoding.TextMarshaler.
|
||||
func (s EvidenceKind) MarshalText() ([]byte, error) {
|
||||
switch s {
|
||||
case EvidenceKindClaim:
|
||||
return []byte(s), nil
|
||||
case EvidenceKindMeasurement:
|
||||
return []byte(s), nil
|
||||
default:
|
||||
return nil, errors.Errorf("invalid value: %q", s)
|
||||
}
|
||||
}
|
||||
|
||||
// UnmarshalText implements encoding.TextUnmarshaler.
|
||||
func (s *EvidenceKind) UnmarshalText(data []byte) error {
|
||||
switch EvidenceKind(data) {
|
||||
case EvidenceKindClaim:
|
||||
*s = EvidenceKindClaim
|
||||
return nil
|
||||
case EvidenceKindMeasurement:
|
||||
*s = EvidenceKindMeasurement
|
||||
return nil
|
||||
default:
|
||||
return errors.Errorf("invalid value: %q", data)
|
||||
}
|
||||
}
|
||||
|
||||
// What the fact says: the grade that was passed and how reliable the method is. It carries no score,
|
||||
// answer, item, failure, or anti-cheat data.
|
||||
// Ref: #/components/schemas/EvidenceResult
|
||||
type EvidenceResult struct {
|
||||
Grade GradeCode `json:"grade"`
|
||||
Basis EvidenceBasis `json:"basis"`
|
||||
CalibrationStatus EvidenceCalibrationStatus `json:"calibration_status"`
|
||||
}
|
||||
|
||||
// GetGrade returns the value of Grade.
|
||||
func (s *EvidenceResult) GetGrade() GradeCode {
|
||||
return s.Grade
|
||||
}
|
||||
|
||||
// GetBasis returns the value of Basis.
|
||||
func (s *EvidenceResult) GetBasis() EvidenceBasis {
|
||||
return s.Basis
|
||||
}
|
||||
|
||||
// GetCalibrationStatus returns the value of CalibrationStatus.
|
||||
func (s *EvidenceResult) GetCalibrationStatus() EvidenceCalibrationStatus {
|
||||
return s.CalibrationStatus
|
||||
}
|
||||
|
||||
// SetGrade sets the value of Grade.
|
||||
func (s *EvidenceResult) SetGrade(val GradeCode) {
|
||||
s.Grade = val
|
||||
}
|
||||
|
||||
// SetBasis sets the value of Basis.
|
||||
func (s *EvidenceResult) SetBasis(val EvidenceBasis) {
|
||||
s.Basis = val
|
||||
}
|
||||
|
||||
// SetCalibrationStatus sets the value of CalibrationStatus.
|
||||
func (s *EvidenceResult) SetCalibrationStatus(val EvidenceCalibrationStatus) {
|
||||
s.CalibrationStatus = val
|
||||
}
|
||||
|
||||
// A skill tag from a closed set - the specialization codes of the catalog and the technology codes of
|
||||
// the anonymous card. An assessment tags its fact with the specialization of the category.
|
||||
// Ref: #/components/schemas/EvidenceSkillCode
|
||||
type EvidenceSkillCode string
|
||||
|
||||
const (
|
||||
EvidenceSkillCodeBackend EvidenceSkillCode = "backend"
|
||||
EvidenceSkillCodeFrontend EvidenceSkillCode = "frontend"
|
||||
EvidenceSkillCodeMobile EvidenceSkillCode = "mobile"
|
||||
EvidenceSkillCodeNetworkEngineer EvidenceSkillCode = "network_engineer"
|
||||
EvidenceSkillCodeDevopsSre EvidenceSkillCode = "devops_sre"
|
||||
EvidenceSkillCodeDataAnalyst EvidenceSkillCode = "data_analyst"
|
||||
EvidenceSkillCodeDsMl EvidenceSkillCode = "ds_ml"
|
||||
EvidenceSkillCodeInformationSecurity EvidenceSkillCode = "information_security"
|
||||
EvidenceSkillCodeQa EvidenceSkillCode = "qa"
|
||||
EvidenceSkillCodeGo EvidenceSkillCode = "go"
|
||||
EvidenceSkillCodePostgresql EvidenceSkillCode = "postgresql"
|
||||
EvidenceSkillCodeKafka EvidenceSkillCode = "kafka"
|
||||
EvidenceSkillCodeDocker EvidenceSkillCode = "docker"
|
||||
)
|
||||
|
||||
// AllValues returns all EvidenceSkillCode values.
|
||||
func (EvidenceSkillCode) AllValues() []EvidenceSkillCode {
|
||||
return []EvidenceSkillCode{
|
||||
EvidenceSkillCodeBackend,
|
||||
EvidenceSkillCodeFrontend,
|
||||
EvidenceSkillCodeMobile,
|
||||
EvidenceSkillCodeNetworkEngineer,
|
||||
EvidenceSkillCodeDevopsSre,
|
||||
EvidenceSkillCodeDataAnalyst,
|
||||
EvidenceSkillCodeDsMl,
|
||||
EvidenceSkillCodeInformationSecurity,
|
||||
EvidenceSkillCodeQa,
|
||||
EvidenceSkillCodeGo,
|
||||
EvidenceSkillCodePostgresql,
|
||||
EvidenceSkillCodeKafka,
|
||||
EvidenceSkillCodeDocker,
|
||||
}
|
||||
}
|
||||
|
||||
// MarshalText implements encoding.TextMarshaler.
|
||||
func (s EvidenceSkillCode) MarshalText() ([]byte, error) {
|
||||
switch s {
|
||||
case EvidenceSkillCodeBackend:
|
||||
return []byte(s), nil
|
||||
case EvidenceSkillCodeFrontend:
|
||||
return []byte(s), nil
|
||||
case EvidenceSkillCodeMobile:
|
||||
return []byte(s), nil
|
||||
case EvidenceSkillCodeNetworkEngineer:
|
||||
return []byte(s), nil
|
||||
case EvidenceSkillCodeDevopsSre:
|
||||
return []byte(s), nil
|
||||
case EvidenceSkillCodeDataAnalyst:
|
||||
return []byte(s), nil
|
||||
case EvidenceSkillCodeDsMl:
|
||||
return []byte(s), nil
|
||||
case EvidenceSkillCodeInformationSecurity:
|
||||
return []byte(s), nil
|
||||
case EvidenceSkillCodeQa:
|
||||
return []byte(s), nil
|
||||
case EvidenceSkillCodeGo:
|
||||
return []byte(s), nil
|
||||
case EvidenceSkillCodePostgresql:
|
||||
return []byte(s), nil
|
||||
case EvidenceSkillCodeKafka:
|
||||
return []byte(s), nil
|
||||
case EvidenceSkillCodeDocker:
|
||||
return []byte(s), nil
|
||||
default:
|
||||
return nil, errors.Errorf("invalid value: %q", s)
|
||||
}
|
||||
}
|
||||
|
||||
// UnmarshalText implements encoding.TextUnmarshaler.
|
||||
func (s *EvidenceSkillCode) UnmarshalText(data []byte) error {
|
||||
switch EvidenceSkillCode(data) {
|
||||
case EvidenceSkillCodeBackend:
|
||||
*s = EvidenceSkillCodeBackend
|
||||
return nil
|
||||
case EvidenceSkillCodeFrontend:
|
||||
*s = EvidenceSkillCodeFrontend
|
||||
return nil
|
||||
case EvidenceSkillCodeMobile:
|
||||
*s = EvidenceSkillCodeMobile
|
||||
return nil
|
||||
case EvidenceSkillCodeNetworkEngineer:
|
||||
*s = EvidenceSkillCodeNetworkEngineer
|
||||
return nil
|
||||
case EvidenceSkillCodeDevopsSre:
|
||||
*s = EvidenceSkillCodeDevopsSre
|
||||
return nil
|
||||
case EvidenceSkillCodeDataAnalyst:
|
||||
*s = EvidenceSkillCodeDataAnalyst
|
||||
return nil
|
||||
case EvidenceSkillCodeDsMl:
|
||||
*s = EvidenceSkillCodeDsMl
|
||||
return nil
|
||||
case EvidenceSkillCodeInformationSecurity:
|
||||
*s = EvidenceSkillCodeInformationSecurity
|
||||
return nil
|
||||
case EvidenceSkillCodeQa:
|
||||
*s = EvidenceSkillCodeQa
|
||||
return nil
|
||||
case EvidenceSkillCodeGo:
|
||||
*s = EvidenceSkillCodeGo
|
||||
return nil
|
||||
case EvidenceSkillCodePostgresql:
|
||||
*s = EvidenceSkillCodePostgresql
|
||||
return nil
|
||||
case EvidenceSkillCodeKafka:
|
||||
*s = EvidenceSkillCodeKafka
|
||||
return nil
|
||||
case EvidenceSkillCodeDocker:
|
||||
*s = EvidenceSkillCodeDocker
|
||||
return nil
|
||||
default:
|
||||
return errors.Errorf("invalid value: %q", data)
|
||||
}
|
||||
}
|
||||
|
||||
// Where the fact comes from. For an assessment the event is the attempt and the result is the
|
||||
// immutable result of that attempt, which the candidate reads at `GetMyAssessmentResult`; the two
|
||||
// identifiers are equal because a result is keyed by its attempt.
|
||||
// Ref: #/components/schemas/EvidenceSource
|
||||
type EvidenceSource struct {
|
||||
Type EvidenceSourceType `json:"type"`
|
||||
// Identifier of the source event. One event is one fact, however many skills it is tagged with.
|
||||
EventID uuid.UUID `json:"event_id"`
|
||||
// Identifier of the immutable result that produced the fact.
|
||||
ResultID uuid.UUID `json:"result_id"`
|
||||
}
|
||||
|
||||
// GetType returns the value of Type.
|
||||
func (s *EvidenceSource) GetType() EvidenceSourceType {
|
||||
return s.Type
|
||||
}
|
||||
|
||||
// GetEventID returns the value of EventID.
|
||||
func (s *EvidenceSource) GetEventID() uuid.UUID {
|
||||
return s.EventID
|
||||
}
|
||||
|
||||
// GetResultID returns the value of ResultID.
|
||||
func (s *EvidenceSource) GetResultID() uuid.UUID {
|
||||
return s.ResultID
|
||||
}
|
||||
|
||||
// SetType sets the value of Type.
|
||||
func (s *EvidenceSource) SetType(val EvidenceSourceType) {
|
||||
s.Type = val
|
||||
}
|
||||
|
||||
// SetEventID sets the value of EventID.
|
||||
func (s *EvidenceSource) SetEventID(val uuid.UUID) {
|
||||
s.EventID = val
|
||||
}
|
||||
|
||||
// SetResultID sets the value of ResultID.
|
||||
func (s *EvidenceSource) SetResultID(val uuid.UUID) {
|
||||
s.ResultID = val
|
||||
}
|
||||
|
||||
// Where the fact comes from.
|
||||
//
|
||||
// - assessment_result: a real (root or corrective) assessment result of this platform that confirmed
|
||||
// a grade. An express training run (`demo_express`), a failed attempt, and a result without a
|
||||
// reviewed category source are never a source.
|
||||
//
|
||||
// Adding a value is a contract change.
|
||||
// Ref: #/components/schemas/EvidenceSourceType
|
||||
type EvidenceSourceType string
|
||||
|
||||
const (
|
||||
EvidenceSourceTypeAssessmentResult EvidenceSourceType = "assessment_result"
|
||||
)
|
||||
|
||||
// AllValues returns all EvidenceSourceType values.
|
||||
func (EvidenceSourceType) AllValues() []EvidenceSourceType {
|
||||
return []EvidenceSourceType{
|
||||
EvidenceSourceTypeAssessmentResult,
|
||||
}
|
||||
}
|
||||
|
||||
// MarshalText implements encoding.TextMarshaler.
|
||||
func (s EvidenceSourceType) MarshalText() ([]byte, error) {
|
||||
switch s {
|
||||
case EvidenceSourceTypeAssessmentResult:
|
||||
return []byte(s), nil
|
||||
default:
|
||||
return nil, errors.Errorf("invalid value: %q", s)
|
||||
}
|
||||
}
|
||||
|
||||
// UnmarshalText implements encoding.TextUnmarshaler.
|
||||
func (s *EvidenceSourceType) UnmarshalText(data []byte) error {
|
||||
switch EvidenceSourceType(data) {
|
||||
case EvidenceSourceTypeAssessmentResult:
|
||||
*s = EvidenceSourceTypeAssessmentResult
|
||||
return nil
|
||||
default:
|
||||
return errors.Errorf("invalid value: %q", data)
|
||||
}
|
||||
}
|
||||
|
||||
type EvidenceTrustLevel int32
|
||||
|
||||
// Whether the fact may take part in what an organization reads.
|
||||
//
|
||||
// - visible: the fact is eligible for the organization projection. It does not publish the fact: the
|
||||
// projection also needs the published card with the `categories` field and an active C2.
|
||||
// - hidden: the candidate hid the fact. No organization reads it. Hiding never edits or deletes the
|
||||
// confirmed result.
|
||||
//
|
||||
// Ref: #/components/schemas/EvidenceVisibility
|
||||
type EvidenceVisibility string
|
||||
|
||||
const (
|
||||
EvidenceVisibilityVisible EvidenceVisibility = "visible"
|
||||
EvidenceVisibilityHidden EvidenceVisibility = "hidden"
|
||||
)
|
||||
|
||||
// AllValues returns all EvidenceVisibility values.
|
||||
func (EvidenceVisibility) AllValues() []EvidenceVisibility {
|
||||
return []EvidenceVisibility{
|
||||
EvidenceVisibilityVisible,
|
||||
EvidenceVisibilityHidden,
|
||||
}
|
||||
}
|
||||
|
||||
// MarshalText implements encoding.TextMarshaler.
|
||||
func (s EvidenceVisibility) MarshalText() ([]byte, error) {
|
||||
switch s {
|
||||
case EvidenceVisibilityVisible:
|
||||
return []byte(s), nil
|
||||
case EvidenceVisibilityHidden:
|
||||
return []byte(s), nil
|
||||
default:
|
||||
return nil, errors.Errorf("invalid value: %q", s)
|
||||
}
|
||||
}
|
||||
|
||||
// UnmarshalText implements encoding.TextUnmarshaler.
|
||||
func (s *EvidenceVisibility) UnmarshalText(data []byte) error {
|
||||
switch EvidenceVisibility(data) {
|
||||
case EvidenceVisibilityVisible:
|
||||
*s = EvidenceVisibilityVisible
|
||||
return nil
|
||||
case EvidenceVisibilityHidden:
|
||||
*s = EvidenceVisibilityHidden
|
||||
return nil
|
||||
default:
|
||||
return errors.Errorf("invalid value: %q", data)
|
||||
}
|
||||
}
|
||||
|
||||
type FinalizeMyAssessmentAttemptBadRequest Problem
|
||||
|
||||
func (*FinalizeMyAssessmentAttemptBadRequest) finalizeMyAssessmentAttemptRes() {}
|
||||
@@ -10006,6 +10668,22 @@ type GetOrganizationCandidateCardUnauthorized Problem
|
||||
|
||||
func (*GetOrganizationCandidateCardUnauthorized) getOrganizationCandidateCardRes() {}
|
||||
|
||||
type GetOrganizationCandidateEvidenceBadRequest Problem
|
||||
|
||||
func (*GetOrganizationCandidateEvidenceBadRequest) getOrganizationCandidateEvidenceRes() {}
|
||||
|
||||
type GetOrganizationCandidateEvidenceForbidden Problem
|
||||
|
||||
func (*GetOrganizationCandidateEvidenceForbidden) getOrganizationCandidateEvidenceRes() {}
|
||||
|
||||
type GetOrganizationCandidateEvidenceNotFound Problem
|
||||
|
||||
func (*GetOrganizationCandidateEvidenceNotFound) getOrganizationCandidateEvidenceRes() {}
|
||||
|
||||
type GetOrganizationCandidateEvidenceUnauthorized Problem
|
||||
|
||||
func (*GetOrganizationCandidateEvidenceUnauthorized) getOrganizationCandidateEvidenceRes() {}
|
||||
|
||||
type GetOrganizationForbidden Problem
|
||||
|
||||
func (*GetOrganizationForbidden) getOrganizationRes() {}
|
||||
@@ -11911,6 +12589,18 @@ type ListMyConsentsUnauthorized Problem
|
||||
|
||||
func (*ListMyConsentsUnauthorized) listMyConsentsRes() {}
|
||||
|
||||
type ListMyEvidenceBadRequest Problem
|
||||
|
||||
func (*ListMyEvidenceBadRequest) listMyEvidenceRes() {}
|
||||
|
||||
type ListMyEvidenceForbidden Problem
|
||||
|
||||
func (*ListMyEvidenceForbidden) listMyEvidenceRes() {}
|
||||
|
||||
type ListMyEvidenceUnauthorized Problem
|
||||
|
||||
func (*ListMyEvidenceUnauthorized) listMyEvidenceRes() {}
|
||||
|
||||
type ListMyHiddenOrganizationsBadRequest Problem
|
||||
|
||||
func (*ListMyHiddenOrganizationsBadRequest) listMyHiddenOrganizationsRes() {}
|
||||
@@ -18185,6 +18875,51 @@ func (o NilOrganizationDescription) Or(d OrganizationDescription) OrganizationDe
|
||||
return d
|
||||
}
|
||||
|
||||
// NewNilOrganizationEvidence returns new NilOrganizationEvidence with value set to v.
|
||||
func NewNilOrganizationEvidence(v OrganizationEvidence) NilOrganizationEvidence {
|
||||
return NilOrganizationEvidence{
|
||||
Value: v,
|
||||
}
|
||||
}
|
||||
|
||||
// NilOrganizationEvidence is nullable OrganizationEvidence.
|
||||
type NilOrganizationEvidence struct {
|
||||
Value OrganizationEvidence
|
||||
Null bool
|
||||
}
|
||||
|
||||
// SetTo sets value to v.
|
||||
func (o *NilOrganizationEvidence) SetTo(v OrganizationEvidence) {
|
||||
o.Null = false
|
||||
o.Value = v
|
||||
}
|
||||
|
||||
// IsNull returns true if value is Null.
|
||||
func (o NilOrganizationEvidence) IsNull() bool { return o.Null }
|
||||
|
||||
// SetToNull sets value to null.
|
||||
func (o *NilOrganizationEvidence) SetToNull() {
|
||||
o.Null = true
|
||||
var v OrganizationEvidence
|
||||
o.Value = v
|
||||
}
|
||||
|
||||
// Get returns value and boolean that denotes whether value was set.
|
||||
func (o NilOrganizationEvidence) Get() (v OrganizationEvidence, ok bool) {
|
||||
if o.Null {
|
||||
return v, false
|
||||
}
|
||||
return o.Value, true
|
||||
}
|
||||
|
||||
// Or returns value if set, or given parameter if does not.
|
||||
func (o NilOrganizationEvidence) Or(d OrganizationEvidence) OrganizationEvidence {
|
||||
if v, ok := o.Get(); ok {
|
||||
return v
|
||||
}
|
||||
return d
|
||||
}
|
||||
|
||||
// NewNilOrganizationSphere returns new NilOrganizationSphere with value set to v.
|
||||
func NewNilOrganizationSphere(v OrganizationSphere) NilOrganizationSphere {
|
||||
return NilOrganizationSphere{
|
||||
@@ -22180,6 +22915,133 @@ func (s *OrganizationCreate) SetRepresentatives(val []OrganizationRepresentative
|
||||
|
||||
type OrganizationDescription string
|
||||
|
||||
// The permitted evidence of one candidate card, ordered by skill: at most one fact for each category
|
||||
// of the card (at most nine). The list is empty when no visible fact supports a category of the card.
|
||||
// Ref: #/components/schemas/OrganizationEvidence
|
||||
type OrganizationEvidence struct {
|
||||
// Permitted facts, one for each supported category.
|
||||
Items []OrganizationEvidenceFact `json:"items"`
|
||||
}
|
||||
|
||||
// GetItems returns the value of Items.
|
||||
func (s *OrganizationEvidence) GetItems() []OrganizationEvidenceFact {
|
||||
return s.Items
|
||||
}
|
||||
|
||||
// SetItems sets the value of Items.
|
||||
func (s *OrganizationEvidence) SetItems(val []OrganizationEvidenceFact) {
|
||||
s.Items = val
|
||||
}
|
||||
|
||||
// The one assessment fact that supports a category of the card as an organization reads it: the
|
||||
// earliest visible measurement that passed exactly the confirmed grade of that category. A lower
|
||||
// grade, a retake, the other tags of the event, the source, the basis, the exact time, and every
|
||||
// identifier stay with the candidate. The fact carries no identifier of the fact, the event, the
|
||||
// result, or the candidate, so it cannot be joined to a person by a key. It is not unlinkable: the
|
||||
// skill, the grade, the trust level, and the year, together with the other values of the card, can
|
||||
// narrow a small pool of candidates, and the minimum cohort of the card does not cover the year.
|
||||
// `basis` and `calibration_status` are the same for every candidate: they say that the fact comes from
|
||||
// a synthetic demonstration and is not calibrated, so a demonstration is never read as a validated
|
||||
// measurement. The fact never carries an answer, score, item, failure, signal, or review band.
|
||||
// Ref: #/components/schemas/OrganizationEvidenceFact
|
||||
type OrganizationEvidenceFact struct {
|
||||
Skill EvidenceSkillCode `json:"skill"`
|
||||
Grade GradeCode `json:"grade"`
|
||||
Trust EvidenceTrustLevel `json:"trust"`
|
||||
Basis EvidenceBasis `json:"basis"`
|
||||
CalibrationStatus EvidenceCalibrationStatus `json:"calibration_status"`
|
||||
// Year (UTC) when the assessment ended. The month, day, and time stay with the candidate.
|
||||
ObservedYear int32 `json:"observed_year"`
|
||||
}
|
||||
|
||||
// GetSkill returns the value of Skill.
|
||||
func (s *OrganizationEvidenceFact) GetSkill() EvidenceSkillCode {
|
||||
return s.Skill
|
||||
}
|
||||
|
||||
// GetGrade returns the value of Grade.
|
||||
func (s *OrganizationEvidenceFact) GetGrade() GradeCode {
|
||||
return s.Grade
|
||||
}
|
||||
|
||||
// GetTrust returns the value of Trust.
|
||||
func (s *OrganizationEvidenceFact) GetTrust() EvidenceTrustLevel {
|
||||
return s.Trust
|
||||
}
|
||||
|
||||
// GetBasis returns the value of Basis.
|
||||
func (s *OrganizationEvidenceFact) GetBasis() EvidenceBasis {
|
||||
return s.Basis
|
||||
}
|
||||
|
||||
// GetCalibrationStatus returns the value of CalibrationStatus.
|
||||
func (s *OrganizationEvidenceFact) GetCalibrationStatus() EvidenceCalibrationStatus {
|
||||
return s.CalibrationStatus
|
||||
}
|
||||
|
||||
// GetObservedYear returns the value of ObservedYear.
|
||||
func (s *OrganizationEvidenceFact) GetObservedYear() int32 {
|
||||
return s.ObservedYear
|
||||
}
|
||||
|
||||
// SetSkill sets the value of Skill.
|
||||
func (s *OrganizationEvidenceFact) SetSkill(val EvidenceSkillCode) {
|
||||
s.Skill = val
|
||||
}
|
||||
|
||||
// SetGrade sets the value of Grade.
|
||||
func (s *OrganizationEvidenceFact) SetGrade(val GradeCode) {
|
||||
s.Grade = val
|
||||
}
|
||||
|
||||
// SetTrust sets the value of Trust.
|
||||
func (s *OrganizationEvidenceFact) SetTrust(val EvidenceTrustLevel) {
|
||||
s.Trust = val
|
||||
}
|
||||
|
||||
// SetBasis sets the value of Basis.
|
||||
func (s *OrganizationEvidenceFact) SetBasis(val EvidenceBasis) {
|
||||
s.Basis = val
|
||||
}
|
||||
|
||||
// SetCalibrationStatus sets the value of CalibrationStatus.
|
||||
func (s *OrganizationEvidenceFact) SetCalibrationStatus(val EvidenceCalibrationStatus) {
|
||||
s.CalibrationStatus = val
|
||||
}
|
||||
|
||||
// SetObservedYear sets the value of ObservedYear.
|
||||
func (s *OrganizationEvidenceFact) SetObservedYear(val int32) {
|
||||
s.ObservedYear = val
|
||||
}
|
||||
|
||||
// OrganizationEvidenceHeaders wraps OrganizationEvidence with response headers.
|
||||
type OrganizationEvidenceHeaders struct {
|
||||
CacheControl CacheControlNoStore
|
||||
Response OrganizationEvidence
|
||||
}
|
||||
|
||||
// GetCacheControl returns the value of CacheControl.
|
||||
func (s *OrganizationEvidenceHeaders) GetCacheControl() CacheControlNoStore {
|
||||
return s.CacheControl
|
||||
}
|
||||
|
||||
// GetResponse returns the value of Response.
|
||||
func (s *OrganizationEvidenceHeaders) GetResponse() OrganizationEvidence {
|
||||
return s.Response
|
||||
}
|
||||
|
||||
// SetCacheControl sets the value of CacheControl.
|
||||
func (s *OrganizationEvidenceHeaders) SetCacheControl(val CacheControlNoStore) {
|
||||
s.CacheControl = val
|
||||
}
|
||||
|
||||
// SetResponse sets the value of Response.
|
||||
func (s *OrganizationEvidenceHeaders) SetResponse(val OrganizationEvidence) {
|
||||
s.Response = val
|
||||
}
|
||||
|
||||
func (*OrganizationEvidenceHeaders) getOrganizationCandidateEvidenceRes() {}
|
||||
|
||||
// OrganizationHeaders wraps Organization with response headers.
|
||||
type OrganizationHeaders struct {
|
||||
CacheControl CacheControlNoStore
|
||||
@@ -29642,6 +30504,7 @@ func (*TooManyRequestsHeaders) createOrganizationNeedRes() {}
|
||||
func (*TooManyRequestsHeaders) createOrganizationRes() {}
|
||||
func (*TooManyRequestsHeaders) declineMyInvitationRes() {}
|
||||
func (*TooManyRequestsHeaders) getOrganizationCandidateCardRes() {}
|
||||
func (*TooManyRequestsHeaders) getOrganizationCandidateEvidenceRes() {}
|
||||
func (*TooManyRequestsHeaders) hideOrganizationRes() {}
|
||||
func (*TooManyRequestsHeaders) loginRes() {}
|
||||
func (*TooManyRequestsHeaders) raiseOrganizationInvitationSalaryRes() {}
|
||||
|
||||
@@ -81,6 +81,7 @@ var operationRolesSessionCookie = map[string][]string{
|
||||
GetMySupportCaseOperation: []string{},
|
||||
GetOrganizationOperation: []string{},
|
||||
GetOrganizationCandidateCardOperation: []string{},
|
||||
GetOrganizationCandidateEvidenceOperation: []string{},
|
||||
GetOrganizationInvitationOperation: []string{},
|
||||
GetOrganizationInvitationContactsOperation: []string{},
|
||||
GetOrganizationNeedOperation: []string{},
|
||||
@@ -89,6 +90,7 @@ var operationRolesSessionCookie = map[string][]string{
|
||||
ListMyAssessmentResultsOperation: []string{},
|
||||
ListMyCardAccessHistoryOperation: []string{},
|
||||
ListMyConsentsOperation: []string{},
|
||||
ListMyEvidenceOperation: []string{},
|
||||
ListMyHiddenOrganizationsOperation: []string{},
|
||||
ListMyInvitationsOperation: []string{},
|
||||
ListMyOrganizationsOperation: []string{},
|
||||
|
||||
@@ -663,6 +663,13 @@ type Handler interface {
|
||||
// formats appear only through their separate explicit publication choices, and self-assessment never
|
||||
// becomes a confirmed category. Salary compatibility is nullable and contains no salary amount.
|
||||
//
|
||||
// `evidence` shows what an organization would read in the evidence section of the card
|
||||
// (`GetOrganizationCandidateEvidence`): for each category of the card, the one assessment fact that
|
||||
// supports its confirmed grade, with its skill, the passed grade, the trust level, the year, and the
|
||||
// basis and calibration (`synthetic_demo`, `uncalibrated`). It is null while `card` is null, and an
|
||||
// empty list when the card shows no category or no visible fact supports one. The preview applies no
|
||||
// organization or cohort, so an organization can still receive less.
|
||||
//
|
||||
// A missing, unknown, expired, or revoked session answers 401 unauthenticated; an employer account
|
||||
// answers 403 forbidden.
|
||||
//
|
||||
@@ -841,6 +848,45 @@ type Handler interface {
|
||||
//
|
||||
// GET /api/v1/organizations/{org_id}/candidate-cards/{candidate_handle}
|
||||
GetOrganizationCandidateCard(ctx context.Context, params GetOrganizationCandidateCardParams) (GetOrganizationCandidateCardRes, error)
|
||||
// GetOrganizationCandidateEvidence implements GetOrganizationCandidateEvidence operation.
|
||||
//
|
||||
// Requires the session cookie of an employer account with an active membership in `org_id`. The
|
||||
// organization and membership come from the current server-side session and path, never from cached
|
||||
// search data.
|
||||
//
|
||||
// `candidate_handle` is the organization-scoped opaque alias issued by the current anonymous-card
|
||||
// projection. The server runs the same checks as the card read on every request: active membership,
|
||||
// effective C2 publication, the candidate's hiding of this organization, and the minimum cohort. In
|
||||
// addition the card must publish the `categories` field and show at least one category after the
|
||||
// cohort rules, because the evidence explains those categories and discloses nothing beyond them. An
|
||||
// unknown handle, a handle of another organization, a closed or revoked publication, a profile hidden
|
||||
// from this organization, a profile suppressed by the minimum cohort, and a card without categories
|
||||
// all answer the same 404 not_found. Closing C2 or hiding the organization blocks this read
|
||||
// immediately, and a cached response proves nothing.
|
||||
//
|
||||
// The response lists, for each category of the card, the one visible fact that supports its confirmed
|
||||
// grade: the earliest assessment that passed exactly that grade, so a lower grade or a retake adds
|
||||
// nothing. A fact the candidate hid is absent. Each fact carries only the skill, the passed grade, the
|
||||
// trust level, the year of the assessment, and the basis and calibration of the method
|
||||
// (`synthetic_demo`, `uncalibrated`), which are the same for every candidate and say that the fact is
|
||||
// a demonstration, not a validated measurement. It carries no identifier of the fact, event, result,
|
||||
// or candidate, no month or exact time, and never an answer, item, score, failed attempt, review band,
|
||||
// or anti-cheat signal. An express training run and a failed attempt create no fact. The answer has no
|
||||
// key that joins it to a person, but it is not unlinkable: with the other values of the card it can
|
||||
// narrow a small pool of candidates.
|
||||
//
|
||||
// Reading the evidence is a view of the candidate card: it consumes the organization's current
|
||||
// card-view quota with the same distinct-card rule and is recorded in the access history with the
|
||||
// `categories` field. When the quota is exhausted the operation answers 429 with Retry-After. The
|
||||
// response is `Cache-Control: no-store`.
|
||||
//
|
||||
// A missing, unknown, expired, or revoked session answers 401 unauthenticated; a candidate account
|
||||
// answers 403 forbidden; an unknown organization or account without an active membership answers 404
|
||||
// not_found. An `org_id` that is not a UUID or a malformed candidate handle answers 400
|
||||
// validation_failed.
|
||||
//
|
||||
// GET /api/v1/organizations/{org_id}/candidate-cards/{candidate_handle}/evidence
|
||||
GetOrganizationCandidateEvidence(ctx context.Context, params GetOrganizationCandidateEvidenceParams) (GetOrganizationCandidateEvidenceRes, error)
|
||||
// GetOrganizationInvitation implements GetOrganizationInvitation operation.
|
||||
//
|
||||
// Requires the session cookie of an employer account with an active membership in `org_id`. The
|
||||
@@ -1069,6 +1115,30 @@ type Handler interface {
|
||||
//
|
||||
// GET /api/v1/me/consents
|
||||
ListMyConsents(ctx context.Context, params ListMyConsentsParams) (ListMyConsentsRes, error)
|
||||
// ListMyEvidence implements ListMyEvidence operation.
|
||||
//
|
||||
// Requires the session cookie of a candidate account. The candidate comes from the session, so the
|
||||
// response holds only the caller's own facts. Returns a page, newest event first with the fact
|
||||
// identifier as the tie-breaker, with cursor pagination. The response is `Cache-Control: no-store`.
|
||||
//
|
||||
// A fact is derived from the immutable result of a confirmed real assessment (root or corrective), in
|
||||
// the same transaction that stores the result. Each fact names its source (the event and the result,
|
||||
// which the candidate can open at `GetMyAssessmentResult`), the skills of the event, the grade that
|
||||
// was passed with its basis and calibration, the attribution, the date, the visibility, and the trust
|
||||
// level. An online assessment without a reliable confirmation of the identity has trust 1. One source
|
||||
// event is one fact: its skills are tags of that fact, so several tags never make several facts.
|
||||
//
|
||||
// The list never carries raw answers, items, scores, failed attempts, or anti-cheat data. A failed
|
||||
// attempt, a result without a reviewed category source, and an express training run (`demo_express`)
|
||||
// create no fact, so reading the list before and after an express run shows no new fact. The list
|
||||
// includes facts the candidate hid, with `visibility` `hidden`.
|
||||
//
|
||||
// A missing, unknown, expired, or revoked session answers 401 unauthenticated; an employer account, or
|
||||
// a candidate with an unverified email, answers 403 forbidden. A malformed `limit` or `cursor`, or a
|
||||
// cursor of another candidate, answers 400 validation_failed.
|
||||
//
|
||||
// GET /api/v1/me/evidence
|
||||
ListMyEvidence(ctx context.Context, params ListMyEvidenceParams) (ListMyEvidenceRes, error)
|
||||
// ListMyHiddenOrganizations implements ListMyHiddenOrganizations operation.
|
||||
//
|
||||
// Requires the session cookie of a candidate account. The candidate comes from the session, so the
|
||||
|
||||
@@ -725,6 +725,13 @@ func (UnimplementedHandler) GetMyAssessmentSignalNotice(ctx context.Context) (r
|
||||
// formats appear only through their separate explicit publication choices, and self-assessment never
|
||||
// becomes a confirmed category. Salary compatibility is nullable and contains no salary amount.
|
||||
//
|
||||
// `evidence` shows what an organization would read in the evidence section of the card
|
||||
// (`GetOrganizationCandidateEvidence`): for each category of the card, the one assessment fact that
|
||||
// supports its confirmed grade, with its skill, the passed grade, the trust level, the year, and the
|
||||
// basis and calibration (`synthetic_demo`, `uncalibrated`). It is null while `card` is null, and an
|
||||
// empty list when the card shows no category or no visible fact supports one. The preview applies no
|
||||
// organization or cohort, so an organization can still receive less.
|
||||
//
|
||||
// A missing, unknown, expired, or revoked session answers 401 unauthenticated; an employer account
|
||||
// answers 403 forbidden.
|
||||
//
|
||||
@@ -930,6 +937,48 @@ func (UnimplementedHandler) GetOrganizationCandidateCard(ctx context.Context, pa
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// GetOrganizationCandidateEvidence implements GetOrganizationCandidateEvidence operation.
|
||||
//
|
||||
// Requires the session cookie of an employer account with an active membership in `org_id`. The
|
||||
// organization and membership come from the current server-side session and path, never from cached
|
||||
// search data.
|
||||
//
|
||||
// `candidate_handle` is the organization-scoped opaque alias issued by the current anonymous-card
|
||||
// projection. The server runs the same checks as the card read on every request: active membership,
|
||||
// effective C2 publication, the candidate's hiding of this organization, and the minimum cohort. In
|
||||
// addition the card must publish the `categories` field and show at least one category after the
|
||||
// cohort rules, because the evidence explains those categories and discloses nothing beyond them. An
|
||||
// unknown handle, a handle of another organization, a closed or revoked publication, a profile hidden
|
||||
// from this organization, a profile suppressed by the minimum cohort, and a card without categories
|
||||
// all answer the same 404 not_found. Closing C2 or hiding the organization blocks this read
|
||||
// immediately, and a cached response proves nothing.
|
||||
//
|
||||
// The response lists, for each category of the card, the one visible fact that supports its confirmed
|
||||
// grade: the earliest assessment that passed exactly that grade, so a lower grade or a retake adds
|
||||
// nothing. A fact the candidate hid is absent. Each fact carries only the skill, the passed grade, the
|
||||
// trust level, the year of the assessment, and the basis and calibration of the method
|
||||
// (`synthetic_demo`, `uncalibrated`), which are the same for every candidate and say that the fact is
|
||||
// a demonstration, not a validated measurement. It carries no identifier of the fact, event, result,
|
||||
// or candidate, no month or exact time, and never an answer, item, score, failed attempt, review band,
|
||||
// or anti-cheat signal. An express training run and a failed attempt create no fact. The answer has no
|
||||
// key that joins it to a person, but it is not unlinkable: with the other values of the card it can
|
||||
// narrow a small pool of candidates.
|
||||
//
|
||||
// Reading the evidence is a view of the candidate card: it consumes the organization's current
|
||||
// card-view quota with the same distinct-card rule and is recorded in the access history with the
|
||||
// `categories` field. When the quota is exhausted the operation answers 429 with Retry-After. The
|
||||
// response is `Cache-Control: no-store`.
|
||||
//
|
||||
// A missing, unknown, expired, or revoked session answers 401 unauthenticated; a candidate account
|
||||
// answers 403 forbidden; an unknown organization or account without an active membership answers 404
|
||||
// not_found. An `org_id` that is not a UUID or a malformed candidate handle answers 400
|
||||
// validation_failed.
|
||||
//
|
||||
// GET /api/v1/organizations/{org_id}/candidate-cards/{candidate_handle}/evidence
|
||||
func (UnimplementedHandler) GetOrganizationCandidateEvidence(ctx context.Context, params GetOrganizationCandidateEvidenceParams) (r GetOrganizationCandidateEvidenceRes, _ error) {
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// GetOrganizationInvitation implements GetOrganizationInvitation operation.
|
||||
//
|
||||
// Requires the session cookie of an employer account with an active membership in `org_id`. The
|
||||
@@ -1185,6 +1234,33 @@ func (UnimplementedHandler) ListMyConsents(ctx context.Context, params ListMyCon
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// ListMyEvidence implements ListMyEvidence operation.
|
||||
//
|
||||
// Requires the session cookie of a candidate account. The candidate comes from the session, so the
|
||||
// response holds only the caller's own facts. Returns a page, newest event first with the fact
|
||||
// identifier as the tie-breaker, with cursor pagination. The response is `Cache-Control: no-store`.
|
||||
//
|
||||
// A fact is derived from the immutable result of a confirmed real assessment (root or corrective), in
|
||||
// the same transaction that stores the result. Each fact names its source (the event and the result,
|
||||
// which the candidate can open at `GetMyAssessmentResult`), the skills of the event, the grade that
|
||||
// was passed with its basis and calibration, the attribution, the date, the visibility, and the trust
|
||||
// level. An online assessment without a reliable confirmation of the identity has trust 1. One source
|
||||
// event is one fact: its skills are tags of that fact, so several tags never make several facts.
|
||||
//
|
||||
// The list never carries raw answers, items, scores, failed attempts, or anti-cheat data. A failed
|
||||
// attempt, a result without a reviewed category source, and an express training run (`demo_express`)
|
||||
// create no fact, so reading the list before and after an express run shows no new fact. The list
|
||||
// includes facts the candidate hid, with `visibility` `hidden`.
|
||||
//
|
||||
// A missing, unknown, expired, or revoked session answers 401 unauthenticated; an employer account, or
|
||||
// a candidate with an unverified email, answers 403 forbidden. A malformed `limit` or `cursor`, or a
|
||||
// cursor of another candidate, answers 400 validation_failed.
|
||||
//
|
||||
// GET /api/v1/me/evidence
|
||||
func (UnimplementedHandler) ListMyEvidence(ctx context.Context, params ListMyEvidenceParams) (r ListMyEvidenceRes, _ error) {
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// ListMyHiddenOrganizations implements ListMyHiddenOrganizations operation.
|
||||
//
|
||||
// Requires the session cookie of a candidate account. The candidate comes from the session, so the
|
||||
|
||||
@@ -6512,6 +6512,24 @@ func (s *CardPreview) Validate() error {
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
if err := func() error {
|
||||
if value, ok := s.Evidence.Get(); ok {
|
||||
if err := func() error {
|
||||
if err := value.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
failures = append(failures, validate.FieldError{
|
||||
Name: "evidence",
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
if len(failures) > 0 {
|
||||
return &validate.Error{Fields: failures}
|
||||
}
|
||||
@@ -8833,6 +8851,397 @@ func (s EmailVerificationResultEmailVerified) Validate() error {
|
||||
}
|
||||
}
|
||||
|
||||
func (s EvidenceAttribution) Validate() error {
|
||||
switch s {
|
||||
case "personal":
|
||||
return nil
|
||||
case "team_role":
|
||||
return nil
|
||||
case "team_unattributed":
|
||||
return nil
|
||||
default:
|
||||
return errors.Errorf("invalid value: %v", s)
|
||||
}
|
||||
}
|
||||
|
||||
func (s EvidenceBasis) Validate() error {
|
||||
switch s {
|
||||
case "synthetic_demo":
|
||||
return nil
|
||||
default:
|
||||
return errors.Errorf("invalid value: %v", s)
|
||||
}
|
||||
}
|
||||
|
||||
func (s EvidenceCalibrationStatus) Validate() error {
|
||||
switch s {
|
||||
case "uncalibrated":
|
||||
return nil
|
||||
default:
|
||||
return errors.Errorf("invalid value: %v", s)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *EvidenceFact) Validate() error {
|
||||
if s == nil {
|
||||
return validate.ErrNilPointer
|
||||
}
|
||||
|
||||
var failures []validate.FieldError
|
||||
if err := func() error {
|
||||
if err := s.Kind.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
failures = append(failures, validate.FieldError{
|
||||
Name: "kind",
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
if err := func() error {
|
||||
if err := s.Source.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
failures = append(failures, validate.FieldError{
|
||||
Name: "source",
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
if err := func() error {
|
||||
if s.Skills == nil {
|
||||
return errors.New("nil is invalid value")
|
||||
}
|
||||
if err := (validate.Array{
|
||||
MinLength: 1,
|
||||
MinLengthSet: true,
|
||||
MaxLength: 13,
|
||||
MaxLengthSet: true,
|
||||
}).ValidateLength(len(s.Skills)); err != nil {
|
||||
return errors.Wrap(err, "array")
|
||||
}
|
||||
if err := validate.UniqueItems(s.Skills); err != nil {
|
||||
return errors.Wrap(err, "array")
|
||||
}
|
||||
var failures []validate.FieldError
|
||||
for i, elem := range s.Skills {
|
||||
if err := func() error {
|
||||
if err := elem.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
failures = append(failures, validate.FieldError{
|
||||
Name: fmt.Sprintf("[%d]", i),
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
}
|
||||
if len(failures) > 0 {
|
||||
return &validate.Error{Fields: failures}
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
failures = append(failures, validate.FieldError{
|
||||
Name: "skills",
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
if err := func() error {
|
||||
if err := s.Result.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
failures = append(failures, validate.FieldError{
|
||||
Name: "result",
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
if err := func() error {
|
||||
if err := s.Attribution.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
failures = append(failures, validate.FieldError{
|
||||
Name: "attribution",
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
if err := func() error {
|
||||
if err := s.Trust.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
failures = append(failures, validate.FieldError{
|
||||
Name: "trust",
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
if err := func() error {
|
||||
if err := s.Visibility.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
failures = append(failures, validate.FieldError{
|
||||
Name: "visibility",
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
if len(failures) > 0 {
|
||||
return &validate.Error{Fields: failures}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *EvidenceFactList) Validate() error {
|
||||
if s == nil {
|
||||
return validate.ErrNilPointer
|
||||
}
|
||||
|
||||
var failures []validate.FieldError
|
||||
if err := func() error {
|
||||
if s.Items == nil {
|
||||
return errors.New("nil is invalid value")
|
||||
}
|
||||
if err := (validate.Array{
|
||||
MinLength: 0,
|
||||
MinLengthSet: false,
|
||||
MaxLength: 100,
|
||||
MaxLengthSet: true,
|
||||
}).ValidateLength(len(s.Items)); err != nil {
|
||||
return errors.Wrap(err, "array")
|
||||
}
|
||||
var failures []validate.FieldError
|
||||
for i, elem := range s.Items {
|
||||
if err := func() error {
|
||||
if err := elem.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
failures = append(failures, validate.FieldError{
|
||||
Name: fmt.Sprintf("[%d]", i),
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
}
|
||||
if len(failures) > 0 {
|
||||
return &validate.Error{Fields: failures}
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
failures = append(failures, validate.FieldError{
|
||||
Name: "items",
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
if err := func() error {
|
||||
if err := s.Page.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
failures = append(failures, validate.FieldError{
|
||||
Name: "page",
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
if len(failures) > 0 {
|
||||
return &validate.Error{Fields: failures}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *EvidenceFactListHeaders) Validate() error {
|
||||
if s == nil {
|
||||
return validate.ErrNilPointer
|
||||
}
|
||||
|
||||
var failures []validate.FieldError
|
||||
if err := func() error {
|
||||
if err := s.CacheControl.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
failures = append(failures, validate.FieldError{
|
||||
Name: "CacheControl",
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
if err := func() error {
|
||||
if err := s.Response.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
failures = append(failures, validate.FieldError{
|
||||
Name: "Response",
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
if len(failures) > 0 {
|
||||
return &validate.Error{Fields: failures}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s EvidenceKind) Validate() error {
|
||||
switch s {
|
||||
case "claim":
|
||||
return nil
|
||||
case "measurement":
|
||||
return nil
|
||||
default:
|
||||
return errors.Errorf("invalid value: %v", s)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *EvidenceResult) Validate() error {
|
||||
if s == nil {
|
||||
return validate.ErrNilPointer
|
||||
}
|
||||
|
||||
var failures []validate.FieldError
|
||||
if err := func() error {
|
||||
if err := s.Grade.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
failures = append(failures, validate.FieldError{
|
||||
Name: "grade",
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
if err := func() error {
|
||||
if err := s.Basis.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
failures = append(failures, validate.FieldError{
|
||||
Name: "basis",
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
if err := func() error {
|
||||
if err := s.CalibrationStatus.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
failures = append(failures, validate.FieldError{
|
||||
Name: "calibration_status",
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
if len(failures) > 0 {
|
||||
return &validate.Error{Fields: failures}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s EvidenceSkillCode) Validate() error {
|
||||
switch s {
|
||||
case "backend":
|
||||
return nil
|
||||
case "frontend":
|
||||
return nil
|
||||
case "mobile":
|
||||
return nil
|
||||
case "network_engineer":
|
||||
return nil
|
||||
case "devops_sre":
|
||||
return nil
|
||||
case "data_analyst":
|
||||
return nil
|
||||
case "ds_ml":
|
||||
return nil
|
||||
case "information_security":
|
||||
return nil
|
||||
case "qa":
|
||||
return nil
|
||||
case "go":
|
||||
return nil
|
||||
case "postgresql":
|
||||
return nil
|
||||
case "kafka":
|
||||
return nil
|
||||
case "docker":
|
||||
return nil
|
||||
default:
|
||||
return errors.Errorf("invalid value: %v", s)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *EvidenceSource) Validate() error {
|
||||
if s == nil {
|
||||
return validate.ErrNilPointer
|
||||
}
|
||||
|
||||
var failures []validate.FieldError
|
||||
if err := func() error {
|
||||
if err := s.Type.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
failures = append(failures, validate.FieldError{
|
||||
Name: "type",
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
if len(failures) > 0 {
|
||||
return &validate.Error{Fields: failures}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s EvidenceSourceType) Validate() error {
|
||||
switch s {
|
||||
case "assessment_result":
|
||||
return nil
|
||||
default:
|
||||
return errors.Errorf("invalid value: %v", s)
|
||||
}
|
||||
}
|
||||
|
||||
func (s EvidenceTrustLevel) Validate() error {
|
||||
alias := (int32)(s)
|
||||
if err := (validate.Int{
|
||||
MinSet: true,
|
||||
Min: 0,
|
||||
MaxSet: true,
|
||||
Max: 3,
|
||||
MinExclusive: false,
|
||||
MaxExclusive: false,
|
||||
MultipleOfSet: false,
|
||||
MultipleOf: 0,
|
||||
Pattern: nil,
|
||||
}).Validate(int64(alias)); err != nil {
|
||||
return errors.Wrap(err, "int")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s EvidenceVisibility) Validate() error {
|
||||
switch s {
|
||||
case "visible":
|
||||
return nil
|
||||
case "hidden":
|
||||
return nil
|
||||
default:
|
||||
return errors.Errorf("invalid value: %v", s)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *FinalizeMyAssessmentAttemptBadRequest) Validate() error {
|
||||
alias := (*Problem)(s)
|
||||
if err := alias.Validate(); err != nil {
|
||||
@@ -9379,6 +9788,38 @@ func (s *GetOrganizationCandidateCardUnauthorized) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *GetOrganizationCandidateEvidenceBadRequest) Validate() error {
|
||||
alias := (*Problem)(s)
|
||||
if err := alias.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *GetOrganizationCandidateEvidenceForbidden) Validate() error {
|
||||
alias := (*Problem)(s)
|
||||
if err := alias.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *GetOrganizationCandidateEvidenceNotFound) Validate() error {
|
||||
alias := (*Problem)(s)
|
||||
if err := alias.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *GetOrganizationCandidateEvidenceUnauthorized) Validate() error {
|
||||
alias := (*Problem)(s)
|
||||
if err := alias.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *GetOrganizationForbidden) Validate() error {
|
||||
alias := (*Problem)(s)
|
||||
if err := alias.Validate(); err != nil {
|
||||
@@ -10914,6 +11355,30 @@ func (s *ListMyConsentsUnauthorized) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *ListMyEvidenceBadRequest) Validate() error {
|
||||
alias := (*Problem)(s)
|
||||
if err := alias.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *ListMyEvidenceForbidden) Validate() error {
|
||||
alias := (*Problem)(s)
|
||||
if err := alias.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *ListMyEvidenceUnauthorized) Validate() error {
|
||||
alias := (*Problem)(s)
|
||||
if err := alias.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *ListMyHiddenOrganizationsBadRequest) Validate() error {
|
||||
alias := (*Problem)(s)
|
||||
if err := alias.Validate(); err != nil {
|
||||
@@ -16322,6 +16787,176 @@ func (s OrganizationDescription) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *OrganizationEvidence) Validate() error {
|
||||
if s == nil {
|
||||
return validate.ErrNilPointer
|
||||
}
|
||||
|
||||
var failures []validate.FieldError
|
||||
if err := func() error {
|
||||
if s.Items == nil {
|
||||
return errors.New("nil is invalid value")
|
||||
}
|
||||
if err := (validate.Array{
|
||||
MinLength: 0,
|
||||
MinLengthSet: false,
|
||||
MaxLength: 9,
|
||||
MaxLengthSet: true,
|
||||
}).ValidateLength(len(s.Items)); err != nil {
|
||||
return errors.Wrap(err, "array")
|
||||
}
|
||||
var failures []validate.FieldError
|
||||
for i, elem := range s.Items {
|
||||
if err := func() error {
|
||||
if err := elem.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
failures = append(failures, validate.FieldError{
|
||||
Name: fmt.Sprintf("[%d]", i),
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
}
|
||||
if len(failures) > 0 {
|
||||
return &validate.Error{Fields: failures}
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
failures = append(failures, validate.FieldError{
|
||||
Name: "items",
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
if len(failures) > 0 {
|
||||
return &validate.Error{Fields: failures}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *OrganizationEvidenceFact) Validate() error {
|
||||
if s == nil {
|
||||
return validate.ErrNilPointer
|
||||
}
|
||||
|
||||
var failures []validate.FieldError
|
||||
if err := func() error {
|
||||
if err := s.Skill.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
failures = append(failures, validate.FieldError{
|
||||
Name: "skill",
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
if err := func() error {
|
||||
if err := s.Grade.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
failures = append(failures, validate.FieldError{
|
||||
Name: "grade",
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
if err := func() error {
|
||||
if err := s.Trust.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
failures = append(failures, validate.FieldError{
|
||||
Name: "trust",
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
if err := func() error {
|
||||
if err := s.Basis.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
failures = append(failures, validate.FieldError{
|
||||
Name: "basis",
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
if err := func() error {
|
||||
if err := s.CalibrationStatus.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
failures = append(failures, validate.FieldError{
|
||||
Name: "calibration_status",
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
if err := func() error {
|
||||
if err := (validate.Int{
|
||||
MinSet: true,
|
||||
Min: 2000,
|
||||
MaxSet: true,
|
||||
Max: 9999,
|
||||
MinExclusive: false,
|
||||
MaxExclusive: false,
|
||||
MultipleOfSet: false,
|
||||
MultipleOf: 0,
|
||||
Pattern: nil,
|
||||
}).Validate(int64(s.ObservedYear)); err != nil {
|
||||
return errors.Wrap(err, "int")
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
failures = append(failures, validate.FieldError{
|
||||
Name: "observed_year",
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
if len(failures) > 0 {
|
||||
return &validate.Error{Fields: failures}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *OrganizationEvidenceHeaders) Validate() error {
|
||||
if s == nil {
|
||||
return validate.ErrNilPointer
|
||||
}
|
||||
|
||||
var failures []validate.FieldError
|
||||
if err := func() error {
|
||||
if err := s.CacheControl.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
failures = append(failures, validate.FieldError{
|
||||
Name: "CacheControl",
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
if err := func() error {
|
||||
if err := s.Response.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
failures = append(failures, validate.FieldError{
|
||||
Name: "Response",
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
if len(failures) > 0 {
|
||||
return &validate.Error{Fields: failures}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *OrganizationHeaders) Validate() error {
|
||||
if s == nil {
|
||||
return validate.ErrNilPointer
|
||||
|
||||
@@ -40,6 +40,10 @@ var (
|
||||
// sharedLeafSchemas are the reusable leaves that the privacy family may
|
||||
// refer to; none of them identifies a person or carries a contact.
|
||||
sharedLeafSchemas = []string{"Timestamp", "PageInfo", "SpecializationCode", "GradeCode", "StackTag"}
|
||||
// previewEvidenceSchemas are the evidence leaves that the preview reaches
|
||||
// to show what an organization would read with the categories. They carry
|
||||
// a skill, a grade, a trust level, a year, and the demonstration labels, and no identifier.
|
||||
previewEvidenceSchemas = []string{"OrganizationEvidence", "OrganizationEvidenceFact", "EvidenceSkillCode", "EvidenceTrustLevel", "EvidenceBasis", "EvidenceCalibrationStatus"}
|
||||
)
|
||||
|
||||
func isPrivacySchema(name string) bool {
|
||||
@@ -262,11 +266,11 @@ func TestAnonymousCardReachesNoProfileOrContactSchema(t *testing.T) {
|
||||
}
|
||||
|
||||
// What the card and the preview reach is a small closed list of leaves.
|
||||
allowed := []string{
|
||||
allowed := slices.Concat([]string{
|
||||
"AnonymousCardContent", "CardCategory", "CardCategoryStrength", "CardSelfAssessment", "CardSelfAssessmentConfirmationStatus", "CandidateExperienceBand", "CandidateWorkFormat",
|
||||
"CandidateSalaryCompatibility", "CardField", "CardFieldSet", "PublicationState", "SpecializationCode",
|
||||
"GradeCode", "StackTag", "Timestamp", "CardPreview",
|
||||
}
|
||||
}, previewEvidenceSchemas)
|
||||
for _, name := range []string{"AnonymousCardContent", "CardPreview"} {
|
||||
for reached := range reachableSchemas(index, mustJSONValue(t, spec.Components.Schemas[name])) {
|
||||
if !slices.Contains(allowed, reached) {
|
||||
@@ -286,7 +290,7 @@ func TestAnonymousCardReachesNoProfileOrContactSchema(t *testing.T) {
|
||||
strings.HasPrefix(reached, "Invitation") || strings.HasPrefix(reached, "Need") || strings.HasPrefix(reached, "Consent") {
|
||||
t.Errorf("%s reaches %s", path, reached)
|
||||
}
|
||||
if !isPrivacySchema(reached) && !slices.Contains(sharedLeafSchemas, reached) && !strings.HasPrefix(reached, "Problem") &&
|
||||
if !isPrivacySchema(reached) && !slices.Contains(sharedLeafSchemas, reached) && !slices.Contains(previewEvidenceSchemas, reached) && !strings.HasPrefix(reached, "Problem") &&
|
||||
reached != "Problem" && reached != "ProblemCode" {
|
||||
t.Errorf("%s reaches %s, which is neither a privacy schema nor a shared leaf", path, reached)
|
||||
}
|
||||
|
||||
@@ -52,6 +52,7 @@ func TestCompanyContextMiddlewareFailsClosedAndExcludesOtherScopes(t *testing.T)
|
||||
// Card reads lock any active membership inside their read transaction;
|
||||
// the owner-only capability does not apply to that operation.
|
||||
apiadapter.GetOrganizationCandidateCardOperation,
|
||||
apiadapter.GetOrganizationCandidateEvidenceOperation,
|
||||
apiadapter.HideOrganizationOperation,
|
||||
apiadapter.UnhideOrganizationOperation,
|
||||
apiadapter.RevokeMyOrganizationContactConsentOperation,
|
||||
@@ -135,6 +136,7 @@ func TestCompanyContextOperationInventoryMatchesOpenAPI(t *testing.T) {
|
||||
seen := make(map[string]string, len(ownerCompanyOperations))
|
||||
seenExceptions := make(map[string]bool, len(candidateExceptions))
|
||||
seenCardRead := false
|
||||
seenEvidenceRead := false
|
||||
for path, methods := range document.Paths {
|
||||
for _, operation := range methods {
|
||||
if operation.OperationID == "" {
|
||||
@@ -161,6 +163,13 @@ func TestCompanyContextOperationInventoryMatchesOpenAPI(t *testing.T) {
|
||||
seenCardRead = true
|
||||
continue
|
||||
}
|
||||
// The evidence of a card is a section of that card: it runs the same
|
||||
// transaction-bound membership, visibility, and quota checks.
|
||||
if operation.OperationID == "GetOrganizationCandidateEvidence" &&
|
||||
path == "/api/v1/organizations/{org_id}/candidate-cards/{candidate_handle}/evidence" {
|
||||
seenEvidenceRead = true
|
||||
continue
|
||||
}
|
||||
expectedPath, candidateOperation := candidateExceptions[operation.OperationID]
|
||||
if candidateOperation && expectedPath == path && strings.HasPrefix(path, "/api/v1/me/") {
|
||||
seenExceptions[operation.OperationID] = true
|
||||
@@ -182,6 +191,9 @@ func TestCompanyContextOperationInventoryMatchesOpenAPI(t *testing.T) {
|
||||
if !seenCardRead {
|
||||
t.Error("transaction-authorized candidate card read is absent or moved")
|
||||
}
|
||||
if !seenEvidenceRead {
|
||||
t.Error("transaction-authorized candidate evidence read is absent or moved")
|
||||
}
|
||||
}
|
||||
|
||||
type companyContextAuthenticator struct {
|
||||
|
||||
@@ -0,0 +1,213 @@
|
||||
package httpadapter
|
||||
|
||||
import (
|
||||
"slices"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/ogen-go/ogen"
|
||||
|
||||
"lincodex/backend/internal/adapter/primary/http/api"
|
||||
)
|
||||
|
||||
const (
|
||||
evidenceOwnPath = "/api/v1/me/evidence"
|
||||
evidenceOrganizationPath = "/api/v1/organizations/{org_id}/candidate-cards/{candidate_handle}/evidence"
|
||||
)
|
||||
|
||||
// evidenceSchemas are the schemas of the evidence family.
|
||||
var evidenceSchemas = []string{
|
||||
"EvidenceKind", "EvidenceSourceType", "EvidenceAttribution", "EvidenceTrustLevel", "EvidenceVisibility",
|
||||
"EvidenceSkillCode", "EvidenceBasis", "EvidenceCalibrationStatus", "EvidenceResult", "EvidenceSource",
|
||||
"EvidenceFact", "EvidenceFactList", "OrganizationEvidenceFact", "OrganizationEvidence",
|
||||
}
|
||||
|
||||
// rawAssessmentPropertyNames are properties that carry raw answers, failures,
|
||||
// per-item data, or anti-cheat data. No organization operation and no evidence
|
||||
// operation may declare one.
|
||||
var rawAssessmentPropertyNames = []string{
|
||||
"answer", "answers", "answer_key", "reference_answer", "raw_score", "basic_score", "pass_points", "pass_mark_basis_points",
|
||||
"scored_items", "uncertainty", "weak_domains", "practice_results", "practice", "signals", "events", "item_instance_id",
|
||||
"items_answered", "seed", "variant", "hidden_checks", "category_decision", "next_step", "not_determined_reason",
|
||||
"band", "reasons", "attempt_id",
|
||||
}
|
||||
|
||||
// Both evidence operations follow the project conventions: the session cookie
|
||||
// alone (they only read), the unauthenticated and forbidden problems, no-store
|
||||
// on the success, and the shared cursor parameters for the paged list. No new
|
||||
// problem code is needed.
|
||||
func TestEvidenceOperationsFollowTheConventions(t *testing.T) {
|
||||
spec := parsePublicContract(t)
|
||||
own := operationByID(t, spec, "ListMyEvidence")
|
||||
organization := operationByID(t, spec, "GetOrganizationCandidateEvidence")
|
||||
for _, operation := range []*ogen.Operation{own, organization} {
|
||||
if !slices.Contains(operation.Tags, "evidence") {
|
||||
t.Errorf("%s is not in the evidence tag", operation.OperationID)
|
||||
}
|
||||
if !hasSecurity(operation, "sessionCookie") || hasSecurity(operation, "sessionCsrf") {
|
||||
t.Errorf("%s security = %v, want the session cookie without a CSRF token for a read", operation.OperationID, operation.Security)
|
||||
}
|
||||
for _, status := range []string{"400", "401", "403", "default"} {
|
||||
if operation.Responses[status] == nil {
|
||||
t.Errorf("%s does not declare %s", operation.OperationID, status)
|
||||
}
|
||||
}
|
||||
if success := operation.Responses["200"]; success == nil || success.Headers["Cache-Control"] == nil {
|
||||
t.Errorf("%s does not mark its 200 response no-store", operation.OperationID)
|
||||
}
|
||||
if operation.RequestBody != nil {
|
||||
t.Errorf("%s takes a body, but it only reads", operation.OperationID)
|
||||
}
|
||||
}
|
||||
names := []string{}
|
||||
for _, parameter := range own.Parameters {
|
||||
names = append(names, parameterName(parameter))
|
||||
}
|
||||
if !slices.Contains(names, "PageLimit") || !slices.Contains(names, "PageCursor") {
|
||||
t.Errorf("ListMyEvidence parameters = %v, want the shared PageLimit and PageCursor", names)
|
||||
}
|
||||
names = names[:0]
|
||||
for _, parameter := range organization.Parameters {
|
||||
names = append(names, parameterName(parameter))
|
||||
}
|
||||
if !slices.Equal(names, []string{"OrganizationId", "CandidateHandle"}) {
|
||||
t.Errorf("GetOrganizationCandidateEvidence parameters = %v, want the organization and the candidate handle", names)
|
||||
}
|
||||
// The organization read answers an unknown, hidden, unpublished, and
|
||||
// suppressed card alike, and the quota with Retry-After.
|
||||
if organization.Responses["404"] == nil || organization.Responses["429"] == nil {
|
||||
t.Error("GetOrganizationCandidateEvidence must declare 404 and 429")
|
||||
}
|
||||
if own.Responses["404"] != nil {
|
||||
t.Error("ListMyEvidence declares 404: a list has no missing resource")
|
||||
}
|
||||
|
||||
codes := enumValues(t, resolveSchema(t, spec, &ogen.Schema{Ref: "#/components/schemas/ProblemCode"}))
|
||||
for _, code := range []string{"validation_failed", "unauthenticated", "forbidden", "not_found", "rate_limited"} {
|
||||
if !slices.Contains(codes, code) {
|
||||
t.Errorf("ProblemCode has no %s", code)
|
||||
}
|
||||
}
|
||||
if spec.Paths[evidenceOwnPath] == nil || spec.Paths[evidenceOrganizationPath] == nil {
|
||||
t.Errorf("the contract lacks the paths %s and %s", evidenceOwnPath, evidenceOrganizationPath)
|
||||
}
|
||||
}
|
||||
|
||||
// A claim and a measurement are different kinds with different trust ranges,
|
||||
// every evidence object is closed, and the organization fact has no identifier
|
||||
// and no exact time.
|
||||
func TestEvidenceSchemasAreClosedAndSeparateClaimsFromMeasurements(t *testing.T) {
|
||||
spec := parsePublicContract(t)
|
||||
if got := enumValues(t, spec.Components.Schemas["EvidenceKind"]); !slices.Equal(got, []string{"claim", "measurement"}) {
|
||||
t.Errorf("EvidenceKind = %v, want claim and measurement", got)
|
||||
}
|
||||
trust := spec.Components.Schemas["EvidenceTrustLevel"]
|
||||
if string(trust.Minimum) != "0" || string(trust.Maximum) != "3" {
|
||||
t.Errorf("EvidenceTrustLevel range = %s..%s, want 0..3", trust.Minimum, trust.Maximum)
|
||||
}
|
||||
for _, pair := range []struct {
|
||||
name string
|
||||
want []string
|
||||
}{
|
||||
{"EvidenceFact", []string{"attribution", "id", "kind", "occurred_at", "result", "skills", "source", "trust", "visibility"}},
|
||||
{"EvidenceSource", []string{"event_id", "result_id", "type"}},
|
||||
{"EvidenceResult", []string{"basis", "calibration_status", "grade"}},
|
||||
{"EvidenceFactList", []string{"items", "page"}},
|
||||
{"OrganizationEvidenceFact", []string{"basis", "calibration_status", "grade", "observed_year", "skill", "trust"}},
|
||||
{"OrganizationEvidence", []string{"items"}},
|
||||
} {
|
||||
schema := spec.Components.Schemas[pair.name]
|
||||
if schema == nil {
|
||||
t.Fatalf("the contract has no schema %s", pair.name)
|
||||
}
|
||||
if got := propertyNames(schema); !slices.Equal(got, pair.want) {
|
||||
t.Errorf("%s properties = %v, want %v", pair.name, got, pair.want)
|
||||
}
|
||||
if schema.AdditionalProperties.Bool == nil || *schema.AdditionalProperties.Bool {
|
||||
t.Errorf("%s accepts unknown properties", pair.name)
|
||||
}
|
||||
if required := slices.Sorted(slices.Values(schema.Required)); !slices.Equal(required, pair.want) {
|
||||
t.Errorf("%s requires %v, want every property %v", pair.name, required, pair.want)
|
||||
}
|
||||
}
|
||||
assertNoJSONFields(t, api.OrganizationEvidenceFact{}, []string{"id", "event_id", "result_id", "occurred_at", "visibility", "candidate_id", "user_id"})
|
||||
for _, property := range spec.Components.Schemas["EvidenceFact"].Properties {
|
||||
if property.Name == "skills" && (!property.Schema.UniqueItems || property.Schema.MinItems == nil || *property.Schema.MinItems != 1) {
|
||||
t.Errorf("EvidenceFact.skills must be a non-empty set: one event with several tags is one fact")
|
||||
}
|
||||
}
|
||||
// An organization reads at most one fact for each category of the card.
|
||||
items := spec.Components.Schemas["OrganizationEvidence"].Properties
|
||||
for _, property := range items {
|
||||
if property.Name == "items" && (property.Schema.MaxItems == nil || *property.Schema.MaxItems != 9) {
|
||||
t.Errorf("OrganizationEvidence.items maxItems = %v, want 9: one fact for each of the nine possible categories", property.Schema.MaxItems)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// No organization operation reaches raw answers, failures, per-item data, or
|
||||
// anti-cheat data, and neither does the evidence of the candidate. The walk
|
||||
// covers every request body, response, parameter, and header through all
|
||||
// references, so a new organization operation cannot reach an assessment
|
||||
// result, attempt, or signal schema by reuse.
|
||||
func TestNoOrganizationOperationReachesRawAssessmentData(t *testing.T) {
|
||||
spec := parsePublicContract(t)
|
||||
index := componentsIndex(t, spec)
|
||||
walked := 0
|
||||
for path, item := range spec.Paths {
|
||||
organizationOperation := strings.HasPrefix(path, "/api/v1/organizations")
|
||||
if !organizationOperation && path != evidenceOwnPath {
|
||||
continue
|
||||
}
|
||||
walked++
|
||||
value := mustJSONValue(t, item)
|
||||
properties := map[string]bool{}
|
||||
declaredPropertyNames(value, properties)
|
||||
for schemaName := range reachableSchemas(index, value) {
|
||||
if strings.HasPrefix(schemaName, "Assessment") || strings.HasPrefix(schemaName, "Practice") ||
|
||||
strings.HasPrefix(schemaName, "ItemContent") || strings.Contains(schemaName, "Signal") ||
|
||||
strings.Contains(schemaName, "Review") {
|
||||
t.Errorf("%s reaches the assessment schema %s", path, schemaName)
|
||||
}
|
||||
declaredPropertyNames(mustJSONValue(t, index["#/components/schemas/"+schemaName]), properties)
|
||||
}
|
||||
if path == evidenceOwnPath && !properties["skills"] {
|
||||
t.Errorf("%s declares no skills property: the walk did not reach the schemas", path)
|
||||
}
|
||||
for _, raw := range rawAssessmentPropertyNames {
|
||||
if properties[raw] {
|
||||
t.Errorf("%s declares the raw assessment property %q", path, raw)
|
||||
}
|
||||
}
|
||||
}
|
||||
if walked < 10 {
|
||||
t.Fatalf("walked only %d organization and evidence paths, want all of them", walked)
|
||||
}
|
||||
}
|
||||
|
||||
// The walk is not vacuous: it reaches the evidence family from both
|
||||
// operations, and the family keeps the failure outcomes out of its enums.
|
||||
func TestEvidenceWalkReachesTheEvidenceFamily(t *testing.T) {
|
||||
spec := parsePublicContract(t)
|
||||
index := componentsIndex(t, spec)
|
||||
for operationID, want := range map[string][]string{
|
||||
"ListMyEvidence": {"EvidenceFact", "EvidenceSource", "EvidenceResult", "EvidenceTrustLevel"},
|
||||
"GetOrganizationCandidateEvidence": {"OrganizationEvidenceFact", "EvidenceSkillCode", "EvidenceTrustLevel"},
|
||||
} {
|
||||
reached := reachableSchemas(index, mustJSONValue(t, operationByID(t, spec, operationID)))
|
||||
for _, name := range want {
|
||||
if !reached[name] {
|
||||
t.Errorf("%s does not reach %s", operationID, name)
|
||||
}
|
||||
}
|
||||
}
|
||||
enums := map[string]bool{}
|
||||
for _, name := range evidenceSchemas {
|
||||
declaredEnumValues(mustJSONValue(t, spec.Components.Schemas[name]), enums)
|
||||
}
|
||||
for _, failure := range []string{"not_confirmed", "not_determined", "failed", "expired", "demonstration", "demo_express", "review", "attention"} {
|
||||
if enums[failure] {
|
||||
t.Errorf("the evidence family declares the enum value %q", failure)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,7 @@ type Handler struct {
|
||||
assessment *AssessmentHandler
|
||||
assessmentSignals *AssessmentSignalHandler
|
||||
privacy *PrivacyHandler
|
||||
evidence *EvidenceHandler
|
||||
problems *problem.Responder
|
||||
}
|
||||
|
||||
@@ -92,6 +93,12 @@ func WithPrivacy(privacy *PrivacyHandler) HandlerOption {
|
||||
return func(handler *Handler) { handler.privacy = privacy }
|
||||
}
|
||||
|
||||
// WithEvidence serves the skill evidence of a candidate and its permitted
|
||||
// organization projection.
|
||||
func WithEvidence(evidence *EvidenceHandler) HandlerOption {
|
||||
return func(handler *Handler) { handler.evidence = evidence }
|
||||
}
|
||||
|
||||
func NewHandler(health *HealthHandler, problems *problem.Responder, options ...HandlerOption) *Handler {
|
||||
handler := &Handler{health: health, problems: problems}
|
||||
for _, option := range options {
|
||||
|
||||
@@ -0,0 +1,162 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/google/uuid"
|
||||
|
||||
"lincodex/backend/internal/adapter/primary/http/api"
|
||||
"lincodex/backend/internal/adapter/primary/http/problem"
|
||||
"lincodex/backend/internal/domain"
|
||||
"lincodex/backend/internal/port/outbound"
|
||||
"lincodex/backend/internal/usecase/candidateview"
|
||||
"lincodex/backend/internal/usecase/evidence"
|
||||
)
|
||||
|
||||
// EvidenceOperations reads the skill evidence projection.
|
||||
type EvidenceOperations interface {
|
||||
ListMine(ctx context.Context, query outbound.EvidenceListQuery) (outbound.EvidenceFactPage, error)
|
||||
ListForOrganization(ctx context.Context, actorID, organizationID uuid.UUID, handle string) ([]domain.EvidenceOrganizationFact, error)
|
||||
}
|
||||
|
||||
// EvidenceHandler binds the evidence read use cases to the v1 API.
|
||||
type EvidenceHandler struct {
|
||||
operations EvidenceOperations
|
||||
}
|
||||
|
||||
func NewEvidenceHandler(operations EvidenceOperations) *EvidenceHandler {
|
||||
if operations == nil {
|
||||
panic("v1.NewEvidenceHandler - operations must not be nil")
|
||||
}
|
||||
return &EvidenceHandler{operations: operations}
|
||||
}
|
||||
|
||||
func (handler *Handler) ListMyEvidence(ctx context.Context, params api.ListMyEvidenceParams) (api.ListMyEvidenceRes, error) {
|
||||
if handler.evidence == nil {
|
||||
return handler.UnimplementedHandler.ListMyEvidence(ctx, params)
|
||||
}
|
||||
return handler.evidence.ListMyEvidence(ctx, params)
|
||||
}
|
||||
|
||||
func (handler *Handler) GetOrganizationCandidateEvidence(
|
||||
ctx context.Context,
|
||||
params api.GetOrganizationCandidateEvidenceParams,
|
||||
) (api.GetOrganizationCandidateEvidenceRes, error) {
|
||||
if handler.evidence == nil {
|
||||
return handler.UnimplementedHandler.GetOrganizationCandidateEvidence(ctx, params)
|
||||
}
|
||||
return handler.evidence.GetOrganizationCandidateEvidence(ctx, params)
|
||||
}
|
||||
|
||||
func (handler *EvidenceHandler) ListMyEvidence(ctx context.Context, params api.ListMyEvidenceParams) (api.ListMyEvidenceRes, error) {
|
||||
const location = "EvidenceHandler.ListMyEvidence"
|
||||
principal, ok := PrincipalFromContext(ctx)
|
||||
if !ok {
|
||||
return (*api.ListMyEvidenceUnauthorized)(&problem.New(ctx, api.ProblemCodeUnauthenticated).Response), nil
|
||||
}
|
||||
limit, cursor, pointer := privacyPageParams(params.Limit, params.Cursor, principal.UserID, privacyCursorEvidence)
|
||||
if pointer != "" {
|
||||
return (*api.ListMyEvidenceBadRequest)(&problem.InvalidField(ctx, api.ProblemFieldLocationQuery, "/"+pointer).Response), nil
|
||||
}
|
||||
query := outbound.EvidenceListQuery{CandidateID: principal.UserID, Limit: limit}
|
||||
if cursor != nil {
|
||||
query.After = &outbound.EvidencePosition{OccurredAt: cursor.at, ID: cursor.id}
|
||||
}
|
||||
page, err := handler.operations.ListMine(ctx, query)
|
||||
if err != nil {
|
||||
if errors.Is(err, evidence.ErrForbidden) {
|
||||
return (*api.ListMyEvidenceForbidden)(&problem.New(ctx, api.ProblemCodeForbidden).Response), nil
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
items := make([]api.EvidenceFact, 0, len(page.Items))
|
||||
for _, fact := range page.Items {
|
||||
items = append(items, evidenceFactResponse(fact.Snapshot()))
|
||||
}
|
||||
next, err := privacyNextCursor(page.HasMore, len(page.Items), func() (string, error) {
|
||||
last := outbound.EvidencePositionOf(page.Items[len(page.Items)-1])
|
||||
return encodePrivacyCursor(principal.UserID, privacyCursorEvidence, last.OccurredAt, last.ID)
|
||||
})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("%s - encode cursor: %w", location, err)
|
||||
}
|
||||
return &api.EvidenceFactListHeaders{
|
||||
CacheControl: api.CacheControlNoStoreNoStore,
|
||||
Response: api.EvidenceFactList{Items: items, Page: api.PageInfo{HasMore: page.HasMore, NextCursor: next}},
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (handler *EvidenceHandler) GetOrganizationCandidateEvidence(
|
||||
ctx context.Context,
|
||||
params api.GetOrganizationCandidateEvidenceParams,
|
||||
) (api.GetOrganizationCandidateEvidenceRes, error) {
|
||||
principal, ok := PrincipalFromContext(ctx)
|
||||
if !ok {
|
||||
return (*api.GetOrganizationCandidateEvidenceUnauthorized)(&problem.New(ctx, api.ProblemCodeUnauthenticated).Response), nil
|
||||
}
|
||||
facts, err := handler.operations.ListForOrganization(ctx, principal.UserID, params.OrgID, string(params.CandidateHandle))
|
||||
if err != nil {
|
||||
switch {
|
||||
case errors.Is(err, candidateview.ErrForbidden):
|
||||
return (*api.GetOrganizationCandidateEvidenceForbidden)(&problem.New(ctx, api.ProblemCodeForbidden).Response), nil
|
||||
case errors.Is(err, candidateview.ErrCandidateCardNotFound), errors.Is(err, outbound.ErrOrganizationNotFound):
|
||||
return (*api.GetOrganizationCandidateEvidenceNotFound)(&problem.New(ctx, api.ProblemCodeNotFound).Response), nil
|
||||
case errors.Is(err, candidateview.ErrInvalidCandidateHandle):
|
||||
return (*api.GetOrganizationCandidateEvidenceBadRequest)(&problem.InvalidField(ctx, api.ProblemFieldLocationPath, "/candidate_handle").Response), nil
|
||||
}
|
||||
if limited, ok := candidateViewRateLimited(ctx, err); ok {
|
||||
return limited, nil
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
evidence := organizationEvidenceResponse(facts)
|
||||
return &api.OrganizationEvidenceHeaders{
|
||||
CacheControl: api.CacheControlNoStoreNoStore,
|
||||
Response: evidence,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func evidenceFactResponse(fact domain.EvidenceFactSnapshot) api.EvidenceFact {
|
||||
return api.EvidenceFact{
|
||||
ID: fact.ID, Kind: api.EvidenceKind(fact.Kind),
|
||||
Source: api.EvidenceSource{
|
||||
Type: api.EvidenceSourceType(fact.SourceType), EventID: fact.EventID, ResultID: fact.ResultID,
|
||||
},
|
||||
Skills: evidenceSkillsResponse(fact.Skills),
|
||||
Result: evidenceResultResponse(fact.Result),
|
||||
Attribution: api.EvidenceAttribution(fact.Attribution), Trust: api.EvidenceTrustLevel(fact.Trust),
|
||||
OccurredAt: api.Timestamp(fact.OccurredAt), Visibility: api.EvidenceVisibility(fact.Visibility),
|
||||
}
|
||||
}
|
||||
|
||||
// organizationEvidenceResponse maps the allowlisted facts that an
|
||||
// organization, or the preview of the candidate, reads.
|
||||
func organizationEvidenceResponse(facts []domain.EvidenceOrganizationFact) api.OrganizationEvidence {
|
||||
items := make([]api.OrganizationEvidenceFact, 0, len(facts))
|
||||
for _, fact := range facts {
|
||||
input := fact.Input()
|
||||
items = append(items, api.OrganizationEvidenceFact{
|
||||
Skill: api.EvidenceSkillCode(input.Skill), Grade: api.GradeCode(input.Grade),
|
||||
Trust: api.EvidenceTrustLevel(input.Trust), Basis: api.EvidenceBasis(input.Basis),
|
||||
CalibrationStatus: api.EvidenceCalibrationStatus(input.CalibrationStatus), ObservedYear: input.ObservedYear,
|
||||
})
|
||||
}
|
||||
return api.OrganizationEvidence{Items: items}
|
||||
}
|
||||
|
||||
func evidenceSkillsResponse(skills []domain.EvidenceSkillCode) []api.EvidenceSkillCode {
|
||||
response := make([]api.EvidenceSkillCode, 0, len(skills))
|
||||
for _, skill := range skills {
|
||||
response = append(response, api.EvidenceSkillCode(skill))
|
||||
}
|
||||
return response
|
||||
}
|
||||
|
||||
func evidenceResultResponse(result domain.EvidenceResult) api.EvidenceResult {
|
||||
return api.EvidenceResult{
|
||||
Grade: api.GradeCode(result.Grade), Basis: api.EvidenceBasis(result.Basis),
|
||||
CalibrationStatus: api.EvidenceCalibrationStatus(result.CalibrationStatus),
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,225 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
|
||||
"lincodex/backend/internal/adapter/primary/http/api"
|
||||
"lincodex/backend/internal/domain"
|
||||
"lincodex/backend/internal/port/outbound"
|
||||
"lincodex/backend/internal/usecase/candidateview"
|
||||
"lincodex/backend/internal/usecase/evidence"
|
||||
)
|
||||
|
||||
type evidenceOperationsStub struct {
|
||||
page outbound.EvidenceFactPage
|
||||
facts []domain.EvidenceOrganizationFact
|
||||
err error
|
||||
query outbound.EvidenceListQuery
|
||||
actorID uuid.UUID
|
||||
orgID uuid.UUID
|
||||
handle string
|
||||
listCalls int
|
||||
}
|
||||
|
||||
func (stub *evidenceOperationsStub) ListMine(_ context.Context, query outbound.EvidenceListQuery) (outbound.EvidenceFactPage, error) {
|
||||
stub.query = query
|
||||
return stub.page, stub.err
|
||||
}
|
||||
|
||||
func (stub *evidenceOperationsStub) ListForOrganization(_ context.Context, actorID, organizationID uuid.UUID, handle string) ([]domain.EvidenceOrganizationFact, error) {
|
||||
stub.listCalls++
|
||||
stub.actorID, stub.orgID, stub.handle = actorID, organizationID, handle
|
||||
return stub.facts, stub.err
|
||||
}
|
||||
|
||||
func evidenceTestFact(t *testing.T, candidateID uuid.UUID, at time.Time) domain.EvidenceFact {
|
||||
t.Helper()
|
||||
attempt := uuid.New()
|
||||
fact, err := domain.RestoreEvidenceFact(domain.EvidenceFactSnapshot{
|
||||
ID: uuid.New(), CandidateID: candidateID, Kind: domain.EvidenceKindMeasurement,
|
||||
SourceType: domain.EvidenceSourceAssessmentResult, EventID: attempt, ResultID: attempt,
|
||||
Skills: []domain.EvidenceSkillCode{"go", "backend"},
|
||||
Result: domain.EvidenceResult{
|
||||
Grade: domain.GradeJunior, Basis: domain.AssessmentCategorySourceSyntheticDemo,
|
||||
CalibrationStatus: domain.AssessmentCategoryCalibrationUncalibrated,
|
||||
},
|
||||
Attribution: domain.EvidenceAttributionPersonal, Trust: domain.EvidenceTrustOnlineUnconfirmed,
|
||||
OccurredAt: at, Visibility: domain.EvidenceVisibilityVisible,
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("RestoreEvidenceFact() error = %v", err)
|
||||
}
|
||||
return fact
|
||||
}
|
||||
|
||||
func TestListMyEvidenceMapsFactsAndPagesWithAnOwnerBoundCursor(t *testing.T) {
|
||||
userID := uuid.New()
|
||||
at := time.Date(2026, 10, 8, 10, 15, 0, 0, time.UTC)
|
||||
stub := &evidenceOperationsStub{page: outbound.EvidenceFactPage{
|
||||
Items: []domain.EvidenceFact{evidenceTestFact(t, userID, at)},
|
||||
HasMore: true,
|
||||
}}
|
||||
handler := NewEvidenceHandler(stub)
|
||||
ctx := privacyHTTPContext(userID, "")
|
||||
|
||||
response, err := handler.ListMyEvidence(ctx, api.ListMyEvidenceParams{Limit: api.NewOptInt32(1)})
|
||||
if err != nil {
|
||||
t.Fatalf("ListMyEvidence() error = %v", err)
|
||||
}
|
||||
page, ok := response.(*api.EvidenceFactListHeaders)
|
||||
if !ok || page.CacheControl != api.CacheControlNoStoreNoStore || len(page.Response.Items) != 1 {
|
||||
t.Fatalf("ListMyEvidence() = %#v, want a no-store page of one fact", response)
|
||||
}
|
||||
item := page.Response.Items[0]
|
||||
if item.Trust != 1 || item.Kind != api.EvidenceKindMeasurement || item.Source.EventID != item.Source.ResultID ||
|
||||
len(item.Skills) != 2 || item.Skills[0] != api.EvidenceSkillCodeBackend || item.Result.Grade != api.GradeCodeJunior ||
|
||||
item.Visibility != api.EvidenceVisibilityVisible || !time.Time(item.OccurredAt).Equal(at) {
|
||||
t.Fatalf("fact mapping = %+v", item)
|
||||
}
|
||||
if stub.query.CandidateID != userID || stub.query.Limit != 1 || stub.query.After != nil {
|
||||
t.Fatalf("query = %+v, want the session owner and the first page", stub.query)
|
||||
}
|
||||
cursor, set := page.Response.Page.NextCursor.Get()
|
||||
if !page.Response.Page.HasMore || !set || cursor == "" {
|
||||
t.Fatalf("page info = %+v, want a next cursor", page.Response.Page)
|
||||
}
|
||||
|
||||
// The cursor continues the same owner's list at the last fact of the page.
|
||||
if _, err := handler.ListMyEvidence(ctx, api.ListMyEvidenceParams{Cursor: api.NewOptString(cursor)}); err != nil {
|
||||
t.Fatalf("ListMyEvidence(cursor) error = %v", err)
|
||||
}
|
||||
if stub.query.After == nil || stub.query.After.ID != stub.page.Items[0].Snapshot().ID || !stub.query.After.OccurredAt.Equal(at) {
|
||||
t.Fatalf("continuation = %+v, want the last fact of the previous page", stub.query.After)
|
||||
}
|
||||
|
||||
// A cursor of another candidate, a cursor of another list, and a limit out of range are validation errors.
|
||||
foreign, err := encodePrivacyCursor(uuid.New(), privacyCursorEvidence, at, uuid.New())
|
||||
if err != nil {
|
||||
t.Fatalf("encodePrivacyCursor() error = %v", err)
|
||||
}
|
||||
otherList, err := encodePrivacyCursor(userID, privacyCursorAccess, at, uuid.New())
|
||||
if err != nil {
|
||||
t.Fatalf("encodePrivacyCursor() error = %v", err)
|
||||
}
|
||||
for name, params := range map[string]api.ListMyEvidenceParams{
|
||||
"foreign cursor": {Cursor: api.NewOptString(foreign)},
|
||||
"other list": {Cursor: api.NewOptString(otherList)},
|
||||
"malformed cursor": {Cursor: api.NewOptString("not-a-cursor")},
|
||||
"limit too large": {Limit: api.NewOptInt32(outbound.MaxEvidencePageSize + 1)},
|
||||
} {
|
||||
response, err := handler.ListMyEvidence(ctx, params)
|
||||
if _, bad := response.(*api.ListMyEvidenceBadRequest); err != nil || !bad {
|
||||
t.Errorf("%s = %#v, %v, want 400", name, response, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestListMyEvidenceMapsAccessFailures(t *testing.T) {
|
||||
userID := uuid.New()
|
||||
stub := &evidenceOperationsStub{err: evidence.ErrForbidden}
|
||||
handler := NewEvidenceHandler(stub)
|
||||
response, err := handler.ListMyEvidence(privacyHTTPContext(userID, ""), api.ListMyEvidenceParams{})
|
||||
if _, forbidden := response.(*api.ListMyEvidenceForbidden); err != nil || !forbidden {
|
||||
t.Fatalf("forbidden actor = %#v, %v, want 403", response, err)
|
||||
}
|
||||
unauthenticated, err := handler.ListMyEvidence(context.Background(), api.ListMyEvidenceParams{})
|
||||
if _, ok := unauthenticated.(*api.ListMyEvidenceUnauthorized); err != nil || !ok {
|
||||
t.Fatalf("no principal = %#v, %v, want 401", unauthenticated, err)
|
||||
}
|
||||
stub.err = errors.New("storage failed")
|
||||
if _, err := handler.ListMyEvidence(privacyHTTPContext(userID, ""), api.ListMyEvidenceParams{}); err == nil {
|
||||
t.Fatal("an unexpected failure was swallowed")
|
||||
}
|
||||
}
|
||||
|
||||
func TestOrganizationEvidenceMapsOnlyTheAllowlistedShape(t *testing.T) {
|
||||
userID, organizationID := uuid.New(), uuid.New()
|
||||
handle := "cv1_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
||||
fact, err := domain.NewEvidenceOrganizationFact(domain.EvidenceOrganizationFactInput{
|
||||
Skill: "backend", Grade: domain.GradeJunior, Trust: domain.EvidenceTrustOnlineUnconfirmed,
|
||||
Basis: domain.AssessmentCategorySourceSyntheticDemo, CalibrationStatus: domain.AssessmentCategoryCalibrationUncalibrated, ObservedYear: 2026,
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("NewEvidenceOrganizationFact() error = %v", err)
|
||||
}
|
||||
stub := &evidenceOperationsStub{facts: []domain.EvidenceOrganizationFact{fact}}
|
||||
handler := NewEvidenceHandler(stub)
|
||||
ctx := privacyHTTPContext(userID, "")
|
||||
params := api.GetOrganizationCandidateEvidenceParams{OrgID: organizationID, CandidateHandle: api.CandidateHandle(handle)}
|
||||
|
||||
response, err := handler.GetOrganizationCandidateEvidence(ctx, params)
|
||||
if err != nil {
|
||||
t.Fatalf("GetOrganizationCandidateEvidence() error = %v", err)
|
||||
}
|
||||
body, ok := response.(*api.OrganizationEvidenceHeaders)
|
||||
if !ok || body.CacheControl != api.CacheControlNoStoreNoStore || len(body.Response.Items) != 1 {
|
||||
t.Fatalf("response = %#v, want a no-store projection of one fact", response)
|
||||
}
|
||||
if stub.actorID != userID || stub.orgID != organizationID || stub.handle != handle {
|
||||
t.Fatalf("scope = actor %s organization %s handle %q", stub.actorID, stub.orgID, stub.handle)
|
||||
}
|
||||
encoded, err := json.Marshal(body.Response)
|
||||
if err != nil {
|
||||
t.Fatalf("encode projection: %v", err)
|
||||
}
|
||||
if want := `{"items":[{"skill":"backend","grade":"junior","trust":1,"basis":"synthetic_demo","calibration_status":"uncalibrated","observed_year":2026}]}`; string(encoded) != want {
|
||||
t.Fatalf("projection = %s, want %s", encoded, want)
|
||||
}
|
||||
for _, private := range []string{userID.String(), "event_id", "result_id", "occurred_at", "observed_month", "answer", "score", "visibility"} {
|
||||
if strings.Contains(string(encoded), private) {
|
||||
t.Fatalf("organization projection exposes %q: %s", private, encoded)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestOrganizationEvidenceMapsCardFailuresWithoutDistinction(t *testing.T) {
|
||||
userID, organizationID := uuid.New(), uuid.New()
|
||||
handle := api.CandidateHandle("cv1_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
|
||||
stub := &evidenceOperationsStub{}
|
||||
handler := NewEvidenceHandler(stub)
|
||||
ctx := privacyHTTPContext(userID, "")
|
||||
params := api.GetOrganizationCandidateEvidenceParams{OrgID: organizationID, CandidateHandle: handle}
|
||||
|
||||
for name, test := range map[string]struct {
|
||||
err error
|
||||
want string
|
||||
}{
|
||||
"candidate account": {candidateview.ErrForbidden, "forbidden"},
|
||||
"hidden or unpublished": {candidateview.ErrCandidateCardNotFound, "not_found"},
|
||||
"no membership": {outbound.ErrOrganizationNotFound, "not_found"},
|
||||
"bad handle": {candidateview.ErrInvalidCandidateHandle, "bad_request"},
|
||||
"quota": {&candidateview.RateLimitedError{RetryAt: time.Now().Add(time.Minute)}, "too_many"},
|
||||
} {
|
||||
stub.err = test.err
|
||||
response, err := handler.GetOrganizationCandidateEvidence(ctx, params)
|
||||
if err != nil {
|
||||
t.Errorf("%s: error = %v", name, err)
|
||||
continue
|
||||
}
|
||||
var got string
|
||||
switch response.(type) {
|
||||
case *api.GetOrganizationCandidateEvidenceForbidden:
|
||||
got = "forbidden"
|
||||
case *api.GetOrganizationCandidateEvidenceNotFound:
|
||||
got = "not_found"
|
||||
case *api.GetOrganizationCandidateEvidenceBadRequest:
|
||||
got = "bad_request"
|
||||
case *api.TooManyRequestsHeaders:
|
||||
got = "too_many"
|
||||
}
|
||||
if got != test.want {
|
||||
t.Errorf("%s = %T, want %s", name, response, test.want)
|
||||
}
|
||||
}
|
||||
stub.err = errors.New("storage failed")
|
||||
if _, err := handler.GetOrganizationCandidateEvidence(ctx, params); err == nil {
|
||||
t.Fatal("an unexpected failure was swallowed")
|
||||
}
|
||||
}
|
||||
@@ -25,6 +25,9 @@ const (
|
||||
privacyCursorEvents = 1
|
||||
privacyCursorHidden = 2
|
||||
privacyCursorAccess = 3
|
||||
// privacyCursorEvidence belongs to the skill evidence list, which shares the
|
||||
// owner-bound cursor of the privacy lists.
|
||||
privacyCursorEvidence = 4
|
||||
)
|
||||
|
||||
// CandidateViewOperations serves private previews, owner access history, and
|
||||
@@ -434,7 +437,7 @@ func privacyPageParams(limit api.OptInt32, cursor api.OptString, owner uuid.UUID
|
||||
func encodePrivacyCursor(owner uuid.UUID, kind byte, at time.Time, id uuid.UUID) (string, error) {
|
||||
at = at.UTC()
|
||||
seconds, nanos := at.Unix(), at.Nanosecond()
|
||||
if owner == uuid.Nil || id == uuid.Nil || kind < privacyCursorEvents || kind > privacyCursorAccess || at.IsZero() ||
|
||||
if owner == uuid.Nil || id == uuid.Nil || kind < privacyCursorEvents || kind > privacyCursorEvidence || at.IsZero() ||
|
||||
at.Year() < 1 || at.Year() > 9999 || nanos < 0 || nanos >= 1_000_000_000 || nanos%1_000 != 0 {
|
||||
return "", errors.New("privacy cursor requires an owner and valid page position")
|
||||
}
|
||||
@@ -518,7 +521,13 @@ func cardPreviewResponse(preview candidateview.PreviewResult) api.CardPreview {
|
||||
} else {
|
||||
card.SetTo(anonymousCardResponse(*preview.Card))
|
||||
}
|
||||
return api.CardPreview{State: state, Fields: fields, Card: card, GeneratedAt: api.Timestamp(preview.GeneratedAt)}
|
||||
evidence := api.NilOrganizationEvidence{}
|
||||
if preview.Card == nil {
|
||||
evidence.SetToNull()
|
||||
} else {
|
||||
evidence.SetTo(organizationEvidenceResponse(preview.Evidence))
|
||||
}
|
||||
return api.CardPreview{State: state, Fields: fields, Card: card, Evidence: evidence, GeneratedAt: api.Timestamp(preview.GeneratedAt)}
|
||||
}
|
||||
|
||||
func anonymousCardResponse(view domain.AnonymousCandidateViewDTO) api.AnonymousCardContent {
|
||||
|
||||
@@ -0,0 +1,189 @@
|
||||
package postgres
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/google/uuid"
|
||||
|
||||
"lincodex/backend/internal/adapter/secondary/postgres/sqlc"
|
||||
"lincodex/backend/internal/domain"
|
||||
"lincodex/backend/internal/port/outbound"
|
||||
)
|
||||
|
||||
var _ outbound.EvidenceRepository = evidenceRepository{}
|
||||
|
||||
func (unit *UnitOfWork) Evidence() outbound.EvidenceRepository {
|
||||
return evidenceRepository{queries: unit.queries}
|
||||
}
|
||||
|
||||
type evidenceRepository struct {
|
||||
queries *sqlc.Queries
|
||||
}
|
||||
|
||||
func (repository evidenceRepository) ListCandidateFacts(
|
||||
ctx context.Context,
|
||||
query outbound.EvidenceListQuery,
|
||||
) (outbound.EvidenceFactPage, error) {
|
||||
const location = "evidenceRepository.ListCandidateFacts"
|
||||
if query.CandidateID == uuid.Nil || query.Limit < 1 || query.Limit > outbound.MaxEvidencePageSize {
|
||||
return outbound.EvidenceFactPage{}, fmt.Errorf("%s - query is invalid: %w", location, domain.ErrInvalidEvidence)
|
||||
}
|
||||
// The statement fetches one extra row to learn whether another page follows.
|
||||
params := sqlc.ListCandidateEvidenceFactsParams{CandidateID: pgUUID(query.CandidateID), RowLimit: query.Limit + 1}
|
||||
if query.After != nil {
|
||||
if query.After.ID == uuid.Nil || query.After.OccurredAt.IsZero() {
|
||||
return outbound.EvidenceFactPage{}, fmt.Errorf("%s - continuation position is invalid: %w", location, domain.ErrInvalidEvidence)
|
||||
}
|
||||
params.AfterOccurredAt = pgTime(query.After.OccurredAt)
|
||||
params.AfterID = pgUUID(query.After.ID)
|
||||
}
|
||||
rows, err := repository.queries.ListCandidateEvidenceFacts(ctx, params)
|
||||
if err != nil {
|
||||
return outbound.EvidenceFactPage{}, fmt.Errorf("%s - select facts: %w", location, markTransactionConflict(sanitizeConnectError(err)))
|
||||
}
|
||||
page := outbound.EvidenceFactPage{Items: make([]domain.EvidenceFact, 0, min(len(rows), int(query.Limit)))}
|
||||
if len(rows) > int(query.Limit) {
|
||||
page.HasMore = true
|
||||
rows = rows[:query.Limit]
|
||||
}
|
||||
for _, row := range rows {
|
||||
fact, err := restoreEvidenceFactRow(query.CandidateID, row)
|
||||
if err != nil {
|
||||
return outbound.EvidenceFactPage{}, fmt.Errorf("%s - restore fact: %w", location, err)
|
||||
}
|
||||
page.Items = append(page.Items, fact)
|
||||
}
|
||||
return page, nil
|
||||
}
|
||||
|
||||
func restoreEvidenceFactRow(candidateID uuid.UUID, row sqlc.ListCandidateEvidenceFactsRow) (domain.EvidenceFact, error) {
|
||||
const location = "restoreEvidenceFactRow"
|
||||
skills := make([]domain.EvidenceSkillCode, 0, len(row.Skills))
|
||||
for _, code := range row.Skills {
|
||||
skills = append(skills, domain.EvidenceSkillCode(code))
|
||||
}
|
||||
trust, err := evidenceTrust(row.Trust)
|
||||
if err != nil {
|
||||
return domain.EvidenceFact{}, fmt.Errorf("%s - %w", location, err)
|
||||
}
|
||||
fact, err := domain.RestoreEvidenceFact(domain.EvidenceFactSnapshot{
|
||||
ID: optionalUUID(row.ID), CandidateID: candidateID, Kind: domain.EvidenceKind(row.Kind),
|
||||
SourceType: domain.EvidenceSourceType(row.SourceType), EventID: optionalUUID(row.EventID),
|
||||
ResultID: optionalUUID(row.ResultID), Skills: skills,
|
||||
Result: domain.EvidenceResult{
|
||||
Grade: domain.GradeCode(row.Grade), Basis: domain.AssessmentCategorySource(row.Basis),
|
||||
CalibrationStatus: domain.AssessmentCategoryCalibrationStatus(row.CalibrationStatus),
|
||||
},
|
||||
Attribution: domain.EvidenceAttribution(row.Attribution), Trust: trust,
|
||||
OccurredAt: timeValueOrZero(row.OccurredAt), Visibility: domain.EvidenceVisibility(row.Visibility),
|
||||
})
|
||||
if err != nil {
|
||||
return domain.EvidenceFact{}, fmt.Errorf("%s - stored fact is invalid: %w", location, err)
|
||||
}
|
||||
return fact, nil
|
||||
}
|
||||
|
||||
func (repository evidenceRepository) ListOrganizationFacts(
|
||||
ctx context.Context,
|
||||
organizationID, candidateID uuid.UUID,
|
||||
categories []domain.CandidateViewCategory,
|
||||
) ([]domain.EvidenceOrganizationFact, error) {
|
||||
const location = "evidenceRepository.ListOrganizationFacts"
|
||||
if organizationID == uuid.Nil || candidateID == uuid.Nil {
|
||||
return nil, fmt.Errorf("%s - identifiers must be set: %w", location, domain.ErrInvalidEvidence)
|
||||
}
|
||||
pairs, err := evidenceCategoryPairs(categories)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("%s - %w", location, err)
|
||||
}
|
||||
if len(pairs) == 0 {
|
||||
return []domain.EvidenceOrganizationFact{}, nil
|
||||
}
|
||||
rows, err := repository.queries.ListOrganizationVisibleEvidence(ctx, sqlc.ListOrganizationVisibleEvidenceParams{
|
||||
Categories: pairs, CandidateID: pgUUID(candidateID), OrganizationID: pgUUID(organizationID),
|
||||
})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("%s - select permitted facts: %w", location, markTransactionConflict(sanitizeConnectError(err)))
|
||||
}
|
||||
facts := make([]domain.EvidenceOrganizationFact, 0, len(rows))
|
||||
for _, row := range rows {
|
||||
fact, err := restoreEvidenceOrganizationFact(row.Skill, row.Grade, row.Trust, row.Basis, row.CalibrationStatus, row.ObservedYear)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("%s - %w", location, err)
|
||||
}
|
||||
facts = append(facts, fact)
|
||||
}
|
||||
return facts, nil
|
||||
}
|
||||
|
||||
func (repository evidenceRepository) ListPreviewFacts(
|
||||
ctx context.Context,
|
||||
candidateID uuid.UUID,
|
||||
categories []domain.CandidateViewCategory,
|
||||
) ([]domain.EvidenceOrganizationFact, error) {
|
||||
const location = "evidenceRepository.ListPreviewFacts"
|
||||
if candidateID == uuid.Nil {
|
||||
return nil, fmt.Errorf("%s - candidate ID must be set: %w", location, domain.ErrInvalidEvidence)
|
||||
}
|
||||
pairs, err := evidenceCategoryPairs(categories)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("%s - %w", location, err)
|
||||
}
|
||||
if len(pairs) == 0 {
|
||||
return []domain.EvidenceOrganizationFact{}, nil
|
||||
}
|
||||
rows, err := repository.queries.ListCandidatePreviewEvidence(ctx, sqlc.ListCandidatePreviewEvidenceParams{
|
||||
Categories: pairs, CandidateID: pgUUID(candidateID),
|
||||
})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("%s - select preview facts: %w", location, markTransactionConflict(sanitizeConnectError(err)))
|
||||
}
|
||||
facts := make([]domain.EvidenceOrganizationFact, 0, len(rows))
|
||||
for _, row := range rows {
|
||||
fact, err := restoreEvidenceOrganizationFact(row.Skill, row.Grade, row.Trust, row.Basis, row.CalibrationStatus, row.ObservedYear)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("%s - %w", location, err)
|
||||
}
|
||||
facts = append(facts, fact)
|
||||
}
|
||||
return facts, nil
|
||||
}
|
||||
|
||||
// evidenceCategoryPairs renders the categories of a card as the
|
||||
// "specialization/grade" keys that the statements match against a fact.
|
||||
func evidenceCategoryPairs(categories []domain.CandidateViewCategory) ([]string, error) {
|
||||
pairs := make([]string, 0, len(categories))
|
||||
for _, category := range categories {
|
||||
if !category.Specialization.IsKnown() || !category.Grade.IsKnown() {
|
||||
return nil, fmt.Errorf("category is not known: %w", domain.ErrInvalidEvidence)
|
||||
}
|
||||
pairs = append(pairs, string(domain.EvidenceSkillOfSpecialization(category.Specialization))+"/"+string(category.Grade))
|
||||
}
|
||||
return pairs, nil
|
||||
}
|
||||
|
||||
func restoreEvidenceOrganizationFact(skill, grade string, trust int16, basis, calibration string, year int32) (domain.EvidenceOrganizationFact, error) {
|
||||
level, err := evidenceTrust(trust)
|
||||
if err != nil {
|
||||
return domain.EvidenceOrganizationFact{}, err
|
||||
}
|
||||
fact, err := domain.NewEvidenceOrganizationFact(domain.EvidenceOrganizationFactInput{
|
||||
Skill: domain.EvidenceSkillCode(skill), Grade: domain.GradeCode(grade), Trust: level,
|
||||
Basis: domain.AssessmentCategorySource(basis), CalibrationStatus: domain.AssessmentCategoryCalibrationStatus(calibration),
|
||||
ObservedYear: year,
|
||||
})
|
||||
if err != nil {
|
||||
return domain.EvidenceOrganizationFact{}, fmt.Errorf("restore permitted fact: %w", err)
|
||||
}
|
||||
return fact, nil
|
||||
}
|
||||
|
||||
// evidenceTrust narrows the stored smallint after checking the range that the
|
||||
// table constraint already guarantees.
|
||||
func evidenceTrust(value int16) (domain.EvidenceTrust, error) {
|
||||
if value < int16(domain.EvidenceTrustStated) || value > int16(domain.EvidenceTrustInPerson) {
|
||||
return 0, fmt.Errorf("stored trust level is out of range: %w", domain.ErrInvalidEvidence)
|
||||
}
|
||||
return domain.EvidenceTrust(value), nil
|
||||
}
|
||||
@@ -0,0 +1,266 @@
|
||||
// Code generated by sqlc. DO NOT EDIT.
|
||||
// versions:
|
||||
// sqlc v1.31.1
|
||||
// source: evidence.sql
|
||||
|
||||
package sqlc
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/jackc/pgx/v5/pgtype"
|
||||
)
|
||||
|
||||
const listCandidateEvidenceFacts = `-- name: ListCandidateEvidenceFacts :many
|
||||
|
||||
SELECT
|
||||
fact.id,
|
||||
fact.kind,
|
||||
fact.source_type,
|
||||
fact.event_id,
|
||||
fact.result_id,
|
||||
fact.attribution,
|
||||
fact.trust,
|
||||
fact.grade,
|
||||
fact.basis,
|
||||
fact.calibration_status,
|
||||
fact.occurred_at,
|
||||
fact.visibility,
|
||||
COALESCE(
|
||||
(
|
||||
SELECT array_agg(skill.skill_code ORDER BY skill.skill_code)
|
||||
FROM skill_evidence_skills AS skill
|
||||
WHERE skill.fact_id = fact.id
|
||||
),
|
||||
'{}'::text []
|
||||
)::text [] AS skills
|
||||
FROM skill_evidence_facts AS fact
|
||||
WHERE
|
||||
fact.candidate_id = $1
|
||||
AND (
|
||||
$2::timestamptz IS NULL
|
||||
OR (fact.occurred_at, fact.id) < (
|
||||
$2::timestamptz,
|
||||
$3::uuid
|
||||
)
|
||||
)
|
||||
ORDER BY fact.occurred_at DESC, fact.id DESC
|
||||
LIMIT $4
|
||||
`
|
||||
|
||||
type ListCandidateEvidenceFactsParams struct {
|
||||
CandidateID pgtype.UUID
|
||||
AfterOccurredAt pgtype.Timestamptz
|
||||
AfterID pgtype.UUID
|
||||
RowLimit int32
|
||||
}
|
||||
|
||||
type ListCandidateEvidenceFactsRow struct {
|
||||
ID pgtype.UUID
|
||||
Kind string
|
||||
SourceType string
|
||||
EventID pgtype.UUID
|
||||
ResultID pgtype.UUID
|
||||
Attribution string
|
||||
Trust int16
|
||||
Grade string
|
||||
Basis string
|
||||
CalibrationStatus string
|
||||
OccurredAt pgtype.Timestamptz
|
||||
Visibility string
|
||||
Skills []string
|
||||
}
|
||||
|
||||
// Skill evidence reads. The projection tables hold no answer, score, item,
|
||||
// failure, or anti-cheat data, and none of these statements names the result,
|
||||
// attempt, or review tables: evidence is read from its own facts only.
|
||||
// The candidate's own facts, hidden ones included, newest event first. Every
|
||||
// statement is scoped by the owner; the caller passes the continuation
|
||||
// position of the previous page, if any, and fetches one extra row.
|
||||
func (q *Queries) ListCandidateEvidenceFacts(ctx context.Context, arg ListCandidateEvidenceFactsParams) ([]ListCandidateEvidenceFactsRow, error) {
|
||||
rows, err := q.db.Query(ctx, listCandidateEvidenceFacts,
|
||||
arg.CandidateID,
|
||||
arg.AfterOccurredAt,
|
||||
arg.AfterID,
|
||||
arg.RowLimit,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
var items []ListCandidateEvidenceFactsRow
|
||||
for rows.Next() {
|
||||
var i ListCandidateEvidenceFactsRow
|
||||
if err := rows.Scan(
|
||||
&i.ID,
|
||||
&i.Kind,
|
||||
&i.SourceType,
|
||||
&i.EventID,
|
||||
&i.ResultID,
|
||||
&i.Attribution,
|
||||
&i.Trust,
|
||||
&i.Grade,
|
||||
&i.Basis,
|
||||
&i.CalibrationStatus,
|
||||
&i.OccurredAt,
|
||||
&i.Visibility,
|
||||
&i.Skills,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
items = append(items, i)
|
||||
}
|
||||
if err := rows.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return items, nil
|
||||
}
|
||||
|
||||
const listCandidatePreviewEvidence = `-- name: ListCandidatePreviewEvidence :many
|
||||
SELECT DISTINCT ON (skill.skill_code)
|
||||
skill.skill_code AS skill,
|
||||
fact.grade,
|
||||
fact.trust,
|
||||
fact.basis,
|
||||
fact.calibration_status,
|
||||
extract(YEAR FROM fact.occurred_at AT TIME ZONE 'UTC')::integer AS observed_year
|
||||
FROM skill_evidence_facts AS fact
|
||||
INNER JOIN skill_evidence_skills AS skill
|
||||
ON fact.id = skill.fact_id
|
||||
WHERE
|
||||
fact.candidate_id = $1
|
||||
AND (skill.skill_code || '/' || fact.grade) = any($2::text [])
|
||||
AND fact.kind = 'measurement'
|
||||
AND fact.visibility = 'visible'
|
||||
ORDER BY skill.skill_code, fact.occurred_at, fact.id
|
||||
`
|
||||
|
||||
type ListCandidatePreviewEvidenceParams struct {
|
||||
CandidateID pgtype.UUID
|
||||
Categories []string
|
||||
}
|
||||
|
||||
type ListCandidatePreviewEvidenceRow struct {
|
||||
Skill string
|
||||
Grade string
|
||||
Trust int16
|
||||
Basis string
|
||||
CalibrationStatus string
|
||||
ObservedYear int32
|
||||
}
|
||||
|
||||
// The same selection for the candidate's own card preview, so the candidate
|
||||
// sees what an organization would read. It is scoped by the owner and runs
|
||||
// after the caller locked the effective C2 and publication; it does not apply
|
||||
// an organization or a cohort.
|
||||
func (q *Queries) ListCandidatePreviewEvidence(ctx context.Context, arg ListCandidatePreviewEvidenceParams) ([]ListCandidatePreviewEvidenceRow, error) {
|
||||
rows, err := q.db.Query(ctx, listCandidatePreviewEvidence, arg.CandidateID, arg.Categories)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
var items []ListCandidatePreviewEvidenceRow
|
||||
for rows.Next() {
|
||||
var i ListCandidatePreviewEvidenceRow
|
||||
if err := rows.Scan(
|
||||
&i.Skill,
|
||||
&i.Grade,
|
||||
&i.Trust,
|
||||
&i.Basis,
|
||||
&i.CalibrationStatus,
|
||||
&i.ObservedYear,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
items = append(items, i)
|
||||
}
|
||||
if err := rows.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return items, nil
|
||||
}
|
||||
|
||||
const listOrganizationVisibleEvidence = `-- name: ListOrganizationVisibleEvidence :many
|
||||
SELECT DISTINCT ON (skill.skill_code)
|
||||
skill.skill_code AS skill,
|
||||
fact.grade,
|
||||
fact.trust,
|
||||
fact.basis,
|
||||
fact.calibration_status,
|
||||
extract(YEAR FROM fact.occurred_at AT TIME ZONE 'UTC')::integer AS observed_year
|
||||
FROM candidate_effective_publications AS effective
|
||||
INNER JOIN skill_evidence_facts AS fact
|
||||
ON effective.user_id = fact.candidate_id
|
||||
INNER JOIN skill_evidence_skills AS skill
|
||||
ON fact.id = skill.fact_id
|
||||
WHERE
|
||||
effective.user_id = $1
|
||||
AND 'categories' = any(effective.fields)
|
||||
AND (skill.skill_code || '/' || fact.grade) = any($2::text [])
|
||||
AND fact.kind = 'measurement'
|
||||
AND fact.visibility = 'visible'
|
||||
AND NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM candidate_hidden_organizations AS hidden
|
||||
WHERE
|
||||
hidden.user_id = effective.user_id
|
||||
AND hidden.organization_id = $3
|
||||
)
|
||||
ORDER BY skill.skill_code, fact.occurred_at, fact.id
|
||||
`
|
||||
|
||||
type ListOrganizationVisibleEvidenceParams struct {
|
||||
CandidateID pgtype.UUID
|
||||
Categories []string
|
||||
OrganizationID pgtype.UUID
|
||||
}
|
||||
|
||||
type ListOrganizationVisibleEvidenceRow struct {
|
||||
Skill string
|
||||
Grade string
|
||||
Trust int16
|
||||
Basis string
|
||||
CalibrationStatus string
|
||||
ObservedYear int32
|
||||
}
|
||||
|
||||
// The evidence that one organization may read about one candidate: one fact
|
||||
// for each category of the card, the fact that supports the confirmed grade
|
||||
// of that category (the earliest one that passed exactly that grade, so a
|
||||
// lower grade or a retake adds nothing). The statement selects from the
|
||||
// effective publication view (published and backed by an unrevoked C2) and
|
||||
// excludes the candidates that hide the reading organization, so no row means
|
||||
// nothing to read, whatever the reason. The card must publish the categories
|
||||
// field and only visible measurements qualify. The categories come from the
|
||||
// caller as "specialization/grade" pairs taken from the card that was just
|
||||
// projected, so the answer never names a skill the card does not show. The columns are
|
||||
// an allowlist: no identifier of the fact, the event, the result, or the
|
||||
// candidate leaves, the instant is cut to the year, and the basis and the
|
||||
// calibration (the same for every candidate) say that the fact is a synthetic
|
||||
// demonstration.
|
||||
func (q *Queries) ListOrganizationVisibleEvidence(ctx context.Context, arg ListOrganizationVisibleEvidenceParams) ([]ListOrganizationVisibleEvidenceRow, error) {
|
||||
rows, err := q.db.Query(ctx, listOrganizationVisibleEvidence, arg.CandidateID, arg.Categories, arg.OrganizationID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
var items []ListOrganizationVisibleEvidenceRow
|
||||
for rows.Next() {
|
||||
var i ListOrganizationVisibleEvidenceRow
|
||||
if err := rows.Scan(
|
||||
&i.Skill,
|
||||
&i.Grade,
|
||||
&i.Trust,
|
||||
&i.Basis,
|
||||
&i.CalibrationStatus,
|
||||
&i.ObservedYear,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
items = append(items, i)
|
||||
}
|
||||
if err := rows.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return items, nil
|
||||
}
|
||||
@@ -729,6 +729,29 @@ type Session struct {
|
||||
RevokedAt pgtype.Timestamptz
|
||||
}
|
||||
|
||||
type SkillEvidenceFact struct {
|
||||
ID pgtype.UUID
|
||||
CandidateID pgtype.UUID
|
||||
Kind string
|
||||
SourceType string
|
||||
EventID pgtype.UUID
|
||||
ResultID pgtype.UUID
|
||||
Attribution string
|
||||
Trust int16
|
||||
Grade string
|
||||
Basis string
|
||||
CalibrationStatus string
|
||||
OccurredAt pgtype.Timestamptz
|
||||
Visibility string
|
||||
RecordedAt pgtype.Timestamptz
|
||||
CreatedTxid int64
|
||||
}
|
||||
|
||||
type SkillEvidenceSkill struct {
|
||||
FactID pgtype.UUID
|
||||
SkillCode string
|
||||
}
|
||||
|
||||
type SupportCase struct {
|
||||
ID pgtype.UUID
|
||||
CaseNumber string
|
||||
|
||||
@@ -550,11 +550,23 @@ type Querier interface {
|
||||
// read adapter resolves an organization name only through this recorded
|
||||
// access relation, which is already visible to the candidate.
|
||||
ListCandidateCardAccessEvents(ctx context.Context, arg ListCandidateCardAccessEventsParams) ([]ListCandidateCardAccessEventsRow, error)
|
||||
// Skill evidence reads. The projection tables hold no answer, score, item,
|
||||
// failure, or anti-cheat data, and none of these statements names the result,
|
||||
// attempt, or review tables: evidence is read from its own facts only.
|
||||
// The candidate's own facts, hidden ones included, newest event first. Every
|
||||
// statement is scoped by the owner; the caller passes the continuation
|
||||
// position of the previous page, if any, and fetches one extra row.
|
||||
ListCandidateEvidenceFacts(ctx context.Context, arg ListCandidateEvidenceFactsParams) ([]ListCandidateEvidenceFactsRow, error)
|
||||
// One page of the candidate's hidden organizations, newest first with the
|
||||
// organization identifier as the tie-breaker. The page continues after the
|
||||
// (hidden_at, organization_id) position of the last record of the previous
|
||||
// page.
|
||||
ListCandidateHiddenOrganizations(ctx context.Context, arg ListCandidateHiddenOrganizationsParams) ([]ListCandidateHiddenOrganizationsRow, error)
|
||||
// The same selection for the candidate's own card preview, so the candidate
|
||||
// sees what an organization would read. It is scoped by the owner and runs
|
||||
// after the caller locked the effective C2 and publication; it does not apply
|
||||
// an organization or a cohort.
|
||||
ListCandidatePreviewEvidence(ctx context.Context, arg ListCandidatePreviewEvidenceParams) ([]ListCandidatePreviewEvidenceRow, error)
|
||||
// One page of the candidate's settings history, newest first with the event
|
||||
// identifier as the tie-breaker. The organization name is resolved here, at
|
||||
// read time, and is the current name. The page continues after the
|
||||
@@ -588,6 +600,21 @@ type Querier interface {
|
||||
// Read one bounded newest-first page of current needs. Both the organization
|
||||
// scope and the tuple cursor are applied before the limit.
|
||||
ListOrganizationNeeds(ctx context.Context, arg ListOrganizationNeedsParams) ([]ListOrganizationNeedsRow, error)
|
||||
// The evidence that one organization may read about one candidate: one fact
|
||||
// for each category of the card, the fact that supports the confirmed grade
|
||||
// of that category (the earliest one that passed exactly that grade, so a
|
||||
// lower grade or a retake adds nothing). The statement selects from the
|
||||
// effective publication view (published and backed by an unrevoked C2) and
|
||||
// excludes the candidates that hide the reading organization, so no row means
|
||||
// nothing to read, whatever the reason. The card must publish the categories
|
||||
// field and only visible measurements qualify. The categories come from the
|
||||
// caller as "specialization/grade" pairs taken from the card that was just
|
||||
// projected, so the answer never names a skill the card does not show. The columns are
|
||||
// an allowlist: no identifier of the fact, the event, the result, or the
|
||||
// candidate leaves, the instant is cut to the year, and the basis and the
|
||||
// calibration (the same for every candidate) say that the fact is a synthetic
|
||||
// demonstration.
|
||||
ListOrganizationVisibleEvidence(ctx context.Context, arg ListOrganizationVisibleEvidenceParams) ([]ListOrganizationVisibleEvidenceRow, error)
|
||||
// Lists the organizations where an account has an active membership,
|
||||
// newest membership first. The page continues after the (membership
|
||||
// creation time, organization ID) position of the last item of the
|
||||
|
||||
Reference in new issue
Block a user