feat(profile): persist candidate edits and enforce company access
This commit is contained in:
1 parent
3ab6bd91a3
commit
73c7caa225
67 files changed
+5286
-229
No files matched your search
@@ -4903,6 +4903,10 @@ func (s *Server) handleGetMyPrivacySettingsRequest(args [0]string, argsEscaped b
|
||||
// establish and which no request writes. The profile needs no file, no ML extraction, and no FSP
|
||||
// account.
|
||||
//
|
||||
// `experience_overlaps` lists every pair of entries whose inclusive month ranges overlap. Its indices
|
||||
// refer to this response's `experience` array and are scoped to the same `version`; each pair is
|
||||
// either `needs_confirmation` or `confirmed`.
|
||||
//
|
||||
// A missing, unknown, expired, or revoked session answers 401 unauthenticated; an employer account
|
||||
// answers 403 forbidden.
|
||||
//
|
||||
@@ -5497,9 +5501,9 @@ func (s *Server) handleGetMySupportCaseRequest(args [1]string, argsEscaped bool,
|
||||
|
||||
// handleGetOrganizationRequest handles GetOrganization operation.
|
||||
//
|
||||
// Requires the session cookie of an employer account with an active membership in `org_id`. The
|
||||
// organization comes from the path and is checked against the membership that the server holds for the
|
||||
// session account on every request; the identifier itself grants nothing.
|
||||
// Requires the session cookie of a verified employer account with an active owner membership in
|
||||
// `org_id`. The organization comes from the path and is checked against the membership that the server
|
||||
// holds for the session account on every request; the identifier itself grants nothing.
|
||||
//
|
||||
// Returns the profile with its current `version`, the verification level (`verification`), and the
|
||||
// card as a candidate sees it (`candidate_card`). The verification level is always the one the server
|
||||
@@ -5507,15 +5511,11 @@ func (s *Server) handleGetMySupportCaseRequest(args [1]string, argsEscaped bool,
|
||||
// because of an email domain. The role of the caller is not part of this resource; ListMyOrganizations
|
||||
// returns it with the membership.
|
||||
//
|
||||
// In the MVP the profile is readable by any active member; every member is an owner, because the
|
||||
// operations that add members are planned. The roles of PRD FR07 that read a company card without
|
||||
// managing it change no field of this contract.
|
||||
//
|
||||
// Access: a missing, unknown, expired, or revoked session answers 401 unauthenticated; a candidate
|
||||
// account answers 403 forbidden; an account without an active membership in the organization,
|
||||
// including a `suspended`, `removed`, or `left` one, and an unknown organization all answer 404
|
||||
// not_found, so organizations cannot be enumerated. A malformed `org_id` answers 400 validation_failed
|
||||
// with the path pointer.
|
||||
// not_found, so organizations cannot be enumerated. An active member whose role is not `owner` answers
|
||||
// 403 forbidden. A malformed `org_id` answers 400 validation_failed with the path pointer.
|
||||
//
|
||||
// GET /api/v1/organizations/{org_id}
|
||||
func (s *Server) handleGetOrganizationRequest(args [1]string, argsEscaped bool, w http.ResponseWriter, r *http.Request) {
|
||||
@@ -5653,7 +5653,7 @@ func (s *Server) handleGetOrganizationRequest(args [1]string, argsEscaped bool,
|
||||
mreq := middleware.Request{
|
||||
Context: ctx,
|
||||
OperationName: GetOrganizationOperation,
|
||||
OperationSummary: "Read an organization of which the caller is a member.",
|
||||
OperationSummary: "Read an organization managed by the caller.",
|
||||
OperationID: "GetOrganization",
|
||||
Body: nil,
|
||||
RawBody: rawBody,
|
||||
@@ -10710,9 +10710,9 @@ func (s *Server) handleRevokeMyOrganizationContactConsentRequest(args [1]string,
|
||||
//
|
||||
// Every field is optional in substance: a profile can be saved with any subset filled and the rest
|
||||
// null or empty, so no value requires a resume, the ML service, an FSP account, or any other file or
|
||||
// link. Which fields are needed to leave the onboarding step candidate_profile is an open product
|
||||
// question that this contract does not decide; a save on that step advancing the account to
|
||||
// candidate_questionnaire is planned.
|
||||
// link. A successful save advances an account whose current onboarding step is candidate_profile to
|
||||
// candidate_questionnaire, including a no-op save; it never moves a later step backwards. This update
|
||||
// is atomic with the profile and its history.
|
||||
//
|
||||
// Provenance is the server's: a value typed in the form is `manual`, confirming a stored suggestion
|
||||
// keeps its origin, and every claim keeps trust level 0. The body has no origin, trust level,
|
||||
@@ -10737,6 +10737,17 @@ func (s *Server) handleRevokeMyOrganizationContactConsentRequest(args [1]string,
|
||||
// therefore sends every suggestion that it received, and a client that read an older version gets 412
|
||||
// instead of silently dropping a suggestion it never saw.
|
||||
//
|
||||
// Experience periods use inclusive calendar months. An overlap is allowed only when
|
||||
// `confirmed_parallel_periods` explicitly acknowledges that the two date ranges are genuine parallel
|
||||
// work. Each acknowledgement names two distinct experience indices and repeats their exact normalized
|
||||
// `started_on` and `ended_on` values; both indices and periods must match the submitted array and
|
||||
// `expected_version`. A new or changed period needs an acknowledgement in that PUT. The server carries
|
||||
// an earlier acknowledgement only when the same two indices still contain the same dates; reordering
|
||||
// or changing either date requires a new acknowledgement. Editing other experience fields does not
|
||||
// invalidate a matching date-pair acknowledgement. A missing acknowledgement answers 400 with pointers
|
||||
// to the period fields and changes nothing. Duplicate, out-of-range, self, and non-overlapping
|
||||
// acknowledgements are invalid.
|
||||
//
|
||||
// Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400),
|
||||
// account scenario (403 forbidden for an employer), a version above the current one (412), domain
|
||||
// rules that depend on the body alone (400), then the rules that depend on the stored claims against
|
||||
@@ -10747,9 +10758,9 @@ func (s *Server) handleRevokeMyOrganizationContactConsentRequest(args [1]string,
|
||||
// without the leading @, an email that is not an address, a month outside `YYYY-MM`, a salary that is
|
||||
// not a positive multiple of 1000, and more items than a list allows. The server also rejects a
|
||||
// repeated tag, skill, or role specialization, a period that ends before it starts or lies in the
|
||||
// future, and a decision `extracted` for a value that is not a stored suggestion, with 400
|
||||
// validation_failed and pointers to the items, for example `/roles/1/specialization` or
|
||||
// `/stack/1/status`. Error bodies never repeat a submitted value.
|
||||
// future, a changed overlap without explicit confirmation, and a decision `extracted` for a value that
|
||||
// is not a stored suggestion, with 400 validation_failed and pointers to the items, for example
|
||||
// `/roles/1/specialization` or `/stack/1/status`. Error bodies never repeat a submitted value.
|
||||
//
|
||||
// PUT /api/v1/me/profile
|
||||
func (s *Server) handleSaveMyProfileRequest(args [0]string, argsEscaped bool, w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
@@ -9819,6 +9819,14 @@ func (s *CandidateProfile) encodeFields(e *jx.Encoder) {
|
||||
}
|
||||
e.ArrEnd()
|
||||
}
|
||||
{
|
||||
e.FieldStart("experience_overlaps")
|
||||
e.ArrStart()
|
||||
for _, elem := range s.ExperienceOverlaps {
|
||||
elem.Encode(e)
|
||||
}
|
||||
e.ArrEnd()
|
||||
}
|
||||
{
|
||||
e.FieldStart("soft_skills")
|
||||
e.ArrStart()
|
||||
@@ -9845,17 +9853,18 @@ func (s *CandidateProfile) encodeFields(e *jx.Encoder) {
|
||||
}
|
||||
}
|
||||
|
||||
var jsonFieldsNameOfCandidateProfile = [10]string{
|
||||
0: "version",
|
||||
1: "full_name",
|
||||
2: "contacts",
|
||||
3: "stack",
|
||||
4: "roles",
|
||||
5: "experience",
|
||||
6: "soft_skills",
|
||||
7: "terms",
|
||||
8: "confirmed_categories",
|
||||
9: "updated_at",
|
||||
var jsonFieldsNameOfCandidateProfile = [11]string{
|
||||
0: "version",
|
||||
1: "full_name",
|
||||
2: "contacts",
|
||||
3: "stack",
|
||||
4: "roles",
|
||||
5: "experience",
|
||||
6: "experience_overlaps",
|
||||
7: "soft_skills",
|
||||
8: "terms",
|
||||
9: "confirmed_categories",
|
||||
10: "updated_at",
|
||||
}
|
||||
|
||||
// Decode decodes CandidateProfile from json.
|
||||
@@ -9951,8 +9960,26 @@ func (s *CandidateProfile) Decode(d *jx.Decoder) error {
|
||||
}(); err != nil {
|
||||
return errors.Wrap(err, "decode field \"experience\"")
|
||||
}
|
||||
case "soft_skills":
|
||||
case "experience_overlaps":
|
||||
requiredBitSet[0] |= 1 << 6
|
||||
if err := func() error {
|
||||
s.ExperienceOverlaps = make([]ProfileExperienceOverlap, 0)
|
||||
if err := d.Arr(func(d *jx.Decoder) error {
|
||||
var elem ProfileExperienceOverlap
|
||||
if err := elem.Decode(d); err != nil {
|
||||
return err
|
||||
}
|
||||
s.ExperienceOverlaps = append(s.ExperienceOverlaps, elem)
|
||||
return nil
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return errors.Wrap(err, "decode field \"experience_overlaps\"")
|
||||
}
|
||||
case "soft_skills":
|
||||
requiredBitSet[0] |= 1 << 7
|
||||
if err := func() error {
|
||||
s.SoftSkills = make([]ProfileSoftSkillItem, 0)
|
||||
if err := d.Arr(func(d *jx.Decoder) error {
|
||||
@@ -9970,7 +9997,7 @@ func (s *CandidateProfile) Decode(d *jx.Decoder) error {
|
||||
return errors.Wrap(err, "decode field \"soft_skills\"")
|
||||
}
|
||||
case "terms":
|
||||
requiredBitSet[0] |= 1 << 7
|
||||
requiredBitSet[1] |= 1 << 0
|
||||
if err := func() error {
|
||||
if err := s.Terms.Decode(d); err != nil {
|
||||
return err
|
||||
@@ -9980,7 +10007,7 @@ func (s *CandidateProfile) Decode(d *jx.Decoder) error {
|
||||
return errors.Wrap(err, "decode field \"terms\"")
|
||||
}
|
||||
case "confirmed_categories":
|
||||
requiredBitSet[1] |= 1 << 0
|
||||
requiredBitSet[1] |= 1 << 1
|
||||
if err := func() error {
|
||||
s.ConfirmedCategories = make([]ProfileConfirmedCategory, 0)
|
||||
if err := d.Arr(func(d *jx.Decoder) error {
|
||||
@@ -9998,7 +10025,7 @@ func (s *CandidateProfile) Decode(d *jx.Decoder) error {
|
||||
return errors.Wrap(err, "decode field \"confirmed_categories\"")
|
||||
}
|
||||
case "updated_at":
|
||||
requiredBitSet[1] |= 1 << 1
|
||||
requiredBitSet[1] |= 1 << 2
|
||||
if err := func() error {
|
||||
if err := s.UpdatedAt.Decode(d); err != nil {
|
||||
return err
|
||||
@@ -10018,7 +10045,7 @@ func (s *CandidateProfile) Decode(d *jx.Decoder) error {
|
||||
var failures []validate.FieldError
|
||||
for i, mask := range [2]uint8{
|
||||
0b11111111,
|
||||
0b00000011,
|
||||
0b00000111,
|
||||
} {
|
||||
if result := (requiredBitSet[i] & mask) ^ mask; result != 0 {
|
||||
// Mask only required fields and check equality to mask using XOR.
|
||||
@@ -10109,6 +10136,16 @@ func (s *CandidateProfileUpdate) encodeFields(e *jx.Encoder) {
|
||||
}
|
||||
e.ArrEnd()
|
||||
}
|
||||
{
|
||||
if s.ConfirmedParallelPeriods != nil {
|
||||
e.FieldStart("confirmed_parallel_periods")
|
||||
e.ArrStart()
|
||||
for _, elem := range s.ConfirmedParallelPeriods {
|
||||
elem.Encode(e)
|
||||
}
|
||||
e.ArrEnd()
|
||||
}
|
||||
}
|
||||
{
|
||||
e.FieldStart("soft_skills")
|
||||
e.ArrStart()
|
||||
@@ -10123,15 +10160,16 @@ func (s *CandidateProfileUpdate) encodeFields(e *jx.Encoder) {
|
||||
}
|
||||
}
|
||||
|
||||
var jsonFieldsNameOfCandidateProfileUpdate = [8]string{
|
||||
var jsonFieldsNameOfCandidateProfileUpdate = [9]string{
|
||||
0: "expected_version",
|
||||
1: "full_name",
|
||||
2: "contacts",
|
||||
3: "stack",
|
||||
4: "roles",
|
||||
5: "experience",
|
||||
6: "soft_skills",
|
||||
7: "terms",
|
||||
6: "confirmed_parallel_periods",
|
||||
7: "soft_skills",
|
||||
8: "terms",
|
||||
}
|
||||
|
||||
// Decode decodes CandidateProfileUpdate from json.
|
||||
@@ -10139,7 +10177,7 @@ func (s *CandidateProfileUpdate) Decode(d *jx.Decoder) error {
|
||||
if s == nil {
|
||||
return errors.New("invalid: unable to decode CandidateProfileUpdate to nil")
|
||||
}
|
||||
var requiredBitSet [1]uint8
|
||||
var requiredBitSet [2]uint8
|
||||
|
||||
if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error {
|
||||
switch string(k) {
|
||||
@@ -10227,8 +10265,25 @@ func (s *CandidateProfileUpdate) Decode(d *jx.Decoder) error {
|
||||
}(); err != nil {
|
||||
return errors.Wrap(err, "decode field \"experience\"")
|
||||
}
|
||||
case "confirmed_parallel_periods":
|
||||
if err := func() error {
|
||||
s.ConfirmedParallelPeriods = make([]ProfileParallelPeriodConfirmation, 0)
|
||||
if err := d.Arr(func(d *jx.Decoder) error {
|
||||
var elem ProfileParallelPeriodConfirmation
|
||||
if err := elem.Decode(d); err != nil {
|
||||
return err
|
||||
}
|
||||
s.ConfirmedParallelPeriods = append(s.ConfirmedParallelPeriods, elem)
|
||||
return nil
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return errors.Wrap(err, "decode field \"confirmed_parallel_periods\"")
|
||||
}
|
||||
case "soft_skills":
|
||||
requiredBitSet[0] |= 1 << 6
|
||||
requiredBitSet[0] |= 1 << 7
|
||||
if err := func() error {
|
||||
s.SoftSkills = make([]ProfileSoftSkillItemInput, 0)
|
||||
if err := d.Arr(func(d *jx.Decoder) error {
|
||||
@@ -10246,7 +10301,7 @@ func (s *CandidateProfileUpdate) Decode(d *jx.Decoder) error {
|
||||
return errors.Wrap(err, "decode field \"soft_skills\"")
|
||||
}
|
||||
case "terms":
|
||||
requiredBitSet[0] |= 1 << 7
|
||||
requiredBitSet[1] |= 1 << 0
|
||||
if err := func() error {
|
||||
if err := s.Terms.Decode(d); err != nil {
|
||||
return err
|
||||
@@ -10264,8 +10319,9 @@ func (s *CandidateProfileUpdate) Decode(d *jx.Decoder) error {
|
||||
}
|
||||
// Validate required fields.
|
||||
var failures []validate.FieldError
|
||||
for i, mask := range [1]uint8{
|
||||
0b11111111,
|
||||
for i, mask := range [2]uint8{
|
||||
0b10111111,
|
||||
0b00000001,
|
||||
} {
|
||||
if result := (requiredBitSet[i] & mask) ^ mask; result != 0 {
|
||||
// Mask only required fields and check equality to mask using XOR.
|
||||
@@ -40269,6 +40325,283 @@ func (s *ProfileExperienceItemInput) UnmarshalJSON(data []byte) error {
|
||||
return s.Decode(d)
|
||||
}
|
||||
|
||||
// Encode implements json.Marshaler.
|
||||
func (s *ProfileExperienceOverlap) Encode(e *jx.Encoder) {
|
||||
e.ObjStart()
|
||||
s.encodeFields(e)
|
||||
e.ObjEnd()
|
||||
}
|
||||
|
||||
// encodeFields encodes fields.
|
||||
func (s *ProfileExperienceOverlap) encodeFields(e *jx.Encoder) {
|
||||
{
|
||||
e.FieldStart("first_index")
|
||||
e.Int(s.FirstIndex)
|
||||
}
|
||||
{
|
||||
e.FieldStart("second_index")
|
||||
e.Int(s.SecondIndex)
|
||||
}
|
||||
{
|
||||
e.FieldStart("status")
|
||||
s.Status.Encode(e)
|
||||
}
|
||||
}
|
||||
|
||||
var jsonFieldsNameOfProfileExperienceOverlap = [3]string{
|
||||
0: "first_index",
|
||||
1: "second_index",
|
||||
2: "status",
|
||||
}
|
||||
|
||||
// Decode decodes ProfileExperienceOverlap from json.
|
||||
func (s *ProfileExperienceOverlap) Decode(d *jx.Decoder) error {
|
||||
if s == nil {
|
||||
return errors.New("invalid: unable to decode ProfileExperienceOverlap to nil")
|
||||
}
|
||||
var requiredBitSet [1]uint8
|
||||
|
||||
if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error {
|
||||
switch string(k) {
|
||||
case "first_index":
|
||||
requiredBitSet[0] |= 1 << 0
|
||||
if err := func() error {
|
||||
v, err := d.Int()
|
||||
s.FirstIndex = int(v)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return errors.Wrap(err, "decode field \"first_index\"")
|
||||
}
|
||||
case "second_index":
|
||||
requiredBitSet[0] |= 1 << 1
|
||||
if err := func() error {
|
||||
v, err := d.Int()
|
||||
s.SecondIndex = int(v)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return errors.Wrap(err, "decode field \"second_index\"")
|
||||
}
|
||||
case "status":
|
||||
requiredBitSet[0] |= 1 << 2
|
||||
if err := func() error {
|
||||
if err := s.Status.Decode(d); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return errors.Wrap(err, "decode field \"status\"")
|
||||
}
|
||||
default:
|
||||
return errors.Errorf("unexpected field %q", k)
|
||||
}
|
||||
return nil
|
||||
}); err != nil {
|
||||
return errors.Wrap(err, "decode ProfileExperienceOverlap")
|
||||
}
|
||||
// Validate required fields.
|
||||
var failures []validate.FieldError
|
||||
for i, mask := range [1]uint8{
|
||||
0b00000111,
|
||||
} {
|
||||
if result := (requiredBitSet[i] & mask) ^ mask; result != 0 {
|
||||
// Mask only required fields and check equality to mask using XOR.
|
||||
//
|
||||
// If XOR result is not zero, result is not equal to expected, so some fields are missed.
|
||||
// Bits of fields which would be set are actually bits of missed fields.
|
||||
missed := bits.OnesCount8(result)
|
||||
for bitN := 0; bitN < missed; bitN++ {
|
||||
bitIdx := bits.TrailingZeros8(result)
|
||||
fieldIdx := i*8 + bitIdx
|
||||
var name string
|
||||
if fieldIdx < len(jsonFieldsNameOfProfileExperienceOverlap) {
|
||||
name = jsonFieldsNameOfProfileExperienceOverlap[fieldIdx]
|
||||
} else {
|
||||
name = strconv.Itoa(fieldIdx)
|
||||
}
|
||||
failures = append(failures, validate.FieldError{
|
||||
Name: name,
|
||||
Error: validate.ErrFieldRequired,
|
||||
})
|
||||
// Reset bit.
|
||||
result &^= 1 << bitIdx
|
||||
}
|
||||
}
|
||||
}
|
||||
if len(failures) > 0 {
|
||||
return &validate.Error{Fields: failures}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalJSON implements stdjson.Marshaler.
|
||||
func (s *ProfileExperienceOverlap) MarshalJSON() ([]byte, error) {
|
||||
e := jx.Encoder{}
|
||||
s.Encode(&e)
|
||||
return e.Bytes(), nil
|
||||
}
|
||||
|
||||
// UnmarshalJSON implements stdjson.Unmarshaler.
|
||||
func (s *ProfileExperienceOverlap) UnmarshalJSON(data []byte) error {
|
||||
d := jx.DecodeBytes(data)
|
||||
return s.Decode(d)
|
||||
}
|
||||
|
||||
// Encode encodes ProfileExperienceOverlapStatus as json.
|
||||
func (s ProfileExperienceOverlapStatus) Encode(e *jx.Encoder) {
|
||||
e.Str(string(s))
|
||||
}
|
||||
|
||||
// Decode decodes ProfileExperienceOverlapStatus from json.
|
||||
func (s *ProfileExperienceOverlapStatus) Decode(d *jx.Decoder) error {
|
||||
if s == nil {
|
||||
return errors.New("invalid: unable to decode ProfileExperienceOverlapStatus to nil")
|
||||
}
|
||||
v, err := d.StrBytes()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// Try to use constant string.
|
||||
switch ProfileExperienceOverlapStatus(v) {
|
||||
case ProfileExperienceOverlapStatusNeedsConfirmation:
|
||||
*s = ProfileExperienceOverlapStatusNeedsConfirmation
|
||||
case ProfileExperienceOverlapStatusConfirmed:
|
||||
*s = ProfileExperienceOverlapStatusConfirmed
|
||||
default:
|
||||
*s = ProfileExperienceOverlapStatus(v)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalJSON implements stdjson.Marshaler.
|
||||
func (s ProfileExperienceOverlapStatus) MarshalJSON() ([]byte, error) {
|
||||
e := jx.Encoder{}
|
||||
s.Encode(&e)
|
||||
return e.Bytes(), nil
|
||||
}
|
||||
|
||||
// UnmarshalJSON implements stdjson.Unmarshaler.
|
||||
func (s *ProfileExperienceOverlapStatus) UnmarshalJSON(data []byte) error {
|
||||
d := jx.DecodeBytes(data)
|
||||
return s.Decode(d)
|
||||
}
|
||||
|
||||
// Encode implements json.Marshaler.
|
||||
func (s *ProfileExperiencePeriod) Encode(e *jx.Encoder) {
|
||||
e.ObjStart()
|
||||
s.encodeFields(e)
|
||||
e.ObjEnd()
|
||||
}
|
||||
|
||||
// encodeFields encodes fields.
|
||||
func (s *ProfileExperiencePeriod) encodeFields(e *jx.Encoder) {
|
||||
{
|
||||
e.FieldStart("started_on")
|
||||
s.StartedOn.Encode(e)
|
||||
}
|
||||
{
|
||||
e.FieldStart("ended_on")
|
||||
s.EndedOn.Encode(e)
|
||||
}
|
||||
}
|
||||
|
||||
var jsonFieldsNameOfProfileExperiencePeriod = [2]string{
|
||||
0: "started_on",
|
||||
1: "ended_on",
|
||||
}
|
||||
|
||||
// Decode decodes ProfileExperiencePeriod from json.
|
||||
func (s *ProfileExperiencePeriod) Decode(d *jx.Decoder) error {
|
||||
if s == nil {
|
||||
return errors.New("invalid: unable to decode ProfileExperiencePeriod to nil")
|
||||
}
|
||||
var requiredBitSet [1]uint8
|
||||
|
||||
if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error {
|
||||
switch string(k) {
|
||||
case "started_on":
|
||||
requiredBitSet[0] |= 1 << 0
|
||||
if err := func() error {
|
||||
if err := s.StartedOn.Decode(d); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return errors.Wrap(err, "decode field \"started_on\"")
|
||||
}
|
||||
case "ended_on":
|
||||
requiredBitSet[0] |= 1 << 1
|
||||
if err := func() error {
|
||||
if err := s.EndedOn.Decode(d); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return errors.Wrap(err, "decode field \"ended_on\"")
|
||||
}
|
||||
default:
|
||||
return errors.Errorf("unexpected field %q", k)
|
||||
}
|
||||
return nil
|
||||
}); err != nil {
|
||||
return errors.Wrap(err, "decode ProfileExperiencePeriod")
|
||||
}
|
||||
// Validate required fields.
|
||||
var failures []validate.FieldError
|
||||
for i, mask := range [1]uint8{
|
||||
0b00000011,
|
||||
} {
|
||||
if result := (requiredBitSet[i] & mask) ^ mask; result != 0 {
|
||||
// Mask only required fields and check equality to mask using XOR.
|
||||
//
|
||||
// If XOR result is not zero, result is not equal to expected, so some fields are missed.
|
||||
// Bits of fields which would be set are actually bits of missed fields.
|
||||
missed := bits.OnesCount8(result)
|
||||
for bitN := 0; bitN < missed; bitN++ {
|
||||
bitIdx := bits.TrailingZeros8(result)
|
||||
fieldIdx := i*8 + bitIdx
|
||||
var name string
|
||||
if fieldIdx < len(jsonFieldsNameOfProfileExperiencePeriod) {
|
||||
name = jsonFieldsNameOfProfileExperiencePeriod[fieldIdx]
|
||||
} else {
|
||||
name = strconv.Itoa(fieldIdx)
|
||||
}
|
||||
failures = append(failures, validate.FieldError{
|
||||
Name: name,
|
||||
Error: validate.ErrFieldRequired,
|
||||
})
|
||||
// Reset bit.
|
||||
result &^= 1 << bitIdx
|
||||
}
|
||||
}
|
||||
}
|
||||
if len(failures) > 0 {
|
||||
return &validate.Error{Fields: failures}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalJSON implements stdjson.Marshaler.
|
||||
func (s *ProfileExperiencePeriod) MarshalJSON() ([]byte, error) {
|
||||
e := jx.Encoder{}
|
||||
s.Encode(&e)
|
||||
return e.Bytes(), nil
|
||||
}
|
||||
|
||||
// UnmarshalJSON implements stdjson.Unmarshaler.
|
||||
func (s *ProfileExperiencePeriod) UnmarshalJSON(data []byte) error {
|
||||
d := jx.DecodeBytes(data)
|
||||
return s.Decode(d)
|
||||
}
|
||||
|
||||
// Encode encodes ProfileExperienceSummary as json.
|
||||
func (s ProfileExperienceSummary) Encode(e *jx.Encoder) {
|
||||
unwrapped := string(s)
|
||||
@@ -40855,6 +41188,149 @@ func (s *ProfileLocationName) UnmarshalJSON(data []byte) error {
|
||||
return s.Decode(d)
|
||||
}
|
||||
|
||||
// Encode implements json.Marshaler.
|
||||
func (s *ProfileParallelPeriodConfirmation) Encode(e *jx.Encoder) {
|
||||
e.ObjStart()
|
||||
s.encodeFields(e)
|
||||
e.ObjEnd()
|
||||
}
|
||||
|
||||
// encodeFields encodes fields.
|
||||
func (s *ProfileParallelPeriodConfirmation) encodeFields(e *jx.Encoder) {
|
||||
{
|
||||
e.FieldStart("first_index")
|
||||
e.Int(s.FirstIndex)
|
||||
}
|
||||
{
|
||||
e.FieldStart("second_index")
|
||||
e.Int(s.SecondIndex)
|
||||
}
|
||||
{
|
||||
e.FieldStart("first_period")
|
||||
s.FirstPeriod.Encode(e)
|
||||
}
|
||||
{
|
||||
e.FieldStart("second_period")
|
||||
s.SecondPeriod.Encode(e)
|
||||
}
|
||||
}
|
||||
|
||||
var jsonFieldsNameOfProfileParallelPeriodConfirmation = [4]string{
|
||||
0: "first_index",
|
||||
1: "second_index",
|
||||
2: "first_period",
|
||||
3: "second_period",
|
||||
}
|
||||
|
||||
// Decode decodes ProfileParallelPeriodConfirmation from json.
|
||||
func (s *ProfileParallelPeriodConfirmation) Decode(d *jx.Decoder) error {
|
||||
if s == nil {
|
||||
return errors.New("invalid: unable to decode ProfileParallelPeriodConfirmation to nil")
|
||||
}
|
||||
var requiredBitSet [1]uint8
|
||||
|
||||
if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error {
|
||||
switch string(k) {
|
||||
case "first_index":
|
||||
requiredBitSet[0] |= 1 << 0
|
||||
if err := func() error {
|
||||
v, err := d.Int()
|
||||
s.FirstIndex = int(v)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return errors.Wrap(err, "decode field \"first_index\"")
|
||||
}
|
||||
case "second_index":
|
||||
requiredBitSet[0] |= 1 << 1
|
||||
if err := func() error {
|
||||
v, err := d.Int()
|
||||
s.SecondIndex = int(v)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return errors.Wrap(err, "decode field \"second_index\"")
|
||||
}
|
||||
case "first_period":
|
||||
requiredBitSet[0] |= 1 << 2
|
||||
if err := func() error {
|
||||
if err := s.FirstPeriod.Decode(d); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return errors.Wrap(err, "decode field \"first_period\"")
|
||||
}
|
||||
case "second_period":
|
||||
requiredBitSet[0] |= 1 << 3
|
||||
if err := func() error {
|
||||
if err := s.SecondPeriod.Decode(d); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return errors.Wrap(err, "decode field \"second_period\"")
|
||||
}
|
||||
default:
|
||||
return errors.Errorf("unexpected field %q", k)
|
||||
}
|
||||
return nil
|
||||
}); err != nil {
|
||||
return errors.Wrap(err, "decode ProfileParallelPeriodConfirmation")
|
||||
}
|
||||
// Validate required fields.
|
||||
var failures []validate.FieldError
|
||||
for i, mask := range [1]uint8{
|
||||
0b00001111,
|
||||
} {
|
||||
if result := (requiredBitSet[i] & mask) ^ mask; result != 0 {
|
||||
// Mask only required fields and check equality to mask using XOR.
|
||||
//
|
||||
// If XOR result is not zero, result is not equal to expected, so some fields are missed.
|
||||
// Bits of fields which would be set are actually bits of missed fields.
|
||||
missed := bits.OnesCount8(result)
|
||||
for bitN := 0; bitN < missed; bitN++ {
|
||||
bitIdx := bits.TrailingZeros8(result)
|
||||
fieldIdx := i*8 + bitIdx
|
||||
var name string
|
||||
if fieldIdx < len(jsonFieldsNameOfProfileParallelPeriodConfirmation) {
|
||||
name = jsonFieldsNameOfProfileParallelPeriodConfirmation[fieldIdx]
|
||||
} else {
|
||||
name = strconv.Itoa(fieldIdx)
|
||||
}
|
||||
failures = append(failures, validate.FieldError{
|
||||
Name: name,
|
||||
Error: validate.ErrFieldRequired,
|
||||
})
|
||||
// Reset bit.
|
||||
result &^= 1 << bitIdx
|
||||
}
|
||||
}
|
||||
}
|
||||
if len(failures) > 0 {
|
||||
return &validate.Error{Fields: failures}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalJSON implements stdjson.Marshaler.
|
||||
func (s *ProfileParallelPeriodConfirmation) MarshalJSON() ([]byte, error) {
|
||||
e := jx.Encoder{}
|
||||
s.Encode(&e)
|
||||
return e.Bytes(), nil
|
||||
}
|
||||
|
||||
// UnmarshalJSON implements stdjson.Unmarshaler.
|
||||
func (s *ProfileParallelPeriodConfirmation) UnmarshalJSON(data []byte) error {
|
||||
d := jx.DecodeBytes(data)
|
||||
return s.Decode(d)
|
||||
}
|
||||
|
||||
// Encode implements json.Marshaler.
|
||||
func (s *ProfilePhoneClaim) Encode(e *jx.Encoder) {
|
||||
e.ObjStart()
|
||||
|
||||
@@ -3261,7 +3261,7 @@ func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool) {
|
||||
switch method {
|
||||
case "GET":
|
||||
r.name = GetOrganizationOperation
|
||||
r.summary = "Read an organization of which the caller is a member."
|
||||
r.summary = "Read an organization managed by the caller."
|
||||
r.operationID = "GetOrganization"
|
||||
r.operationGroup = ""
|
||||
r.pathPattern = "/api/v1/organizations/{org_id}"
|
||||
|
||||
@@ -5097,6 +5097,9 @@ type CandidateProfile struct {
|
||||
Roles []ProfileRoleItem `json:"roles"`
|
||||
// Work history entries in the order the candidate gave them.
|
||||
Experience []ProfileExperienceItem `json:"experience"`
|
||||
// Every pair of overlapping experience periods, with its confirmation status. The indices refer to
|
||||
// this version's experience array.
|
||||
ExperienceOverlaps []ProfileExperienceOverlap `json:"experience_overlaps"`
|
||||
// Soft skills in the order the candidate gave them, each skill at most once without regard to letter
|
||||
// case.
|
||||
SoftSkills []ProfileSoftSkillItem `json:"soft_skills"`
|
||||
@@ -5138,6 +5141,11 @@ func (s *CandidateProfile) GetExperience() []ProfileExperienceItem {
|
||||
return s.Experience
|
||||
}
|
||||
|
||||
// GetExperienceOverlaps returns the value of ExperienceOverlaps.
|
||||
func (s *CandidateProfile) GetExperienceOverlaps() []ProfileExperienceOverlap {
|
||||
return s.ExperienceOverlaps
|
||||
}
|
||||
|
||||
// GetSoftSkills returns the value of SoftSkills.
|
||||
func (s *CandidateProfile) GetSoftSkills() []ProfileSoftSkillItem {
|
||||
return s.SoftSkills
|
||||
@@ -5188,6 +5196,11 @@ func (s *CandidateProfile) SetExperience(val []ProfileExperienceItem) {
|
||||
s.Experience = val
|
||||
}
|
||||
|
||||
// SetExperienceOverlaps sets the value of ExperienceOverlaps.
|
||||
func (s *CandidateProfile) SetExperienceOverlaps(val []ProfileExperienceOverlap) {
|
||||
s.ExperienceOverlaps = val
|
||||
}
|
||||
|
||||
// SetSoftSkills sets the value of SoftSkills.
|
||||
func (s *CandidateProfile) SetSoftSkills(val []ProfileSoftSkillItem) {
|
||||
s.SoftSkills = val
|
||||
@@ -5259,6 +5272,11 @@ type CandidateProfileUpdate struct {
|
||||
Roles []ProfileRoleItemInput `json:"roles"`
|
||||
// Work history entries.
|
||||
Experience []ProfileExperienceItemInput `json:"experience"`
|
||||
// Explicit acknowledgements for overlapping periods. Each pair must use distinct in-range indices and
|
||||
// repeat the exact normalized started_on and ended_on values of those entries in this body. A changed
|
||||
// or reordered period needs a new acknowledgement. The server retains a previous acknowledgement only
|
||||
// for the same indices and dates. Duplicate pairs and pairs that do not overlap are rejected.
|
||||
ConfirmedParallelPeriods []ProfileParallelPeriodConfirmation `json:"confirmed_parallel_periods"`
|
||||
// Soft skills. The server answers 400 with the pointer of a skill that repeats an earlier one without
|
||||
// regard to letter case.
|
||||
SoftSkills []ProfileSoftSkillItemInput `json:"soft_skills"`
|
||||
@@ -5295,6 +5313,11 @@ func (s *CandidateProfileUpdate) GetExperience() []ProfileExperienceItemInput {
|
||||
return s.Experience
|
||||
}
|
||||
|
||||
// GetConfirmedParallelPeriods returns the value of ConfirmedParallelPeriods.
|
||||
func (s *CandidateProfileUpdate) GetConfirmedParallelPeriods() []ProfileParallelPeriodConfirmation {
|
||||
return s.ConfirmedParallelPeriods
|
||||
}
|
||||
|
||||
// GetSoftSkills returns the value of SoftSkills.
|
||||
func (s *CandidateProfileUpdate) GetSoftSkills() []ProfileSoftSkillItemInput {
|
||||
return s.SoftSkills
|
||||
@@ -5335,6 +5358,11 @@ func (s *CandidateProfileUpdate) SetExperience(val []ProfileExperienceItemInput)
|
||||
s.Experience = val
|
||||
}
|
||||
|
||||
// SetConfirmedParallelPeriods sets the value of ConfirmedParallelPeriods.
|
||||
func (s *CandidateProfileUpdate) SetConfirmedParallelPeriods(val []ProfileParallelPeriodConfirmation) {
|
||||
s.ConfirmedParallelPeriods = val
|
||||
}
|
||||
|
||||
// SetSoftSkills sets the value of SoftSkills.
|
||||
func (s *CandidateProfileUpdate) SetSoftSkills(val []ProfileSoftSkillItemInput) {
|
||||
s.SoftSkills = val
|
||||
@@ -21066,6 +21094,117 @@ func (s *ProfileExperienceItemInput) SetStatus(val ProfileItemStatus) {
|
||||
s.Status = val
|
||||
}
|
||||
|
||||
// One pair of work history entries whose inclusive month ranges overlap. The indices refer to the
|
||||
// experience array in this profile version. `confirmed` records an explicit acknowledgement for this
|
||||
// pair of dates; otherwise the pair needs confirmation before a changed profile can be saved.
|
||||
// Ref: #/components/schemas/ProfileExperienceOverlap
|
||||
type ProfileExperienceOverlap struct {
|
||||
FirstIndex int `json:"first_index"`
|
||||
SecondIndex int `json:"second_index"`
|
||||
Status ProfileExperienceOverlapStatus `json:"status"`
|
||||
}
|
||||
|
||||
// GetFirstIndex returns the value of FirstIndex.
|
||||
func (s *ProfileExperienceOverlap) GetFirstIndex() int {
|
||||
return s.FirstIndex
|
||||
}
|
||||
|
||||
// GetSecondIndex returns the value of SecondIndex.
|
||||
func (s *ProfileExperienceOverlap) GetSecondIndex() int {
|
||||
return s.SecondIndex
|
||||
}
|
||||
|
||||
// GetStatus returns the value of Status.
|
||||
func (s *ProfileExperienceOverlap) GetStatus() ProfileExperienceOverlapStatus {
|
||||
return s.Status
|
||||
}
|
||||
|
||||
// SetFirstIndex sets the value of FirstIndex.
|
||||
func (s *ProfileExperienceOverlap) SetFirstIndex(val int) {
|
||||
s.FirstIndex = val
|
||||
}
|
||||
|
||||
// SetSecondIndex sets the value of SecondIndex.
|
||||
func (s *ProfileExperienceOverlap) SetSecondIndex(val int) {
|
||||
s.SecondIndex = val
|
||||
}
|
||||
|
||||
// SetStatus sets the value of Status.
|
||||
func (s *ProfileExperienceOverlap) SetStatus(val ProfileExperienceOverlapStatus) {
|
||||
s.Status = val
|
||||
}
|
||||
|
||||
// Whether the candidate confirmed that two overlapping periods are genuine parallel work.
|
||||
// Ref: #/components/schemas/ProfileExperienceOverlapStatus
|
||||
type ProfileExperienceOverlapStatus string
|
||||
|
||||
const (
|
||||
ProfileExperienceOverlapStatusNeedsConfirmation ProfileExperienceOverlapStatus = "needs_confirmation"
|
||||
ProfileExperienceOverlapStatusConfirmed ProfileExperienceOverlapStatus = "confirmed"
|
||||
)
|
||||
|
||||
// AllValues returns all ProfileExperienceOverlapStatus values.
|
||||
func (ProfileExperienceOverlapStatus) AllValues() []ProfileExperienceOverlapStatus {
|
||||
return []ProfileExperienceOverlapStatus{
|
||||
ProfileExperienceOverlapStatusNeedsConfirmation,
|
||||
ProfileExperienceOverlapStatusConfirmed,
|
||||
}
|
||||
}
|
||||
|
||||
// MarshalText implements encoding.TextMarshaler.
|
||||
func (s ProfileExperienceOverlapStatus) MarshalText() ([]byte, error) {
|
||||
switch s {
|
||||
case ProfileExperienceOverlapStatusNeedsConfirmation:
|
||||
return []byte(s), nil
|
||||
case ProfileExperienceOverlapStatusConfirmed:
|
||||
return []byte(s), nil
|
||||
default:
|
||||
return nil, errors.Errorf("invalid value: %q", s)
|
||||
}
|
||||
}
|
||||
|
||||
// UnmarshalText implements encoding.TextUnmarshaler.
|
||||
func (s *ProfileExperienceOverlapStatus) UnmarshalText(data []byte) error {
|
||||
switch ProfileExperienceOverlapStatus(data) {
|
||||
case ProfileExperienceOverlapStatusNeedsConfirmation:
|
||||
*s = ProfileExperienceOverlapStatusNeedsConfirmation
|
||||
return nil
|
||||
case ProfileExperienceOverlapStatusConfirmed:
|
||||
*s = ProfileExperienceOverlapStatusConfirmed
|
||||
return nil
|
||||
default:
|
||||
return errors.Errorf("invalid value: %q", data)
|
||||
}
|
||||
}
|
||||
|
||||
// The exact month range of an experience entry, copied into a confirmation.
|
||||
// Ref: #/components/schemas/ProfileExperiencePeriod
|
||||
type ProfileExperiencePeriod struct {
|
||||
StartedOn ProfileYearMonth `json:"started_on"`
|
||||
// Last month of work, or null when the period is open-ended.
|
||||
EndedOn NilProfileYearMonth `json:"ended_on"`
|
||||
}
|
||||
|
||||
// GetStartedOn returns the value of StartedOn.
|
||||
func (s *ProfileExperiencePeriod) GetStartedOn() ProfileYearMonth {
|
||||
return s.StartedOn
|
||||
}
|
||||
|
||||
// GetEndedOn returns the value of EndedOn.
|
||||
func (s *ProfileExperiencePeriod) GetEndedOn() NilProfileYearMonth {
|
||||
return s.EndedOn
|
||||
}
|
||||
|
||||
// SetStartedOn sets the value of StartedOn.
|
||||
func (s *ProfileExperiencePeriod) SetStartedOn(val ProfileYearMonth) {
|
||||
s.StartedOn = val
|
||||
}
|
||||
|
||||
// SetEndedOn sets the value of EndedOn.
|
||||
func (s *ProfileExperiencePeriod) SetEndedOn(val NilProfileYearMonth) {
|
||||
s.EndedOn = val
|
||||
}
|
||||
|
||||
type ProfileExperienceSummary string
|
||||
|
||||
// Full name of the candidate with its confirmation state and provenance. The value is personal data.
|
||||
@@ -21260,6 +21399,57 @@ func (s *ProfileLocationInput) SetStatus(val ProfileItemStatus) {
|
||||
|
||||
type ProfileLocationName string
|
||||
|
||||
// Explicit acknowledgement that the two indexed experience periods are genuine parallel work. The
|
||||
// indices and exact ranges must match the submitted experience array; expected_version binds the
|
||||
// acknowledgement to the profile version the candidate read.
|
||||
// Ref: #/components/schemas/ProfileParallelPeriodConfirmation
|
||||
type ProfileParallelPeriodConfirmation struct {
|
||||
FirstIndex int `json:"first_index"`
|
||||
SecondIndex int `json:"second_index"`
|
||||
FirstPeriod ProfileExperiencePeriod `json:"first_period"`
|
||||
SecondPeriod ProfileExperiencePeriod `json:"second_period"`
|
||||
}
|
||||
|
||||
// GetFirstIndex returns the value of FirstIndex.
|
||||
func (s *ProfileParallelPeriodConfirmation) GetFirstIndex() int {
|
||||
return s.FirstIndex
|
||||
}
|
||||
|
||||
// GetSecondIndex returns the value of SecondIndex.
|
||||
func (s *ProfileParallelPeriodConfirmation) GetSecondIndex() int {
|
||||
return s.SecondIndex
|
||||
}
|
||||
|
||||
// GetFirstPeriod returns the value of FirstPeriod.
|
||||
func (s *ProfileParallelPeriodConfirmation) GetFirstPeriod() ProfileExperiencePeriod {
|
||||
return s.FirstPeriod
|
||||
}
|
||||
|
||||
// GetSecondPeriod returns the value of SecondPeriod.
|
||||
func (s *ProfileParallelPeriodConfirmation) GetSecondPeriod() ProfileExperiencePeriod {
|
||||
return s.SecondPeriod
|
||||
}
|
||||
|
||||
// SetFirstIndex sets the value of FirstIndex.
|
||||
func (s *ProfileParallelPeriodConfirmation) SetFirstIndex(val int) {
|
||||
s.FirstIndex = val
|
||||
}
|
||||
|
||||
// SetSecondIndex sets the value of SecondIndex.
|
||||
func (s *ProfileParallelPeriodConfirmation) SetSecondIndex(val int) {
|
||||
s.SecondIndex = val
|
||||
}
|
||||
|
||||
// SetFirstPeriod sets the value of FirstPeriod.
|
||||
func (s *ProfileParallelPeriodConfirmation) SetFirstPeriod(val ProfileExperiencePeriod) {
|
||||
s.FirstPeriod = val
|
||||
}
|
||||
|
||||
// SetSecondPeriod sets the value of SecondPeriod.
|
||||
func (s *ProfileParallelPeriodConfirmation) SetSecondPeriod(val ProfileExperiencePeriod) {
|
||||
s.SecondPeriod = val
|
||||
}
|
||||
|
||||
// Contact phone number of the candidate with its confirmation state and provenance. It is personal
|
||||
// data, stored in the E.164 format of the contact disclosure. `value` and `source` are null exactly
|
||||
// when `status` is `unknown`.
|
||||
|
||||
@@ -700,6 +700,10 @@ type Handler interface {
|
||||
// establish and which no request writes. The profile needs no file, no ML extraction, and no FSP
|
||||
// account.
|
||||
//
|
||||
// `experience_overlaps` lists every pair of entries whose inclusive month ranges overlap. Its indices
|
||||
// refer to this response's `experience` array and are scoped to the same `version`; each pair is
|
||||
// either `needs_confirmation` or `confirmed`.
|
||||
//
|
||||
// A missing, unknown, expired, or revoked session answers 401 unauthenticated; an employer account
|
||||
// answers 403 forbidden.
|
||||
//
|
||||
@@ -742,9 +746,9 @@ type Handler interface {
|
||||
GetMySupportCase(ctx context.Context, params GetMySupportCaseParams) (GetMySupportCaseRes, error)
|
||||
// GetOrganization implements GetOrganization operation.
|
||||
//
|
||||
// Requires the session cookie of an employer account with an active membership in `org_id`. The
|
||||
// organization comes from the path and is checked against the membership that the server holds for the
|
||||
// session account on every request; the identifier itself grants nothing.
|
||||
// Requires the session cookie of a verified employer account with an active owner membership in
|
||||
// `org_id`. The organization comes from the path and is checked against the membership that the server
|
||||
// holds for the session account on every request; the identifier itself grants nothing.
|
||||
//
|
||||
// Returns the profile with its current `version`, the verification level (`verification`), and the
|
||||
// card as a candidate sees it (`candidate_card`). The verification level is always the one the server
|
||||
@@ -752,15 +756,11 @@ type Handler interface {
|
||||
// because of an email domain. The role of the caller is not part of this resource; ListMyOrganizations
|
||||
// returns it with the membership.
|
||||
//
|
||||
// In the MVP the profile is readable by any active member; every member is an owner, because the
|
||||
// operations that add members are planned. The roles of PRD FR07 that read a company card without
|
||||
// managing it change no field of this contract.
|
||||
//
|
||||
// Access: a missing, unknown, expired, or revoked session answers 401 unauthenticated; a candidate
|
||||
// account answers 403 forbidden; an account without an active membership in the organization,
|
||||
// including a `suspended`, `removed`, or `left` one, and an unknown organization all answer 404
|
||||
// not_found, so organizations cannot be enumerated. A malformed `org_id` answers 400 validation_failed
|
||||
// with the path pointer.
|
||||
// not_found, so organizations cannot be enumerated. An active member whose role is not `owner` answers
|
||||
// 403 forbidden. A malformed `org_id` answers 400 validation_failed with the path pointer.
|
||||
//
|
||||
// GET /api/v1/organizations/{org_id}
|
||||
GetOrganization(ctx context.Context, params GetOrganizationParams) (GetOrganizationRes, error)
|
||||
@@ -1293,9 +1293,9 @@ type Handler interface {
|
||||
//
|
||||
// Every field is optional in substance: a profile can be saved with any subset filled and the rest
|
||||
// null or empty, so no value requires a resume, the ML service, an FSP account, or any other file or
|
||||
// link. Which fields are needed to leave the onboarding step candidate_profile is an open product
|
||||
// question that this contract does not decide; a save on that step advancing the account to
|
||||
// candidate_questionnaire is planned.
|
||||
// link. A successful save advances an account whose current onboarding step is candidate_profile to
|
||||
// candidate_questionnaire, including a no-op save; it never moves a later step backwards. This update
|
||||
// is atomic with the profile and its history.
|
||||
//
|
||||
// Provenance is the server's: a value typed in the form is `manual`, confirming a stored suggestion
|
||||
// keeps its origin, and every claim keeps trust level 0. The body has no origin, trust level,
|
||||
@@ -1320,6 +1320,17 @@ type Handler interface {
|
||||
// therefore sends every suggestion that it received, and a client that read an older version gets 412
|
||||
// instead of silently dropping a suggestion it never saw.
|
||||
//
|
||||
// Experience periods use inclusive calendar months. An overlap is allowed only when
|
||||
// `confirmed_parallel_periods` explicitly acknowledges that the two date ranges are genuine parallel
|
||||
// work. Each acknowledgement names two distinct experience indices and repeats their exact normalized
|
||||
// `started_on` and `ended_on` values; both indices and periods must match the submitted array and
|
||||
// `expected_version`. A new or changed period needs an acknowledgement in that PUT. The server carries
|
||||
// an earlier acknowledgement only when the same two indices still contain the same dates; reordering
|
||||
// or changing either date requires a new acknowledgement. Editing other experience fields does not
|
||||
// invalidate a matching date-pair acknowledgement. A missing acknowledgement answers 400 with pointers
|
||||
// to the period fields and changes nothing. Duplicate, out-of-range, self, and non-overlapping
|
||||
// acknowledgements are invalid.
|
||||
//
|
||||
// Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400),
|
||||
// account scenario (403 forbidden for an employer), a version above the current one (412), domain
|
||||
// rules that depend on the body alone (400), then the rules that depend on the stored claims against
|
||||
@@ -1330,9 +1341,9 @@ type Handler interface {
|
||||
// without the leading @, an email that is not an address, a month outside `YYYY-MM`, a salary that is
|
||||
// not a positive multiple of 1000, and more items than a list allows. The server also rejects a
|
||||
// repeated tag, skill, or role specialization, a period that ends before it starts or lies in the
|
||||
// future, and a decision `extracted` for a value that is not a stored suggestion, with 400
|
||||
// validation_failed and pointers to the items, for example `/roles/1/specialization` or
|
||||
// `/stack/1/status`. Error bodies never repeat a submitted value.
|
||||
// future, a changed overlap without explicit confirmation, and a decision `extracted` for a value that
|
||||
// is not a stored suggestion, with 400 validation_failed and pointers to the items, for example
|
||||
// `/roles/1/specialization` or `/stack/1/status`. Error bodies never repeat a submitted value.
|
||||
//
|
||||
// PUT /api/v1/me/profile
|
||||
SaveMyProfile(ctx context.Context, req *CandidateProfileUpdate) (SaveMyProfileRes, error)
|
||||
|
||||
@@ -768,6 +768,10 @@ func (UnimplementedHandler) GetMyPrivacySettings(ctx context.Context) (r GetMyPr
|
||||
// establish and which no request writes. The profile needs no file, no ML extraction, and no FSP
|
||||
// account.
|
||||
//
|
||||
// `experience_overlaps` lists every pair of entries whose inclusive month ranges overlap. Its indices
|
||||
// refer to this response's `experience` array and are scoped to the same `version`; each pair is
|
||||
// either `needs_confirmation` or `confirmed`.
|
||||
//
|
||||
// A missing, unknown, expired, or revoked session answers 401 unauthenticated; an employer account
|
||||
// answers 403 forbidden.
|
||||
//
|
||||
@@ -819,9 +823,9 @@ func (UnimplementedHandler) GetMySupportCase(ctx context.Context, params GetMySu
|
||||
|
||||
// GetOrganization implements GetOrganization operation.
|
||||
//
|
||||
// Requires the session cookie of an employer account with an active membership in `org_id`. The
|
||||
// organization comes from the path and is checked against the membership that the server holds for the
|
||||
// session account on every request; the identifier itself grants nothing.
|
||||
// Requires the session cookie of a verified employer account with an active owner membership in
|
||||
// `org_id`. The organization comes from the path and is checked against the membership that the server
|
||||
// holds for the session account on every request; the identifier itself grants nothing.
|
||||
//
|
||||
// Returns the profile with its current `version`, the verification level (`verification`), and the
|
||||
// card as a candidate sees it (`candidate_card`). The verification level is always the one the server
|
||||
@@ -829,15 +833,11 @@ func (UnimplementedHandler) GetMySupportCase(ctx context.Context, params GetMySu
|
||||
// because of an email domain. The role of the caller is not part of this resource; ListMyOrganizations
|
||||
// returns it with the membership.
|
||||
//
|
||||
// In the MVP the profile is readable by any active member; every member is an owner, because the
|
||||
// operations that add members are planned. The roles of PRD FR07 that read a company card without
|
||||
// managing it change no field of this contract.
|
||||
//
|
||||
// Access: a missing, unknown, expired, or revoked session answers 401 unauthenticated; a candidate
|
||||
// account answers 403 forbidden; an account without an active membership in the organization,
|
||||
// including a `suspended`, `removed`, or `left` one, and an unknown organization all answer 404
|
||||
// not_found, so organizations cannot be enumerated. A malformed `org_id` answers 400 validation_failed
|
||||
// with the path pointer.
|
||||
// not_found, so organizations cannot be enumerated. An active member whose role is not `owner` answers
|
||||
// 403 forbidden. A malformed `org_id` answers 400 validation_failed with the path pointer.
|
||||
//
|
||||
// GET /api/v1/organizations/{org_id}
|
||||
func (UnimplementedHandler) GetOrganization(ctx context.Context, params GetOrganizationParams) (r GetOrganizationRes, _ error) {
|
||||
@@ -1442,9 +1442,9 @@ func (UnimplementedHandler) RevokeMyOrganizationContactConsent(ctx context.Conte
|
||||
//
|
||||
// Every field is optional in substance: a profile can be saved with any subset filled and the rest
|
||||
// null or empty, so no value requires a resume, the ML service, an FSP account, or any other file or
|
||||
// link. Which fields are needed to leave the onboarding step candidate_profile is an open product
|
||||
// question that this contract does not decide; a save on that step advancing the account to
|
||||
// candidate_questionnaire is planned.
|
||||
// link. A successful save advances an account whose current onboarding step is candidate_profile to
|
||||
// candidate_questionnaire, including a no-op save; it never moves a later step backwards. This update
|
||||
// is atomic with the profile and its history.
|
||||
//
|
||||
// Provenance is the server's: a value typed in the form is `manual`, confirming a stored suggestion
|
||||
// keeps its origin, and every claim keeps trust level 0. The body has no origin, trust level,
|
||||
@@ -1469,6 +1469,17 @@ func (UnimplementedHandler) RevokeMyOrganizationContactConsent(ctx context.Conte
|
||||
// therefore sends every suggestion that it received, and a client that read an older version gets 412
|
||||
// instead of silently dropping a suggestion it never saw.
|
||||
//
|
||||
// Experience periods use inclusive calendar months. An overlap is allowed only when
|
||||
// `confirmed_parallel_periods` explicitly acknowledges that the two date ranges are genuine parallel
|
||||
// work. Each acknowledgement names two distinct experience indices and repeats their exact normalized
|
||||
// `started_on` and `ended_on` values; both indices and periods must match the submitted array and
|
||||
// `expected_version`. A new or changed period needs an acknowledgement in that PUT. The server carries
|
||||
// an earlier acknowledgement only when the same two indices still contain the same dates; reordering
|
||||
// or changing either date requires a new acknowledgement. Editing other experience fields does not
|
||||
// invalidate a matching date-pair acknowledgement. A missing acknowledgement answers 400 with pointers
|
||||
// to the period fields and changes nothing. Duplicate, out-of-range, self, and non-overlapping
|
||||
// acknowledgements are invalid.
|
||||
//
|
||||
// Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400),
|
||||
// account scenario (403 forbidden for an employer), a version above the current one (412), domain
|
||||
// rules that depend on the body alone (400), then the rules that depend on the stored claims against
|
||||
@@ -1479,9 +1490,9 @@ func (UnimplementedHandler) RevokeMyOrganizationContactConsent(ctx context.Conte
|
||||
// without the leading @, an email that is not an address, a month outside `YYYY-MM`, a salary that is
|
||||
// not a positive multiple of 1000, and more items than a list allows. The server also rejects a
|
||||
// repeated tag, skill, or role specialization, a period that ends before it starts or lies in the
|
||||
// future, and a decision `extracted` for a value that is not a stored suggestion, with 400
|
||||
// validation_failed and pointers to the items, for example `/roles/1/specialization` or
|
||||
// `/stack/1/status`. Error bodies never repeat a submitted value.
|
||||
// future, a changed overlap without explicit confirmation, and a decision `extracted` for a value that
|
||||
// is not a stored suggestion, with 400 validation_failed and pointers to the items, for example
|
||||
// `/roles/1/specialization` or `/stack/1/status`. Error bodies never repeat a submitted value.
|
||||
//
|
||||
// PUT /api/v1/me/profile
|
||||
func (UnimplementedHandler) SaveMyProfile(ctx context.Context, req *CandidateProfileUpdate) (r SaveMyProfileRes, _ error) {
|
||||
|
||||
@@ -4553,6 +4553,42 @@ func (s *CandidateProfile) Validate() error {
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
if err := func() error {
|
||||
if s.ExperienceOverlaps == nil {
|
||||
return errors.New("nil is invalid value")
|
||||
}
|
||||
if err := (validate.Array{
|
||||
MinLength: 0,
|
||||
MinLengthSet: false,
|
||||
MaxLength: 190,
|
||||
MaxLengthSet: true,
|
||||
}).ValidateLength(len(s.ExperienceOverlaps)); err != nil {
|
||||
return errors.Wrap(err, "array")
|
||||
}
|
||||
var failures []validate.FieldError
|
||||
for i, elem := range s.ExperienceOverlaps {
|
||||
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: "experience_overlaps",
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
if err := func() error {
|
||||
if s.SoftSkills == nil {
|
||||
return errors.New("nil is invalid value")
|
||||
@@ -4830,6 +4866,42 @@ func (s *CandidateProfileUpdate) Validate() error {
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
if err := func() error {
|
||||
if s.ConfirmedParallelPeriods == nil {
|
||||
return nil // optional
|
||||
}
|
||||
if err := (validate.Array{
|
||||
MinLength: 0,
|
||||
MinLengthSet: false,
|
||||
MaxLength: 190,
|
||||
MaxLengthSet: true,
|
||||
}).ValidateLength(len(s.ConfirmedParallelPeriods)); err != nil {
|
||||
return errors.Wrap(err, "array")
|
||||
}
|
||||
var failures []validate.FieldError
|
||||
for i, elem := range s.ConfirmedParallelPeriods {
|
||||
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: "confirmed_parallel_periods",
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
if err := func() error {
|
||||
if s.SoftSkills == nil {
|
||||
return errors.New("nil is invalid value")
|
||||
@@ -16144,6 +16216,123 @@ func (s *ProfileExperienceItemInput) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *ProfileExperienceOverlap) Validate() error {
|
||||
if s == nil {
|
||||
return validate.ErrNilPointer
|
||||
}
|
||||
|
||||
var failures []validate.FieldError
|
||||
if err := func() error {
|
||||
if err := (validate.Int{
|
||||
MinSet: true,
|
||||
Min: 0,
|
||||
MaxSet: true,
|
||||
Max: 19,
|
||||
MinExclusive: false,
|
||||
MaxExclusive: false,
|
||||
MultipleOfSet: false,
|
||||
MultipleOf: 0,
|
||||
Pattern: nil,
|
||||
}).Validate(int64(s.FirstIndex)); err != nil {
|
||||
return errors.Wrap(err, "int")
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
failures = append(failures, validate.FieldError{
|
||||
Name: "first_index",
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
if err := func() error {
|
||||
if err := (validate.Int{
|
||||
MinSet: true,
|
||||
Min: 1,
|
||||
MaxSet: true,
|
||||
Max: 19,
|
||||
MinExclusive: false,
|
||||
MaxExclusive: false,
|
||||
MultipleOfSet: false,
|
||||
MultipleOf: 0,
|
||||
Pattern: nil,
|
||||
}).Validate(int64(s.SecondIndex)); err != nil {
|
||||
return errors.Wrap(err, "int")
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
failures = append(failures, validate.FieldError{
|
||||
Name: "second_index",
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
if err := func() error {
|
||||
if err := s.Status.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
failures = append(failures, validate.FieldError{
|
||||
Name: "status",
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
if len(failures) > 0 {
|
||||
return &validate.Error{Fields: failures}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s ProfileExperienceOverlapStatus) Validate() error {
|
||||
switch s {
|
||||
case "needs_confirmation":
|
||||
return nil
|
||||
case "confirmed":
|
||||
return nil
|
||||
default:
|
||||
return errors.Errorf("invalid value: %v", s)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *ProfileExperiencePeriod) Validate() error {
|
||||
if s == nil {
|
||||
return validate.ErrNilPointer
|
||||
}
|
||||
|
||||
var failures []validate.FieldError
|
||||
if err := func() error {
|
||||
if err := s.StartedOn.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
failures = append(failures, validate.FieldError{
|
||||
Name: "started_on",
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
if err := func() error {
|
||||
if value, ok := s.EndedOn.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: "ended_on",
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
if len(failures) > 0 {
|
||||
return &validate.Error{Fields: failures}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s ProfileExperienceSummary) Validate() error {
|
||||
alias := (string)(s)
|
||||
if err := (validate.String{
|
||||
@@ -16381,6 +16570,82 @@ func (s ProfileLocationName) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *ProfileParallelPeriodConfirmation) Validate() error {
|
||||
if s == nil {
|
||||
return validate.ErrNilPointer
|
||||
}
|
||||
|
||||
var failures []validate.FieldError
|
||||
if err := func() error {
|
||||
if err := (validate.Int{
|
||||
MinSet: true,
|
||||
Min: 0,
|
||||
MaxSet: true,
|
||||
Max: 19,
|
||||
MinExclusive: false,
|
||||
MaxExclusive: false,
|
||||
MultipleOfSet: false,
|
||||
MultipleOf: 0,
|
||||
Pattern: nil,
|
||||
}).Validate(int64(s.FirstIndex)); err != nil {
|
||||
return errors.Wrap(err, "int")
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
failures = append(failures, validate.FieldError{
|
||||
Name: "first_index",
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
if err := func() error {
|
||||
if err := (validate.Int{
|
||||
MinSet: true,
|
||||
Min: 1,
|
||||
MaxSet: true,
|
||||
Max: 19,
|
||||
MinExclusive: false,
|
||||
MaxExclusive: false,
|
||||
MultipleOfSet: false,
|
||||
MultipleOf: 0,
|
||||
Pattern: nil,
|
||||
}).Validate(int64(s.SecondIndex)); err != nil {
|
||||
return errors.Wrap(err, "int")
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
failures = append(failures, validate.FieldError{
|
||||
Name: "second_index",
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
if err := func() error {
|
||||
if err := s.FirstPeriod.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
failures = append(failures, validate.FieldError{
|
||||
Name: "first_period",
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
if err := func() error {
|
||||
if err := s.SecondPeriod.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
failures = append(failures, validate.FieldError{
|
||||
Name: "second_period",
|
||||
Error: err,
|
||||
})
|
||||
}
|
||||
if len(failures) > 0 {
|
||||
return &validate.Error{Fields: failures}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *ProfilePhoneClaim) Validate() error {
|
||||
if s == nil {
|
||||
return validate.ErrNilPointer
|
||||
|
||||
Reference in new issue
Block a user