feat(invitations): accept invitations with C4 consent and contact grants; share the E0 quota across holdings
This commit is contained in:
1 parent
a5990d3fc6
commit
676b3c6e24
59 files changed
+4926
-194
No files matched your search
+4
-3
@@ -459,7 +459,7 @@ Planned contract changes (new enum values; like the catalog codes, generated cli
|
||||
|
||||
### Invitations and contact grants
|
||||
|
||||
The `invitation` tag covers invitations from an organization to one candidate (PRD FR12, with the salary rules of FR13 and the consent C4): drafts with complete terms, immutable terms versions, sending, the candidate's inbox, the view, acceptance with C4, structured declines, withdrawal, cancellation, and the contact grant. The organization side of the draft is implemented: `ListOrganizationInvitations`, `CreateOrganizationInvitation`, `GetOrganizationInvitation`, and `UpdateOrganizationInvitation` follow the rules below, except that `salary_fit` is always `not_available` and the salary limit and the withheld counter are not enforced yet ([backend](../backend/README.en.md#invitation-drafts)). `SendOrganizationInvitation` and `ListMyInvitations` are implemented as well: the send checks the owner, the key, the version, the state, and the current visibility of the candidate and charges the weekly organization quota, while the pending limit of a need and the 30-day pause are not checked yet; a success means the invitation is already in `ListMyInvitations`, and the notification and the email follow through the outbox ([architecture](../docs/en/ARCHITECTURE.md#sending-invitations)). `GetMyInvitation`, `ViewMyInvitation`, and `DeclineMyInvitation` are implemented as described below, with two limits until the related operations exist: no read or command applies the due expiry, so a view at the deadline or later changes nothing and a late decline answers 409 `state_conflict` while the state stays `delivered` or `viewed`; and `contact_consent` and `contact_grant` are always null, because an acceptance is impossible before `AcceptMyInvitation` is implemented ([architecture](../docs/en/ARCHITECTURE.md#candidate-view-and-decline)). The business logic of the other operations is not implemented: a guest answers 401 `unauthenticated`, and a request with a verified session reaches 501 `not_implemented` after request validation. Unsafe protected operations also require the session-bound CSRF token and exact Origin.
|
||||
The `invitation` tag covers invitations from an organization to one candidate (PRD FR12, with the salary rules of FR13 and the consent C4): drafts with complete terms, immutable terms versions, sending, the candidate's inbox, the view, acceptance with C4, structured declines, withdrawal, cancellation, and the contact grant. The organization side of the draft is implemented: `ListOrganizationInvitations`, `CreateOrganizationInvitation`, `GetOrganizationInvitation`, and `UpdateOrganizationInvitation` follow the rules below, except that `salary_fit` is always `not_available` and the salary limit and the withheld counter are not enforced yet ([backend](../backend/README.en.md#invitation-drafts)). `SendOrganizationInvitation` and `ListMyInvitations` are implemented as well: the send checks the owner, the key, the version, the state, and the current visibility of the candidate and charges the weekly organization quota, while the pending limit of a need and the 30-day pause are not checked yet; a success means the invitation is already in `ListMyInvitations`, and the notification and the email follow through the outbox ([architecture](../docs/en/ARCHITECTURE.md#sending-invitations)). `GetMyInvitation`, `ViewMyInvitation`, and `DeclineMyInvitation` are implemented as described below, with two limits until the related operations exist: no read or command applies the due expiry, so a view at the deadline or later changes nothing and a late decline answers 409 `state_conflict` while the state stays `delivered` or `viewed`; a declined invitation has `contact_consent` and `contact_grant` null. `AcceptMyInvitation` is implemented as the rules below describe, but the contact read and the revocation of a grant are not implemented yet ([architecture](../docs/en/ARCHITECTURE.md#candidate-acceptance)). The business logic of the other operations is not implemented: a guest answers 401 `unauthenticated`, and a request with a verified session reaches 501 `not_implemented` after request validation. Unsafe protected operations also require the session-bound CSRF token and exact Origin.
|
||||
|
||||
| Method and path | operationId | Security | Success | Specific errors |
|
||||
| --- | --- | --- | --- | --- |
|
||||
@@ -623,11 +623,12 @@ Foreign keys to organizations: `memberships` and `organization_representatives`
|
||||
Open questions for the product owner:
|
||||
|
||||
- Representatives: may the card show their names to every candidate before an invitation is accepted, and who answers for the right to publish an employee's name (152-FZ)? The alternative is to show representatives only in an invitation sent by their organization.
|
||||
- Organizations per account (blocking for organization creation and quota enforcement): the PRD sets no limit, and FR07 says that quotas belong to the organization as a whole and never grow on their own, but nothing stops one account from creating many organizations, each at `e0` with its own quota, which multiplies the quotas. This contract invents no number. The mechanism is ready: a cap would answer 409 `state_conflict` on `CreateOrganization` without a change of the schema, and the anti-abuse signals belong to organization risk assessment. The owner must decide the limit, or accept the risk explicitly, before the organization quotas are enforced and before `CreateOrganization` is opened to users.
|
||||
- Sphere: free text now; a taxonomy for the sphere, matching the domains of needs, is a decision for the search filters.
|
||||
- Contacts: whether the card needs a fifth kind, such as a careers page, and whether the email must share the domain of the website.
|
||||
|
||||
Planned, additive: member invitations, listing, role changes, and removal, the full role matrix, the verification processes and their history, the quotas by level, the card in the candidate's invitation, the number-of-organizations cap, and a sphere code.
|
||||
Decided by the product owner: organizations per account are not limited. The organizations of one account form a holding, and the E0 quotas (in the demo policy 10 invitations per 7 days and 50 distinct card views per 24 hours) are shared by the E0 organizations of that holding; an organization at E1 and above counts its own quotas. The contract does not change: the holding is internal and no operation exposes it.
|
||||
|
||||
Planned, additive: member invitations, listing, role changes, and removal, the full role matrix, the verification processes and their history, the quotas by level, the card in the candidate's invitation, and a sphere code.
|
||||
|
||||
No new problem code is added: the contract reuses `validation_failed`, `unauthenticated`, `forbidden`, `csrf_check_failed`, `not_found`, `version_conflict`, `idempotency_in_progress`, `idempotency_key_reused`, and `rate_limited`. `TestOrganizationSchemaValidationPrecedesImplementation`, `TestOrganizationAccessBeforeImplementation`, `TestOrganizationDTOsCarryNoRoleOrVerificationInTheirRequests`, `TestOrganizationUpdateDecodingKeepsAbsentAndEmptyListsApart`, and `TestOrganizationContractFollowsThePRD` pin the generated server and the bundle, and `frontend/src/shared/api/organization-contract.test.ts` pins the generated Zod rules and, at the type level, the absence of role, owner, member, and verification fields in the requests.
|
||||
|
||||
|
||||
+4
-3
@@ -459,7 +459,7 @@ ML-сервис отвечает на ошибки той же схемой `Pro
|
||||
|
||||
### Приглашения и контактные разрешения
|
||||
|
||||
Тег `invitation` описывает приглашения организации одному кандидату (FR12 в PRD, с правилами вилки FR13 и согласием C4): черновики с полными условиями, неизменяемые версии условий, отправку, входящие кандидата, просмотр, принятие с C4, структурированный отказ, отзыв, отмену участия и контактное разрешение (grant). Сторона организации в черновике реализована: `ListOrganizationInvitations`, `CreateOrganizationInvitation`, `GetOrganizationInvitation` и `UpdateOrganizationInvitation` следуют правилам ниже, но `salary_fit` всегда равен `not_available`, а лимит вилки и счетчик `withheld` пока не применяются ([backend](../backend/README.md#черновики-приглашений)). Реализованы также `SendOrganizationInvitation` и `ListMyInvitations`: отправка проверяет владельца, ключ, версию, состояние и текущую видимость кандидата и списывает недельную квоту организации, а предел ожидающих на потребность и 30-дневная пауза пока не проверяются; успех означает, что приглашение уже есть в `ListMyInvitations`, а уведомление и письмо идут следом через outbox ([архитектура](../docs/ru/ARCHITECTURE.md#отправка-приглашений)). `GetMyInvitation`, `ViewMyInvitation` и `DeclineMyInvitation` реализованы, как описано ниже, с двумя ограничениями до появления связанных операций: ни чтение, ни команда не применяют наступившее истечение, поэтому просмотр в момент срока и позже ничего не меняет, а опоздавший отказ отвечает 409 `state_conflict`, пока состояние остается `delivered` или `viewed`; `contact_consent` и `contact_grant` всегда null, потому что принять приглашение до реализации `AcceptMyInvitation` нельзя ([архитектура](../docs/ru/ARCHITECTURE.md#просмотр-и-отказ-кандидата)). Бизнес-логика остальных операций еще не реализована: гость получает 401 `unauthenticated`, а запрос с подтвержденной сессией достигает 501 `not_implemented` после проверки запроса. Небезопасные защищенные операции также требуют session-bound CSRF-токен и точный Origin.
|
||||
Тег `invitation` описывает приглашения организации одному кандидату (FR12 в PRD, с правилами вилки FR13 и согласием C4): черновики с полными условиями, неизменяемые версии условий, отправку, входящие кандидата, просмотр, принятие с C4, структурированный отказ, отзыв, отмену участия и контактное разрешение (grant). Сторона организации в черновике реализована: `ListOrganizationInvitations`, `CreateOrganizationInvitation`, `GetOrganizationInvitation` и `UpdateOrganizationInvitation` следуют правилам ниже, но `salary_fit` всегда равен `not_available`, а лимит вилки и счетчик `withheld` пока не применяются ([backend](../backend/README.md#черновики-приглашений)). Реализованы также `SendOrganizationInvitation` и `ListMyInvitations`: отправка проверяет владельца, ключ, версию, состояние и текущую видимость кандидата и списывает недельную квоту организации, а предел ожидающих на потребность и 30-дневная пауза пока не проверяются; успех означает, что приглашение уже есть в `ListMyInvitations`, а уведомление и письмо идут следом через outbox ([архитектура](../docs/ru/ARCHITECTURE.md#отправка-приглашений)). `GetMyInvitation`, `ViewMyInvitation` и `DeclineMyInvitation` реализованы, как описано ниже, с двумя ограничениями до появления связанных операций: ни чтение, ни команда не применяют наступившее истечение, поэтому просмотр в момент срока и позже ничего не меняет, а опоздавший отказ отвечает 409 `state_conflict`, пока состояние остается `delivered` или `viewed`; у отказанного приглашения `contact_consent` и `contact_grant` равны null. `AcceptMyInvitation` реализован, как описывают правила ниже, но чтение контактов и отзыв разрешения еще не реализованы ([архитектура](../docs/ru/ARCHITECTURE.md#принятие-кандидатом)). Бизнес-логика остальных операций еще не реализована: гость получает 401 `unauthenticated`, а запрос с подтвержденной сессией достигает 501 `not_implemented` после проверки запроса. Небезопасные защищенные операции также требуют session-bound CSRF-токен и точный Origin.
|
||||
|
||||
| Метод и путь | operationId | Защита | Успех | Конкретные ошибки |
|
||||
| --- | --- | --- | --- | --- |
|
||||
@@ -623,11 +623,12 @@ ML-сервис отвечает на ошибки той же схемой `Pro
|
||||
Открытые вопросы к владельцу продукта:
|
||||
|
||||
- Представители: может ли карточка показывать их имена любому кандидату до принятия приглашения и кто отвечает за право публиковать имя сотрудника (152-ФЗ)? Альтернатива - показывать представителей только в приглашении, отправленном их организацией.
|
||||
- Организаций на аккаунт (блокирует создание организаций и применение квот): в PRD лимита нет, а FR07 говорит, что квоты принадлежат организации целиком и сами не растут, но ничто не мешает одному аккаунту создать много организаций, каждая из которых начинает с `e0` со своей квотой, что умножает квоты. Этот контракт не придумывает число. Механизм готов: ограничение отвечало бы 409 `state_conflict` на `CreateOrganization` без изменения схемы, а сигналы против злоупотреблений относятся к оценке риска организации. Владелец продукта должен решить лимит или явно принять риск до того, как квоты организации начнут применяться и до того, как `CreateOrganization` откроют пользователям.
|
||||
- Сфера: пока свободный текст; таксономия сферы, согласованная с доменами потребностей, - решение для поисковых фильтров.
|
||||
- Контакты: нужен ли в карточке пятый вид, например страница вакансий, и должна ли почта совпадать с доменом сайта.
|
||||
|
||||
Запланировано, аддитивно: приглашения участников, список, смена ролей и удаление, полная матрица ролей, процессы проверки и их история, квоты по уровню, карточка в приглашении кандидата, ограничение числа организаций и код сферы.
|
||||
Решение владельца продукта: число организаций на аккаунт не ограничено. Организации одного аккаунта образуют холдинг, а E0-квоты (в демо-политике 10 приглашений за 7 дней и 50 уникальных просмотров карточек за 24 часа) общие для E0-организаций этого холдинга; организация на E1 и выше считает свои квоты отдельно. Контракт не меняется: холдинг внутренний, и ни одна операция его не показывает.
|
||||
|
||||
Запланировано, аддитивно: приглашения участников, список, смена ролей и удаление, полная матрица ролей, процессы проверки и их история, квоты по уровню, карточка в приглашении кандидата, и код сферы.
|
||||
|
||||
Новый код problem не добавляется: контракт использует `validation_failed`, `unauthenticated`, `forbidden`, `csrf_check_failed`, `not_found`, `version_conflict`, `idempotency_in_progress`, `idempotency_key_reused` и `rate_limited`. `TestOrganizationSchemaValidationPrecedesImplementation`, `TestOrganizationAccessBeforeImplementation`, `TestOrganizationDTOsCarryNoRoleOrVerificationInTheirRequests`, `TestOrganizationUpdateDecodingKeepsAbsentAndEmptyListsApart` и `TestOrganizationContractFollowsThePRD` закрепляют сгенерированный сервер и бандл, а `frontend/src/shared/api/organization-contract.test.ts` - сгенерированные правила Zod и, на уровне типов, отсутствие полей роли, владельца, участников и уровня проверки в запросах.
|
||||
|
||||
|
||||
Reference in new issue
Block a user