114 lines
9.4 KiB
YAML
114 lines
9.4 KiB
YAML
get:
|
|
operationId: GetOrganizationNeed
|
|
summary: Read the current version of a need of an organization.
|
|
description: |-
|
|
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.
|
|
security:
|
|
- sessionCookie: []
|
|
tags:
|
|
- need
|
|
parameters:
|
|
- $ref: ../components/parameters.yml#/OrganizationId
|
|
- $ref: ../components/parameters.yml#/NeedId
|
|
responses:
|
|
"200":
|
|
description: The current version of the need.
|
|
headers:
|
|
Cache-Control:
|
|
$ref: ../components/headers.yml#/CacheControlNoStore
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: ../components/schemas.yml#/Need
|
|
examples:
|
|
manual_without_vacancy:
|
|
$ref: ../components/examples.yml#/NeedManualWithoutVacancy
|
|
from_text_with_unknown_skill:
|
|
$ref: ../components/examples.yml#/NeedExtractedWithUnknownSkill
|
|
confirmed:
|
|
$ref: ../components/examples.yml#/NeedConfirmedAfterUpdate
|
|
"400":
|
|
$ref: ../components/responses.yml#/ValidationFailed
|
|
"401":
|
|
$ref: ../components/responses.yml#/Unauthenticated
|
|
"403":
|
|
$ref: ../components/responses.yml#/Forbidden
|
|
"404":
|
|
$ref: ../components/responses.yml#/NotFound
|
|
default:
|
|
$ref: ../components/responses.yml#/Problem
|
|
patch:
|
|
operationId: UpdateOrganizationNeed
|
|
summary: Confirm, change, or delete requirements of a need.
|
|
description: |-
|
|
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.
|
|
security:
|
|
- sessionCookie: []
|
|
sessionCsrf: []
|
|
tags:
|
|
- need
|
|
parameters:
|
|
- $ref: ../components/parameters.yml#/OrganizationId
|
|
- $ref: ../components/parameters.yml#/NeedId
|
|
requestBody:
|
|
required: true
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: ../components/schemas.yml#/NeedUpdate
|
|
examples:
|
|
confirm_suggestions:
|
|
$ref: ../components/examples.yml#/NeedUpdateConfirmSuggestions
|
|
responses:
|
|
"200":
|
|
description: >-
|
|
The need after the change, or the current need when the body changes
|
|
nothing.
|
|
headers:
|
|
Cache-Control:
|
|
$ref: ../components/headers.yml#/CacheControlNoStore
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: ../components/schemas.yml#/Need
|
|
examples:
|
|
confirmed:
|
|
$ref: ../components/examples.yml#/NeedConfirmedAfterUpdate
|
|
"400":
|
|
$ref: ../components/responses.yml#/NeedValidationFailed
|
|
"401":
|
|
$ref: ../components/responses.yml#/Unauthenticated
|
|
"403":
|
|
$ref: ../components/responses.yml#/CsrfCheckFailedOrForbidden
|
|
"404":
|
|
$ref: ../components/responses.yml#/NotFound
|
|
"412":
|
|
$ref: ../components/responses.yml#/NeedVersionConflict
|
|
"429":
|
|
$ref: ../components/responses.yml#/TooManyRequests
|
|
default:
|
|
$ref: ../components/responses.yml#/Problem
|