feat(api): add employer need contract with requirement versions and recommendations
This commit is contained in:
1 parent
3adb0ef9e4
commit
a7d5781f2d
95 files changed
+25352
-26
No files matched your search
@@ -74,6 +74,59 @@ type Handler interface {
|
||||
//
|
||||
// POST /api/v1/me/assessment-attempts
|
||||
CreateMyAssessmentAttempt(ctx context.Context, req *AssessmentAttemptCreate, params CreateMyAssessmentAttemptParams) (CreateMyAssessmentAttemptRes, error)
|
||||
// CreateOrganizationNeed implements CreateOrganizationNeed operation.
|
||||
//
|
||||
// Requires the session cookie of an employer account with an active membership in `org_id`, the CSRF
|
||||
// token of that session in X-CSRF-Token, an allowed Origin, and an Idempotency-Key. The organization
|
||||
// comes from the path and the server-side membership; the body has no organization, membership, or
|
||||
// role field. In the MVP only the owner of the organization may create a need; the other roles of PRD
|
||||
// FR07 are planned.
|
||||
//
|
||||
// A need does not require a vacancy: `vacancy_id` is optional and nullable. When it is given, it must
|
||||
// name a vacancy of the same organization; until vacancies exist in the contract, any vacancy
|
||||
// identifier answers 400 with the pointer `/vacancy_id`, the same for an unknown vacancy and one of
|
||||
// another organization.
|
||||
//
|
||||
// Only `title` is required. A field is sent as a decision `{value, status}` and a list item as
|
||||
// `{name or text, status}`; on creation the status must be `confirmed`, and the value becomes a
|
||||
// confirmed manual value. When `source_text` is given, the server extracts suggestions for the absent
|
||||
// fields with deterministic rules and a dictionary before it answers, so creation works while the ML
|
||||
// service is disabled; every suggestion has the status `extracted`, the origin extracted_from_text, a
|
||||
// quote where the extractor found one, and the extractor version, and it waits for a member to confirm
|
||||
// it. A field that the text does not state stays `unknown` with null value and source; the server
|
||||
// never guesses a grade, a format, or a salary. ML suggestions with quotes are planned as an
|
||||
// asynchronous addition that creates a new version and never overwrites a confirmed value.
|
||||
//
|
||||
// The need is saved even when critical fields are missing: the response is 201 with version 1, and
|
||||
// `readiness.missing_fields` names each critical field without a confirmed value with a specific
|
||||
// question. `recommendations` is computed by the server from the confirmed requirements only; the
|
||||
// request cannot set a recommendation, its score, or its components. Creating a need never contacts a
|
||||
// candidate or sends an invitation.
|
||||
//
|
||||
// Salary limit: setting a salary range counts against a limit shared by the whole organization, every
|
||||
// member and every need, on creation as on a change: at most three range settings a day (PRD FR13,
|
||||
// planned in TASK-211). Over the limit the server answers 429 with Retry-After and creates nothing.
|
||||
// After five settings within seven days the money component of the recommendations is `withheld` for
|
||||
// seven days. The limit keeps an organization from probing hidden candidate minimums with new needs
|
||||
// instead of edits; repeated range changes also feed the private risk signals of TASK-319.
|
||||
//
|
||||
// Idempotency: a retry with the same key and body within 24 hours replays the stored 201 and creates
|
||||
// nothing, so a lost response never creates a second need. A different body with the same key answers
|
||||
// 422 idempotency_key_reused. 400 is never stored, so a corrected retry is evaluated again.
|
||||
//
|
||||
// Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400),
|
||||
// account scenario (403 forbidden for a candidate), membership (404 not_found) and role (403
|
||||
// forbidden), the Idempotency-Key (422, 409 idempotency_in_progress, replay), domain rules (400 with a
|
||||
// pointer: `/salary/value/salary_to` for a range whose lower bound is not below the upper one or whose
|
||||
// width is outside 10-40%, `/required_skills/1/name` for a repeated skill, `/grade/status` or
|
||||
// `/required_skills/0/status` for `extracted`, which a new need cannot have, or `/vacancy_id`), then
|
||||
// the salary limit (429). The schema already rejects unknown fields such as `rec_score`, `members`, or
|
||||
// `candidate_minimum`, a field sent as a bare value instead of `{value, status}`, a salary bound that
|
||||
// is not a positive multiple of 1000, and an unknown currency, period, or tax basis. The general rate
|
||||
// limit can answer 429 with Retry-After before any check. 429 is never stored.
|
||||
//
|
||||
// POST /api/v1/organizations/{org_id}/needs
|
||||
CreateOrganizationNeed(ctx context.Context, req *NeedCreate, params CreateOrganizationNeedParams) (CreateOrganizationNeedRes, error)
|
||||
// FinalizeMyAssessmentAttempt implements FinalizeMyAssessmentAttempt operation.
|
||||
//
|
||||
// Requires the session cookie of a candidate account, the CSRF token of that session in X-CSRF-Token,
|
||||
@@ -234,6 +287,37 @@ type Handler interface {
|
||||
//
|
||||
// GET /api/v1/me/questionnaire
|
||||
GetMyQuestionnaire(ctx context.Context) (GetMyQuestionnaireRes, error)
|
||||
// GetOrganizationNeed implements GetOrganizationNeed operation.
|
||||
//
|
||||
// Requires the session cookie of an employer account with an active membership in `org_id`. The
|
||||
// organization and the role come from the server-side membership, never from the request. In the MVP
|
||||
// only the owner of the organization reads needs; the other roles of PRD FR07 are planned.
|
||||
//
|
||||
// Returns the current version of the need: `version`, the requirements with the confirmation state and
|
||||
// provenance of each field (`status`, and `source` with the origin, the quote, the version whose text
|
||||
// the quote belongs to, and the extractor version), the readiness with `missing_fields`, and the
|
||||
// category recommendations of the server. A field with status `unknown` has null value and source; an
|
||||
// `extracted` value is a suggestion that waits for confirmation and never feeds search or
|
||||
// recommendations.
|
||||
//
|
||||
// Versions: every committed change creates a new immutable `version`, and this operation always
|
||||
// returns the latest one. `requirements_version` is the version in which the confirmed requirements
|
||||
// were last changed; a change of the title, the vacancy link, the text, or suggestions only keeps it.
|
||||
// Search runs, selection snapshots, and invitations refer to a need by its identifier and
|
||||
// `requirements_version`, so they keep the requirements they used, and only a new
|
||||
// `requirements_version` calls for a new selection snapshot. Reading and comparing earlier versions
|
||||
// (PRD FR10) are planned as separate operations that return the same NeedRequirementSet for a given
|
||||
// version; they add no field here.
|
||||
//
|
||||
// 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, an
|
||||
// unknown organization, an unknown need, and a need of another organization all answer 404 not_found,
|
||||
// so identifiers cannot be probed; a member whose role does not allow reading the need answers 403
|
||||
// forbidden. An `org_id` or `need_id` that is not a UUID answers 400 validation_failed with the path
|
||||
// pointer.
|
||||
//
|
||||
// GET /api/v1/organizations/{org_id}/needs/{need_id}
|
||||
GetOrganizationNeed(ctx context.Context, params GetOrganizationNeedParams) (GetOrganizationNeedRes, error)
|
||||
// GetSpecializationCatalog implements GetSpecializationCatalog operation.
|
||||
//
|
||||
// Public operation without a session. Returns the directions with their specializations, the
|
||||
@@ -254,6 +338,27 @@ type Handler interface {
|
||||
//
|
||||
// GET /api/v1/specializations
|
||||
GetSpecializationCatalog(ctx context.Context) (*SpecializationCatalog, error)
|
||||
// ListOrganizationNeeds implements ListOrganizationNeeds operation.
|
||||
//
|
||||
// Requires the session cookie of an employer account with an active membership in `org_id`. The
|
||||
// organization and the role come from the membership that the server holds for the session account,
|
||||
// never from the request. In the MVP only the owner of the organization works with needs; the other
|
||||
// roles of the PRD FR07 matrix (recruiter, hiring manager and technical expert for assigned needs) are
|
||||
// planned and change no field of this contract. The list holds only the needs that the role may read.
|
||||
//
|
||||
// Returns a page of need summaries, newest first by creation time with the identifier as the
|
||||
// tie-breaker, with cursor pagination. A summary has the current version, the target specialization
|
||||
// and grade with their confirmation state, and the readiness; GetOrganizationNeed returns the
|
||||
// requirements and the recommendations.
|
||||
//
|
||||
// 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 and an
|
||||
// unknown organization both answer 404 not_found, so organizations cannot be enumerated; a member
|
||||
// whose role does not allow reading needs answers 403 forbidden. A malformed `org_id`, `limit`, or
|
||||
// `cursor` answers 400 validation_failed.
|
||||
//
|
||||
// GET /api/v1/organizations/{org_id}/needs
|
||||
ListOrganizationNeeds(ctx context.Context, params ListOrganizationNeedsParams) (ListOrganizationNeedsRes, error)
|
||||
// Login implements Login operation.
|
||||
//
|
||||
// Public operation that starts a server session. The server verifies the password with Argon2id; for
|
||||
@@ -441,6 +546,73 @@ type Handler interface {
|
||||
//
|
||||
// POST /api/v1/me/assessment-attempts/{attempt_id}/answers
|
||||
SubmitMyAssessmentAnswer(ctx context.Context, req *AssessmentAnswerSubmission, params SubmitMyAssessmentAnswerParams) (SubmitMyAssessmentAnswerRes, error)
|
||||
// UpdateOrganizationNeed implements UpdateOrganizationNeed operation.
|
||||
//
|
||||
// Requires the session cookie of an employer account with an active membership in `org_id`, the CSRF
|
||||
// token of that session in X-CSRF-Token, and an allowed Origin. The organization and the role come
|
||||
// from the server-side membership; the body has no organization, membership, or role field. In the MVP
|
||||
// only the owner of the organization changes needs; the technical expert, who may refine the
|
||||
// requirements of assigned needs under PRD FR07, is planned.
|
||||
//
|
||||
// Merge rules: the body is `application/json` with explicit field replacement, not JSON Merge Patch.
|
||||
// Each field present replaces that field as a whole and an absent field stays unchanged; a field
|
||||
// decision and each list are replaced entirely and never merged. This keeps every field one optional
|
||||
// value in the generated server and client, without nested partial updates.
|
||||
//
|
||||
// Each requirement field is sent as a decision `{value, status}` and each list item as
|
||||
// `{name or text, status}`, so confirmation is always explicit:
|
||||
//
|
||||
// - Confirm a suggestion: send its stored value with `confirmed`. It keeps its origin and quote.
|
||||
// - Keep a suggestion open: send its stored value with `extracted`, or leave the field out.
|
||||
// `extracted` with any other value, or for a field or item without a stored suggestion, answers 400
|
||||
// with the pointer of that `status`, for example `/grade/status` or `/required_skills/2/status`. A
|
||||
// client that sends back an unchanged form therefore never confirms a suggestion by accident.
|
||||
// - Change: send another value with `confirmed`. It becomes a confirmed manual value, and its quote
|
||||
// is dropped.
|
||||
// - Delete: send null for a nullable field, which makes it `unknown` (or unlinks `vacancy_id`), or
|
||||
// leave the item out of a skill or task list, which deletes it. An empty skill or task list deletes
|
||||
// every item; a list sent as null answers 400. A deleted requirement really changes the
|
||||
// requirements that search uses, not only an explanation, and a deleted suggestion is not proposed
|
||||
// again by a later extraction.
|
||||
// - Text: a different `source_text` extracts again. New suggestions replace only the `extracted`
|
||||
// values and items of the fields not named in the body; confirmed values are never overwritten, and
|
||||
// a suggested skill whose name is already in either skill list is skipped. Null removes the text
|
||||
// and keeps every value.
|
||||
//
|
||||
// Versions: every committed change creates version `expected_version + 1` as an immutable snapshot and
|
||||
// answers 200 with it. `requirements_version` becomes the new version only when a confirmed
|
||||
// requirement was confirmed, changed, or removed. `expected_version` is the `version` the client read;
|
||||
// when it is not current, the server answers 412 version_conflict and changes nothing, and the client
|
||||
// reads the need again and reapplies its unsaved edits. The version travels in the body rather than in
|
||||
// If-Match because the generated client cannot read the ETag response header yet, as for the
|
||||
// questionnaire. Concurrent changes therefore never overwrite each other silently.
|
||||
//
|
||||
// The operation needs no Idempotency-Key: a body that changes nothing when applied to the current
|
||||
// version, such as a retry of a change that already succeeded, keeps the version and answers 200 with
|
||||
// the current need even when `expected_version` is older. An incomplete need is a valid result;
|
||||
// `readiness.missing_fields` tells what remains.
|
||||
//
|
||||
// Salary limit: the recommendations aggregate candidates' minimums against the upper bound, so setting
|
||||
// or changing a confirmed salary range counts against a limit shared by the whole organization, every
|
||||
// member and every need, together with ranges set on creation: at most three a day (PRD FR13, planned
|
||||
// in TASK-211). Over the limit the server answers 429 with Retry-After and changes nothing. After five
|
||||
// settings within seven days the money component is `withheld` for seven days. Repeated range changes
|
||||
// also feed the private risk signals of TASK-319.
|
||||
//
|
||||
// Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400),
|
||||
// account scenario (403 forbidden for a candidate), membership (404 not_found) and role (403
|
||||
// forbidden), the need (404 not_found), a body that changes nothing (200), the version (412), domain
|
||||
// rules (400 with a pointer such as `/salary/value/salary_to` for a range whose lower bound is not
|
||||
// below the upper one or whose width is outside 10-40%, `/desired_skills/0/name` for a skill that is
|
||||
// also in the required list, `/grade/status` or `/required_skills/2/status` for `extracted` with a
|
||||
// value that is not the stored suggestion, or `/vacancy_id`), then the salary change limit (429). The
|
||||
// schema rejects a missing or non-positive `expected_version`, unknown fields such as `rec_score`,
|
||||
// `members`, `candidate_minimum`, or `version`, a field sent as a bare value instead of
|
||||
// `{value, status}`, a list sent as null, a salary bound that is not a positive multiple of 1000, and
|
||||
// an unknown currency, period, or tax basis.
|
||||
//
|
||||
// PATCH /api/v1/organizations/{org_id}/needs/{need_id}
|
||||
UpdateOrganizationNeed(ctx context.Context, req *NeedUpdate, params UpdateOrganizationNeedParams) (UpdateOrganizationNeedRes, error)
|
||||
// NewError creates *ProblemStatusCode from error returned by handler.
|
||||
//
|
||||
// Used for common default response.
|
||||
|
||||
Reference in new issue
Block a user