feat(org): add organization and membership contract and storage
This commit is contained in:
1 parent
a0551a34b8
commit
bdc5855001
90 files changed
+17545
-480
No files matched your search
+802
-1
@@ -17,6 +17,8 @@ tags:
|
||||
description: Data of the current candidate, such as the questionnaire with the chosen specializations and self-assessed grades. Confirmed grades and categories come only from assessment results.
|
||||
- name: assessment
|
||||
description: 'Assessment attempts of the current candidate: availability, start and resume, answers and the code practice, finalization, and the result. Answers, keys, and attempt history are visible only to the candidate.'
|
||||
- name: organization
|
||||
description: 'Organizations of employer accounts: the profile with its contacts and representatives, the verification level that only the server sets, and the memberships that give an account its role in an organization. The organization in the path is authoritative and is checked against an active membership on every request; no body carries a role, a membership, or a verification level.'
|
||||
- name: need
|
||||
description: 'Hiring needs of an organization: requirements with their confirmation state and provenance, immutable versions, readiness, and category recommendations. Access comes only from an active membership in the organization; a need never requires a vacancy.'
|
||||
- name: invitation
|
||||
@@ -826,6 +828,204 @@ paths:
|
||||
$ref: '#/components/responses/AssessmentResultNotReady'
|
||||
default:
|
||||
$ref: '#/components/responses/Problem'
|
||||
/api/v1/me/organizations:
|
||||
get:
|
||||
operationId: ListMyOrganizations
|
||||
summary: List the organizations available to the current account.
|
||||
description: |-
|
||||
Requires the session cookie of an employer account. The account comes from the session, never from a request parameter, so the response holds only the caller's own memberships and no request can name another account.
|
||||
|
||||
Returns a page of the organizations in which the caller has an `active` membership, newest membership first with the organization identifier as the tie-breaker, with cursor pagination. Each item names the organization (`OrganizationSummary`) and holds the caller's role and state in it (`OrganizationMembership`). A membership in another state (`suspended`, `removed`, `left`) does not list its organization, so an organization the caller cannot enter is never named, and one that the caller was removed from disappears from the list at once.
|
||||
|
||||
The list is the directory of the active organization context. The context is not stored on the server: every organization-scoped operation names its organization in the path `org_id`, and the server checks that identifier against the caller's active membership on every request, so a switch between organizations is a different `org_id` in the client's routes and cannot outlive a revoked membership. A client picks the context from this list, may remember the last choice in the browser as a convenience, and must read the list again after any answer 404 `not_found` from an organization path. An account with several memberships sees all of them here and works in one at a time; the rights and the data of the organizations stay separate.
|
||||
|
||||
Access: a missing, unknown, expired, or revoked session answers 401 unauthenticated; a candidate account answers 403 forbidden. An employer account without an organization gets an empty page, which tells the client to offer CreateOrganization. A malformed `limit` or `cursor` answers 400 validation_failed.
|
||||
security:
|
||||
- sessionCookie: []
|
||||
tags:
|
||||
- organization
|
||||
parameters:
|
||||
- $ref: '#/components/parameters/PageLimit'
|
||||
- $ref: '#/components/parameters/PageCursor'
|
||||
responses:
|
||||
'200':
|
||||
description: A page of the organizations available to the current account.
|
||||
headers:
|
||||
Cache-Control:
|
||||
$ref: '#/components/headers/CacheControlNoStore'
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/MyOrganizationList'
|
||||
examples:
|
||||
one_organization:
|
||||
$ref: '#/components/examples/MyOrganizationListPage'
|
||||
'400':
|
||||
$ref: '#/components/responses/ValidationFailed'
|
||||
'401':
|
||||
$ref: '#/components/responses/Unauthenticated'
|
||||
'403':
|
||||
$ref: '#/components/responses/Forbidden'
|
||||
default:
|
||||
$ref: '#/components/responses/Problem'
|
||||
/api/v1/organizations:
|
||||
post:
|
||||
operationId: CreateOrganization
|
||||
summary: Create an organization; the caller becomes its owner.
|
||||
description: |-
|
||||
Requires the session cookie of an employer account with a confirmed email, the CSRF token of that session in X-CSRF-Token, an allowed Origin, and an Idempotency-Key. The owner is the account of the session: the body has no owner, membership, role, verification, or version field, and unknown fields fail validation.
|
||||
|
||||
The server creates the organization and the owner membership of the caller (role `owner`, state `active`) in one transaction, so an organization never exists without its owner. The organization starts at the verification level `e0` with the basis `confirmed_email`. The level cannot be requested: the creator of a company with a corporate domain, a long description, or many representatives still gets `e0`, and `e1`, `e2`, and `e3` come only from verification processes of the server that do not exist yet. Only `name` is required; the rest of the card can be completed with UpdateOrganization.
|
||||
|
||||
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 organization. A different body with the same key answers 422 idempotency_key_reused. 400 is never stored, so a corrected retry is evaluated again. Two requests with different keys are two organizations; the product may limit the number of organizations per account (open question), which would answer 409 `state_conflict` without a change of the schema.
|
||||
|
||||
Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400), account scenario (403 forbidden for a candidate account), the Idempotency-Key (422, 409 idempotency_in_progress, replay), domain rules (400 with a pointer such as `/contacts/website` for a website that is not an https URL of a host name, `/name` for a name with surrounding whitespace). The general rate limit can answer 429 with Retry-After before any check; 429 is never stored.
|
||||
security:
|
||||
- sessionCookie: []
|
||||
sessionCsrf: []
|
||||
tags:
|
||||
- organization
|
||||
parameters:
|
||||
- $ref: '#/components/parameters/IdempotencyKey'
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/OrganizationCreate'
|
||||
examples:
|
||||
name_only:
|
||||
$ref: '#/components/examples/OrganizationCreateNameOnly'
|
||||
complete_card:
|
||||
$ref: '#/components/examples/OrganizationCreateCompleteCard'
|
||||
responses:
|
||||
'201':
|
||||
description: The organization was created with the caller as its owner, or a retry with the same Idempotency-Key replayed its creation.
|
||||
headers:
|
||||
Cache-Control:
|
||||
$ref: '#/components/headers/CacheControlNoStore'
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Organization'
|
||||
examples:
|
||||
name_only:
|
||||
$ref: '#/components/examples/OrganizationNameOnly'
|
||||
complete_card:
|
||||
$ref: '#/components/examples/OrganizationCompleteCard'
|
||||
'400':
|
||||
$ref: '#/components/responses/OrganizationValidationFailed'
|
||||
'401':
|
||||
$ref: '#/components/responses/Unauthenticated'
|
||||
'403':
|
||||
$ref: '#/components/responses/CsrfCheckFailedOrForbidden'
|
||||
'409':
|
||||
$ref: '#/components/responses/IdempotencyInProgress'
|
||||
'422':
|
||||
$ref: '#/components/responses/UnprocessableContent'
|
||||
'429':
|
||||
$ref: '#/components/responses/TooManyRequests'
|
||||
default:
|
||||
$ref: '#/components/responses/Problem'
|
||||
/api/v1/organizations/{org_id}:
|
||||
get:
|
||||
operationId: GetOrganization
|
||||
summary: Read an organization of which the caller is a member.
|
||||
description: |-
|
||||
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.
|
||||
|
||||
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 holds: it never rises because the profile is complete, because the organization has members, or 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.
|
||||
security:
|
||||
- sessionCookie: []
|
||||
tags:
|
||||
- organization
|
||||
parameters:
|
||||
- $ref: '#/components/parameters/OrganizationId'
|
||||
responses:
|
||||
'200':
|
||||
description: The organization.
|
||||
headers:
|
||||
Cache-Control:
|
||||
$ref: '#/components/headers/CacheControlNoStore'
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Organization'
|
||||
examples:
|
||||
name_only:
|
||||
$ref: '#/components/examples/OrganizationNameOnly'
|
||||
complete_card:
|
||||
$ref: '#/components/examples/OrganizationCompleteCard'
|
||||
'400':
|
||||
$ref: '#/components/responses/ValidationFailed'
|
||||
'401':
|
||||
$ref: '#/components/responses/Unauthenticated'
|
||||
'403':
|
||||
$ref: '#/components/responses/Forbidden'
|
||||
'404':
|
||||
$ref: '#/components/responses/NotFound'
|
||||
default:
|
||||
$ref: '#/components/responses/Problem'
|
||||
patch:
|
||||
operationId: UpdateOrganization
|
||||
summary: Change the profile of an organization.
|
||||
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. Only the owner manages the organization (the FR07 matrix gives this to no other role), so a member with another role answers 403 forbidden. The role comes from the server-side membership; the body has no organization, membership, role, owner, or verification field.
|
||||
|
||||
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; `contacts` and `representatives` are replaced entirely and never merged. `description` and `sphere` sent as null become unset; `name`, `contacts`, and `representatives` cannot be null.
|
||||
|
||||
The body can change the profile only. The verification level, its basis, the card, the members, and every role are not fields of it, and unknown fields fail validation, so the owner can neither raise the trust level of the organization nor the rights of anyone by editing the profile; a longer description, a verified-looking website, or a new representative leaves the level unchanged. The level and the roles change only through processes of the server.
|
||||
|
||||
Versions: every committed change creates version `expected_version + 1` and answers 200 with the organization. `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 organization again and reapplies its 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 needs. A body that changes nothing when applied to the current profile keeps the version and answers 200 with the current organization even when `expected_version` is older, so the operation needs no Idempotency-Key and a retry of a change that already succeeded is harmless.
|
||||
|
||||
Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400), account scenario (403 forbidden for a candidate account), membership (404 not_found) and role (403 forbidden), a body that changes nothing (200), the version (412), domain rules (400 with a pointer such as `/contacts/website`, `/name`, or `/representatives/0/job_title`). The general rate limit can answer 429 with Retry-After before any check.
|
||||
security:
|
||||
- sessionCookie: []
|
||||
sessionCsrf: []
|
||||
tags:
|
||||
- organization
|
||||
parameters:
|
||||
- $ref: '#/components/parameters/OrganizationId'
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/OrganizationUpdate'
|
||||
examples:
|
||||
complete_card:
|
||||
$ref: '#/components/examples/OrganizationUpdateCompleteCard'
|
||||
responses:
|
||||
'200':
|
||||
description: The organization after the change, or the current organization when the body changes nothing.
|
||||
headers:
|
||||
Cache-Control:
|
||||
$ref: '#/components/headers/CacheControlNoStore'
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Organization'
|
||||
examples:
|
||||
complete_card:
|
||||
$ref: '#/components/examples/OrganizationCompleteCard'
|
||||
'400':
|
||||
$ref: '#/components/responses/OrganizationValidationFailed'
|
||||
'401':
|
||||
$ref: '#/components/responses/Unauthenticated'
|
||||
'403':
|
||||
$ref: '#/components/responses/CsrfCheckFailedOrForbidden'
|
||||
'404':
|
||||
$ref: '#/components/responses/NotFound'
|
||||
'412':
|
||||
$ref: '#/components/responses/OrganizationVersionConflict'
|
||||
'429':
|
||||
$ref: '#/components/responses/TooManyRequests'
|
||||
default:
|
||||
$ref: '#/components/responses/Problem'
|
||||
/api/v1/organizations/{org_id}/needs:
|
||||
get:
|
||||
operationId: ListOrganizationNeeds
|
||||
@@ -5600,7 +5800,7 @@ components:
|
||||
$ref: '#/components/schemas/ContactFieldKind'
|
||||
InvitationOrganization:
|
||||
type: object
|
||||
description: Organization that sent the invitation, as the candidate sees it before deciding. The organization contract (TASK-077) adds the public card; this object only names it.
|
||||
description: Organization that sent the invitation, as the candidate sees it before deciding. The card that a candidate sees is `CandidateOrganizationCard` of the organization contract; returning it with the invitation is planned as an additive field, and this object only names the organization.
|
||||
additionalProperties: false
|
||||
required:
|
||||
- id
|
||||
@@ -6441,6 +6641,384 @@ components:
|
||||
$ref: '#/components/schemas/ConsentRecord'
|
||||
page:
|
||||
$ref: '#/components/schemas/PageInfo'
|
||||
OrganizationVersion:
|
||||
type: integer
|
||||
format: int64
|
||||
minimum: 1
|
||||
description: 'Version of the profile of an organization. Creation makes version 1, and every committed change of the profile advances it by exactly one. A change carries the version the client read as `expected_version`. Only the profile has a version: the memberships and the verification level of the organization do not advance it.'
|
||||
examples:
|
||||
- 2
|
||||
OrganizationName:
|
||||
type: string
|
||||
minLength: 1
|
||||
maxLength: 200
|
||||
pattern: ^\S(?:[^\n\r]*\S)?$
|
||||
description: Public name of the organization, for example the legal name that a candidate knows. It has no leading or trailing whitespace and no line breaks, and it is at most 200 characters because consent records keep a copy of it. Plain text; clients show it as text, never as HTML. A later rename never changes the copy that a consent record holds.
|
||||
examples:
|
||||
- ООО Пример Платежи
|
||||
OrganizationDescription:
|
||||
type: string
|
||||
minLength: 1
|
||||
maxLength: 2000
|
||||
description: What the organization does, written for candidates. It may contain line breaks; the server stores CRLF as LF, and it refuses leading and trailing whitespace and any other control character. Plain text; clients show it as text, never as HTML.
|
||||
examples:
|
||||
- Платежный сервис для малого бизнеса. Разрабатываем собственное ядро проведения платежей и интеграции с банками.
|
||||
OrganizationSphere:
|
||||
type: string
|
||||
minLength: 1
|
||||
maxLength: 100
|
||||
pattern: ^\S(?:.*\S)?$
|
||||
description: Field of business of the organization as free text, for example "Платежи и финансовые сервисы". It has no leading or trailing whitespace and no line breaks. The product has no sphere taxonomy yet; a taxonomy code would be an additive field. Plain text; clients show it as text, never as HTML.
|
||||
examples:
|
||||
- Платежи и финансовые сервисы
|
||||
OrganizationWebsite:
|
||||
type: string
|
||||
minLength: 9
|
||||
maxLength: 300
|
||||
pattern: ^https://[^\s/?#@]+(?:[/?#][^\s]*)?$
|
||||
description: 'Public website of the organization: an https URL with a host name, without credentials. The server also refuses a port, an IP address, a host name without a dot, and `localhost`. It never fetches the address.'
|
||||
examples:
|
||||
- https://payments.example.com
|
||||
OrganizationContactChannels:
|
||||
type: object
|
||||
description: Public contacts of the organization, the ones a candidate sees on its card. They are company channels, such as a careers mailbox, the website, a company phone, or a company Telegram account, and never the personal email address, phone, or messenger of an employee; personal contacts of the people of the organization stay out of this object. The server cannot tell a company address from a personal one, so the owner answers for the content, and a candidate can complain about an organization through a support case. The object is the request field and the stored value alike, so a response can be sent back unchanged; every field is required and null means not set. A change replaces the whole object, never a single field of it.
|
||||
additionalProperties: false
|
||||
required:
|
||||
- website
|
||||
- email
|
||||
- phone
|
||||
- telegram
|
||||
properties:
|
||||
website:
|
||||
oneOf:
|
||||
- $ref: '#/components/schemas/OrganizationWebsite'
|
||||
- type: 'null'
|
||||
email:
|
||||
description: Public mailbox of the organization, such as a careers address, or null. It is stored in the form it was given.
|
||||
oneOf:
|
||||
- $ref: '#/components/schemas/EmailAddress'
|
||||
- type: 'null'
|
||||
phone:
|
||||
description: Public phone number of the organization, or null.
|
||||
oneOf:
|
||||
- $ref: '#/components/schemas/ContactPhoneNumber'
|
||||
- type: 'null'
|
||||
telegram:
|
||||
description: Public Telegram account of the organization, or null.
|
||||
oneOf:
|
||||
- $ref: '#/components/schemas/ContactTelegramUsername'
|
||||
- type: 'null'
|
||||
OrganizationRepresentative:
|
||||
type: object
|
||||
description: 'A person that speaks for the organization to candidates, as the owner presents them on the card. It is presentation only: a representative is not a member of the organization, has no account link, and gains no right from being listed, and a member does not become a representative by joining. It holds no contact of the person; reaching the organization goes through its public contacts. The name is personal data of an employee that the owner publishes, so the owner must have the right to do it; see the open questions in the organization section of the API guide.'
|
||||
additionalProperties: false
|
||||
required:
|
||||
- name
|
||||
- job_title
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
minLength: 1
|
||||
maxLength: 100
|
||||
pattern: ^\S(?:.*\S)?$
|
||||
description: Name of the person as the card shows it. It has no leading or trailing whitespace and no line breaks. Plain text; clients show it as text, never as HTML.
|
||||
job_title:
|
||||
type: string
|
||||
minLength: 1
|
||||
maxLength: 100
|
||||
pattern: ^\S(?:.*\S)?$
|
||||
description: Position of the person in the organization, for example "Руководитель по подбору". It has no leading or trailing whitespace and no line breaks. Plain text; clients show it as text, never as HTML.
|
||||
OrganizationVerificationLevel:
|
||||
type: string
|
||||
description: |-
|
||||
Trust level of an organization (PRD FR07). It limits the quotas of the organization and, in a planned mode, the access of candidates under 18; it never replaces the consent of a candidate.
|
||||
|
||||
- e0: the confirmed email of the account that created the organization. Every new organization starts here.
|
||||
- e1: a corporate email, a verified domain, and a link with the organization.
|
||||
- e2: a check of the requisites and of the authority of the person.
|
||||
- e3: a manual check or a partner status.
|
||||
|
||||
The server reports e1, e2, or e3 only after a verification process has recorded it for the organization. No request of this contract sets or raises a level, and neither does an edit of the profile, the size of the profile, the number of members, or the domain of an email address. The first slice of the product uses e0 and e1; the processes for e1, e2, and e3 do not exist yet, so a client treats every level other than e0 as unavailable until they do. Adding a level is a contract change.
|
||||
enum:
|
||||
- e0
|
||||
- e1
|
||||
- e2
|
||||
- e3
|
||||
OrganizationVerificationBasis:
|
||||
type: string
|
||||
description: |-
|
||||
Ground of the current verification level, the reason a cabinet can show next to it.
|
||||
|
||||
- confirmed_email: the confirmed email of the creating account (e0).
|
||||
- corporate_domain: a corporate email and a verified domain (e1).
|
||||
- requisites_and_authority: a check of the requisites and of the authority (e2).
|
||||
- manual_review: a manual check by the platform (e3).
|
||||
- partner_status: a partner status (e3).
|
||||
|
||||
Each level has its own bases, so a level and a basis that do not belong together never occur. Adding a value is a contract change.
|
||||
enum:
|
||||
- confirmed_email
|
||||
- corporate_domain
|
||||
- requisites_and_authority
|
||||
- manual_review
|
||||
- partner_status
|
||||
OrganizationVerification:
|
||||
type: object
|
||||
description: 'Verification level of an organization with its ground and the time it was set. It is read-only everywhere in this contract: the server sets it, and no request carries it. The scope of the check and the history of changes (PRD FR07) are planned as additive fields and a separate history with the first verification process.'
|
||||
additionalProperties: false
|
||||
required:
|
||||
- level
|
||||
- basis
|
||||
- changed_at
|
||||
properties:
|
||||
level:
|
||||
$ref: '#/components/schemas/OrganizationVerificationLevel'
|
||||
basis:
|
||||
$ref: '#/components/schemas/OrganizationVerificationBasis'
|
||||
changed_at:
|
||||
description: Moment the level was set to its current value; for a new organization, the creation time.
|
||||
allOf:
|
||||
- $ref: '#/components/schemas/Timestamp'
|
||||
CandidateOrganizationCard:
|
||||
type: object
|
||||
description: 'The card of an organization as a candidate sees it: what an invitation shows before the candidate decides. The server builds it from the profile and the verification level and returns it to the owner as the preview of PRD FR07 ("through the eyes of the candidate"); a client never sends it. It holds no membership, no role, no account, no version, and no ground of the verification: a member''s email address, the number of members, and the history of the organization stay out of it. The card is the same object that the candidate side will return (planned in the invitation contract). Only a candidate who received an invitation from the organization sees it; it is not a public page, and no operation shows it to anyone else until the open question about publishing the names of representatives is decided (152-FZ). The server may leave `representatives` out, and a card without them means that the representatives are not published, not that the organization has none.'
|
||||
additionalProperties: false
|
||||
required:
|
||||
- id
|
||||
- name
|
||||
- description
|
||||
- sphere
|
||||
- contacts
|
||||
- verification_level
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
format: uuid
|
||||
description: Identifier of the organization.
|
||||
name:
|
||||
$ref: '#/components/schemas/OrganizationName'
|
||||
description:
|
||||
description: Description of the organization, or null.
|
||||
oneOf:
|
||||
- $ref: '#/components/schemas/OrganizationDescription'
|
||||
- type: 'null'
|
||||
sphere:
|
||||
description: Field of business of the organization, or null.
|
||||
oneOf:
|
||||
- $ref: '#/components/schemas/OrganizationSphere'
|
||||
- type: 'null'
|
||||
contacts:
|
||||
$ref: '#/components/schemas/OrganizationContactChannels'
|
||||
representatives:
|
||||
type:
|
||||
- array
|
||||
- 'null'
|
||||
maxItems: 10
|
||||
description: Representatives in the order the owner gave them. Absent or null means that they are not published on this card, which says nothing about whether the organization has any.
|
||||
items:
|
||||
$ref: '#/components/schemas/OrganizationRepresentative'
|
||||
verification_level:
|
||||
$ref: '#/components/schemas/OrganizationVerificationLevel'
|
||||
Organization:
|
||||
type: object
|
||||
description: 'Organization as its members read it: the profile that the owner edits, the verification level that only the server sets, and the card that a candidate sees. It never contains a role, a membership, the members of the organization, or an account identifier, so no field of it can raise a right: the role of the caller is in `OrganizationMembership` and comes only from the membership held by the server. The profile fields repeat in `candidate_card`, which is the candidate''s view of them; the client reads the profile fields for the form and `candidate_card` for the preview.'
|
||||
additionalProperties: false
|
||||
required:
|
||||
- id
|
||||
- version
|
||||
- name
|
||||
- description
|
||||
- sphere
|
||||
- contacts
|
||||
- representatives
|
||||
- verification
|
||||
- candidate_card
|
||||
- created_at
|
||||
- updated_at
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
format: uuid
|
||||
description: Identifier of the organization, the `org_id` of every organization-scoped path. It never changes.
|
||||
version:
|
||||
$ref: '#/components/schemas/OrganizationVersion'
|
||||
name:
|
||||
$ref: '#/components/schemas/OrganizationName'
|
||||
description:
|
||||
description: Description of the organization, or null.
|
||||
oneOf:
|
||||
- $ref: '#/components/schemas/OrganizationDescription'
|
||||
- type: 'null'
|
||||
sphere:
|
||||
description: Field of business of the organization, or null.
|
||||
oneOf:
|
||||
- $ref: '#/components/schemas/OrganizationSphere'
|
||||
- type: 'null'
|
||||
contacts:
|
||||
$ref: '#/components/schemas/OrganizationContactChannels'
|
||||
representatives:
|
||||
type: array
|
||||
maxItems: 10
|
||||
description: Representatives in the order the owner gave them.
|
||||
items:
|
||||
$ref: '#/components/schemas/OrganizationRepresentative'
|
||||
verification:
|
||||
$ref: '#/components/schemas/OrganizationVerification'
|
||||
candidate_card:
|
||||
$ref: '#/components/schemas/CandidateOrganizationCard'
|
||||
created_at:
|
||||
$ref: '#/components/schemas/Timestamp'
|
||||
updated_at:
|
||||
$ref: '#/components/schemas/Timestamp'
|
||||
OrganizationCreate:
|
||||
type: object
|
||||
description: New organization. Only `name` is required, so a company can start with its name and complete the card later. The creating account becomes the owner of the organization; the body has no field for a role, a membership, an owner, a verification level, or a version, and unknown fields are rejected, so a request cannot set any of them. An absent `description` or `sphere`, and one sent as null, stay unset; an absent `contacts` has every contact unset; an absent `representatives` is an empty list.
|
||||
additionalProperties: false
|
||||
required:
|
||||
- name
|
||||
properties:
|
||||
name:
|
||||
$ref: '#/components/schemas/OrganizationName'
|
||||
description:
|
||||
oneOf:
|
||||
- $ref: '#/components/schemas/OrganizationDescription'
|
||||
- type: 'null'
|
||||
sphere:
|
||||
oneOf:
|
||||
- $ref: '#/components/schemas/OrganizationSphere'
|
||||
- type: 'null'
|
||||
contacts:
|
||||
$ref: '#/components/schemas/OrganizationContactChannels'
|
||||
representatives:
|
||||
type: array
|
||||
maxItems: 10
|
||||
items:
|
||||
$ref: '#/components/schemas/OrganizationRepresentative'
|
||||
OrganizationUpdate:
|
||||
type: object
|
||||
description: Change of the profile of an organization over the version the client read. Each field present replaces that field as a whole and an absent field stays unchanged; `contacts` and `representatives` are replaced entirely and never merged, and a representative left out of a sent list is removed. `description` and `sphere` sent as null become unset; `name`, `contacts`, and `representatives` cannot be null. The body can change the profile only. It has no field for a role, a membership, an owner, a verification level, a basis, or a card, and unknown fields are rejected, so editing the profile can neither raise a right nor raise the trust level of the organization; both change only through processes of the server.
|
||||
additionalProperties: false
|
||||
required:
|
||||
- expected_version
|
||||
properties:
|
||||
expected_version:
|
||||
$ref: '#/components/schemas/OrganizationVersion'
|
||||
name:
|
||||
$ref: '#/components/schemas/OrganizationName'
|
||||
description:
|
||||
oneOf:
|
||||
- $ref: '#/components/schemas/OrganizationDescription'
|
||||
- type: 'null'
|
||||
sphere:
|
||||
oneOf:
|
||||
- $ref: '#/components/schemas/OrganizationSphere'
|
||||
- type: 'null'
|
||||
contacts:
|
||||
$ref: '#/components/schemas/OrganizationContactChannels'
|
||||
representatives:
|
||||
type: array
|
||||
maxItems: 10
|
||||
items:
|
||||
$ref: '#/components/schemas/OrganizationRepresentative'
|
||||
OrganizationRole:
|
||||
type: string
|
||||
description: |-
|
||||
Role of a member in an organization (PRD 2.2 and the FR07 matrix). The role belongs to the membership, never to the organization or to any editable profile.
|
||||
|
||||
- owner: manages the organization and its members, and acts on behalf of the company.
|
||||
- recruiter: leads the selection of candidates for all needs.
|
||||
- hiring_manager: acts on the needs assigned to the member.
|
||||
- technical_expert: refines the requirements of the assigned needs; reads no contacts and sends no invitations.
|
||||
|
||||
In the MVP only the owner acts, so the other roles grant nothing yet: an operation that is not open to a role answers 403 `forbidden`. The full matrix is planned, and applying it changes no field of this contract. Adding a role is a contract change.
|
||||
enum:
|
||||
- owner
|
||||
- recruiter
|
||||
- hiring_manager
|
||||
- technical_expert
|
||||
MembershipState:
|
||||
type: string
|
||||
description: |-
|
||||
State of a membership. Only `active` gives access: every other state answers as if the account were no member.
|
||||
|
||||
- active: the member works in the organization with the role.
|
||||
- suspended: access is stopped, and the owner or the platform may restore it.
|
||||
- removed: the owner or the platform ended the membership. A removal by the platform is not undone by the owner or by an invitation: the acceptance of an employee invitation and the member management (TASK-082, TASK-084) must not reactivate it on their own. Who removed the member and why become additive fields of the member management.
|
||||
- left: the member ended the membership.
|
||||
|
||||
One account has at most one membership per organization, so a former member who returns gets the same membership back in `active`, and the history of the pair is the history of its audit events (planned). The listing of this contract returns only `active` memberships; the other states are listed now so that generated clients accept them when the member management reads them. Adding a state is a contract change.
|
||||
enum:
|
||||
- active
|
||||
- suspended
|
||||
- removed
|
||||
- left
|
||||
OrganizationMembership:
|
||||
type: object
|
||||
description: The membership of the caller in one organization. The caller is the account of the session, so the object holds no account identifier. Only the server sets the role and the state, through the operations that manage members, which are planned; no operation of this contract changes them.
|
||||
additionalProperties: false
|
||||
required:
|
||||
- organization_id
|
||||
- role
|
||||
- state
|
||||
- joined_at
|
||||
properties:
|
||||
organization_id:
|
||||
type: string
|
||||
format: uuid
|
||||
description: Identifier of the organization.
|
||||
role:
|
||||
$ref: '#/components/schemas/OrganizationRole'
|
||||
state:
|
||||
$ref: '#/components/schemas/MembershipState'
|
||||
joined_at:
|
||||
description: Moment the membership was first created. A member who left and returns keeps the same value, because the pair has one membership; the moment of the latest activation is a planned additive field (`activated_at`, TASK-082).
|
||||
allOf:
|
||||
- $ref: '#/components/schemas/Timestamp'
|
||||
OrganizationSummary:
|
||||
type: object
|
||||
description: 'An organization in the list of the caller''s organizations: what a switcher needs to name it. The profile, the contacts, and the representatives are in `Organization`.'
|
||||
additionalProperties: false
|
||||
required:
|
||||
- id
|
||||
- name
|
||||
- verification_level
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
format: uuid
|
||||
description: Identifier of the organization, the `org_id` of its paths.
|
||||
name:
|
||||
$ref: '#/components/schemas/OrganizationName'
|
||||
verification_level:
|
||||
$ref: '#/components/schemas/OrganizationVerificationLevel'
|
||||
MyOrganization:
|
||||
type: object
|
||||
description: An organization available to the caller together with the caller's membership in it.
|
||||
additionalProperties: false
|
||||
required:
|
||||
- organization
|
||||
- membership
|
||||
properties:
|
||||
organization:
|
||||
$ref: '#/components/schemas/OrganizationSummary'
|
||||
membership:
|
||||
$ref: '#/components/schemas/OrganizationMembership'
|
||||
MyOrganizationList:
|
||||
type: object
|
||||
description: One page of the organizations available to the caller, newest membership first. It holds only organizations where the caller has an `active` membership, so it is also the list of contexts the caller can work in; it never names an organization the caller cannot enter.
|
||||
additionalProperties: false
|
||||
required:
|
||||
- items
|
||||
- page
|
||||
properties:
|
||||
items:
|
||||
type: array
|
||||
maxItems: 100
|
||||
description: Organizations of the page.
|
||||
items:
|
||||
$ref: '#/components/schemas/MyOrganization'
|
||||
page:
|
||||
$ref: '#/components/schemas/PageInfo'
|
||||
HealthResponse:
|
||||
type: object
|
||||
additionalProperties: false
|
||||
@@ -7003,6 +7581,30 @@ components:
|
||||
$ref: '#/components/examples/InvitationSendBlocked'
|
||||
idempotency_in_progress:
|
||||
$ref: '#/components/examples/IdempotencyInProgress'
|
||||
OrganizationValidationFailed:
|
||||
description: 'The body does not match the contract or violates an organization rule: a missing name, an unknown field such as role, verification_level, verification, members, owner, or version, a name or sphere with surrounding whitespace or a line break, a website that is not an https URL of a host name, a phone number outside E.164, a Telegram username without the leading @, a contact that has no valid form, more than ten representatives, or a missing or invalid expected_version; code validation_failed with body pointers. A missing nested field has its own pointer with the code required; an unknown field points at the object that contains it, a failure inside an array element points at the array, and only a malformed document, an unknown top-level field, or an unknown top-level variant points at the whole body. Nothing was changed, and the outcome is not stored under an Idempotency-Key.'
|
||||
content:
|
||||
application/problem+json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Problem'
|
||||
examples:
|
||||
role_sent_by_client:
|
||||
$ref: '#/components/examples/OrganizationUnknownField'
|
||||
website_not_https:
|
||||
$ref: '#/components/examples/OrganizationWebsiteNotHttps'
|
||||
name_with_surrounding_whitespace:
|
||||
$ref: '#/components/examples/OrganizationNameWithWhitespace'
|
||||
missing_expected_version:
|
||||
$ref: '#/components/examples/OrganizationMissingExpectedVersion'
|
||||
OrganizationVersionConflict:
|
||||
description: '`expected_version` is not the current version of the organization; code version_conflict. Nothing was changed; read the organization again before retrying.'
|
||||
content:
|
||||
application/problem+json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Problem'
|
||||
examples:
|
||||
version_conflict:
|
||||
$ref: '#/components/examples/OrganizationStaleVersion'
|
||||
securitySchemes:
|
||||
sessionCookie:
|
||||
type: apiKey
|
||||
@@ -8303,6 +8905,205 @@ components:
|
||||
code: state_conflict
|
||||
detail: The resource is in a state that does not allow this operation.
|
||||
trace_id: 4e5f6a7b-8c9d-4e0f-9a1b-2c3d4e5f6a7b
|
||||
MyOrganizationListPage:
|
||||
summary: The organizations of an owner who works in two companies
|
||||
description: The caller has an active membership in both organizations, newest first. A third organization, where the caller left, is not listed.
|
||||
value:
|
||||
items:
|
||||
- organization:
|
||||
id: 01928f7a-4d5e-7f6a-8b7c-9d0e1f2a3b4c
|
||||
name: ИП Тестов Логистика
|
||||
verification_level: e0
|
||||
membership:
|
||||
organization_id: 01928f7a-4d5e-7f6a-8b7c-9d0e1f2a3b4c
|
||||
role: owner
|
||||
state: active
|
||||
joined_at: '2026-10-06T11:30:00Z'
|
||||
- organization:
|
||||
id: 01928f7a-1a2b-7c3d-8e4f-5a6b7c8d9e01
|
||||
name: ООО Пример Платежи
|
||||
verification_level: e0
|
||||
membership:
|
||||
organization_id: 01928f7a-1a2b-7c3d-8e4f-5a6b7c8d9e01
|
||||
role: owner
|
||||
state: active
|
||||
joined_at: '2026-10-06T09:00:00Z'
|
||||
page:
|
||||
has_more: false
|
||||
next_cursor: null
|
||||
OrganizationCreateNameOnly:
|
||||
summary: A company that starts with its name only
|
||||
description: Only the name is required; the card is completed later with UpdateOrganization.
|
||||
value:
|
||||
name: ООО Пример Платежи
|
||||
OrganizationCreateCompleteCard:
|
||||
summary: A company that gives its whole card at creation
|
||||
description: Every contact is a company channel, and the representative is presentation only. There is no field for a role or a verification level.
|
||||
value:
|
||||
name: ООО Пример Платежи
|
||||
description: Платежный сервис для малого бизнеса. Разрабатываем собственное ядро проведения платежей и интеграции с банками.
|
||||
sphere: Платежи и финансовые сервисы
|
||||
contacts:
|
||||
website: https://payments.example.com
|
||||
email: careers@payments.example.com
|
||||
phone: '+74950000000'
|
||||
telegram: '@payments_careers'
|
||||
representatives:
|
||||
- name: Анна Тестова
|
||||
job_title: Руководитель по подбору
|
||||
OrganizationNameOnly:
|
||||
summary: A new organization that has only a name
|
||||
description: The creator is the owner of the organization, which starts at the verification level e0 on the ground of the confirmed email. The card repeats the profile as a candidate sees it.
|
||||
value:
|
||||
id: 01928f7a-1a2b-7c3d-8e4f-5a6b7c8d9e01
|
||||
version: 1
|
||||
name: ООО Пример Платежи
|
||||
description: null
|
||||
sphere: null
|
||||
contacts:
|
||||
website: null
|
||||
email: null
|
||||
phone: null
|
||||
telegram: null
|
||||
representatives: []
|
||||
verification:
|
||||
level: e0
|
||||
basis: confirmed_email
|
||||
changed_at: '2026-10-06T09:00:00Z'
|
||||
candidate_card:
|
||||
id: 01928f7a-1a2b-7c3d-8e4f-5a6b7c8d9e01
|
||||
name: ООО Пример Платежи
|
||||
description: null
|
||||
sphere: null
|
||||
contacts:
|
||||
website: null
|
||||
email: null
|
||||
phone: null
|
||||
telegram: null
|
||||
representatives: []
|
||||
verification_level: e0
|
||||
created_at: '2026-10-06T09:00:00Z'
|
||||
updated_at: '2026-10-06T09:00:00Z'
|
||||
OrganizationCompleteCard:
|
||||
summary: An organization with a complete card, still at the level e0
|
||||
description: Completing the card, adding contacts, and listing representatives did not raise the verification level, which stays e0 and changes only through a verification process of the server.
|
||||
value:
|
||||
id: 01928f7a-1a2b-7c3d-8e4f-5a6b7c8d9e01
|
||||
version: 2
|
||||
name: ООО Пример Платежи
|
||||
description: Платежный сервис для малого бизнеса. Разрабатываем собственное ядро проведения платежей и интеграции с банками.
|
||||
sphere: Платежи и финансовые сервисы
|
||||
contacts:
|
||||
website: https://payments.example.com
|
||||
email: careers@payments.example.com
|
||||
phone: '+74950000000'
|
||||
telegram: '@payments_careers'
|
||||
representatives:
|
||||
- name: Анна Тестова
|
||||
job_title: Руководитель по подбору
|
||||
verification:
|
||||
level: e0
|
||||
basis: confirmed_email
|
||||
changed_at: '2026-10-06T09:00:00Z'
|
||||
candidate_card:
|
||||
id: 01928f7a-1a2b-7c3d-8e4f-5a6b7c8d9e01
|
||||
name: ООО Пример Платежи
|
||||
description: Платежный сервис для малого бизнеса. Разрабатываем собственное ядро проведения платежей и интеграции с банками.
|
||||
sphere: Платежи и финансовые сервисы
|
||||
contacts:
|
||||
website: https://payments.example.com
|
||||
email: careers@payments.example.com
|
||||
phone: '+74950000000'
|
||||
telegram: '@payments_careers'
|
||||
representatives:
|
||||
- name: Анна Тестова
|
||||
job_title: Руководитель по подбору
|
||||
verification_level: e0
|
||||
created_at: '2026-10-06T09:00:00Z'
|
||||
updated_at: '2026-10-06T09:40:00Z'
|
||||
OrganizationUnknownField:
|
||||
summary: The client sent a role together with the profile
|
||||
description: A role, an owner, a verification level, and a list of members are never request fields; any unknown field fails validation, and an unknown top-level field points at the whole body.
|
||||
value:
|
||||
type: urn:lincodex:problem:validation_failed
|
||||
title: Request validation failed
|
||||
status: 400
|
||||
code: validation_failed
|
||||
detail: One or more request fields are invalid.
|
||||
trace_id: 1e2f3a4b-5c6d-4e7f-8a9b-0c1d2e3f4a5c
|
||||
errors:
|
||||
- in: body
|
||||
pointer: ''
|
||||
code: invalid
|
||||
message: The value does not match the contract.
|
||||
OrganizationWebsiteNotHttps:
|
||||
summary: The website is not an https URL of a host name
|
||||
description: A domain rule of the server, checked after the schema. The schema already refuses a value that is not an https URL; the server also refuses a port, an IP address, and a host name without a dot.
|
||||
value:
|
||||
type: urn:lincodex:problem:validation_failed
|
||||
title: Request validation failed
|
||||
status: 400
|
||||
code: validation_failed
|
||||
detail: One or more request fields are invalid.
|
||||
trace_id: 2f3a4b5c-6d7e-4f8a-9b0c-1d2e3f4a5b6d
|
||||
errors:
|
||||
- in: body
|
||||
pointer: /contacts/website
|
||||
code: invalid
|
||||
message: The value does not match the contract.
|
||||
OrganizationNameWithWhitespace:
|
||||
summary: The name has leading whitespace
|
||||
value:
|
||||
type: urn:lincodex:problem:validation_failed
|
||||
title: Request validation failed
|
||||
status: 400
|
||||
code: validation_failed
|
||||
detail: One or more request fields are invalid.
|
||||
trace_id: 3a4b5c6d-7e8f-4a9b-8c1d-2e3f4a5b6c7e
|
||||
errors:
|
||||
- in: body
|
||||
pointer: /name
|
||||
code: invalid
|
||||
message: The value does not match the contract.
|
||||
OrganizationMissingExpectedVersion:
|
||||
summary: A change without expected_version
|
||||
value:
|
||||
type: urn:lincodex:problem:validation_failed
|
||||
title: Request validation failed
|
||||
status: 400
|
||||
code: validation_failed
|
||||
detail: One or more request fields are invalid.
|
||||
trace_id: 4b5c6d7e-8f9a-4b0c-9d2e-3f4a5b6c7d8f
|
||||
errors:
|
||||
- in: body
|
||||
pointer: /expected_version
|
||||
code: required
|
||||
message: The value is required.
|
||||
OrganizationUpdateCompleteCard:
|
||||
summary: The owner completes the card of the organization
|
||||
description: The change carries the version that the client read and the fields to replace; contacts and representatives are replaced as a whole. The body has no role or verification field.
|
||||
value:
|
||||
expected_version: 1
|
||||
description: Платежный сервис для малого бизнеса. Разрабатываем собственное ядро проведения платежей и интеграции с банками.
|
||||
sphere: Платежи и финансовые сервисы
|
||||
contacts:
|
||||
website: https://payments.example.com
|
||||
email: careers@payments.example.com
|
||||
phone: '+74950000000'
|
||||
telegram: '@payments_careers'
|
||||
representatives:
|
||||
- name: Анна Тестова
|
||||
job_title: Руководитель по подбору
|
||||
OrganizationStaleVersion:
|
||||
summary: The change carried a stale expected_version
|
||||
description: Another member changed the organization after the client read it. Nothing was changed; the client reads the organization again and reapplies its edits.
|
||||
value:
|
||||
type: urn:lincodex:problem:version_conflict
|
||||
title: Resource version conflict
|
||||
status: 412
|
||||
code: version_conflict
|
||||
detail: The resource changed after it was read. Read it again before retrying.
|
||||
trace_id: 5c6d7e8f-9a0b-4c1d-8e3f-4a5b6c7d8e90
|
||||
NeedListPage:
|
||||
summary: The last page of the needs of an organization
|
||||
value:
|
||||
|
||||
Reference in new issue
Block a user