feat: add assessment, privacy and support flows
This commit is contained in:
1 parent
ee3738ee73
commit
e4f24fa202
339 files changed
+56454
-1126
No files matched your search
+31
-9
@@ -2,10 +2,10 @@
|
||||
|
||||
[Русский](README.md) | English
|
||||
|
||||
A React and TypeScript SPA built with Vite and organized using FSD. Registration, email confirmation, sign-in, consent settings, the manual candidate profile, and the company profile use the API. The cabinets share navigation and screen states; remaining business screens are connected as they are implemented.
|
||||
A React and TypeScript SPA built with Vite and organized using FSD. Registration, email confirmation, sign-in, consent settings, the candidate profile and questionnaire, candidate assessment, company profiles, employer needs, and support cases use the API. A manual assessment request creates a support case and displays its current state; the screen does not present it as an assessment result. The standalone results page, candidate directory, and employer invitations remain placeholders.
|
||||
|
||||
- `src/app/` starts the application: the route tree (`router/`), the query client (`providers/`), global styles, and the route error page.
|
||||
- `src/pages/` holds public pages, sign-in and registration, consents, the company page, technical status, and remaining screen placeholders.
|
||||
- `src/pages/` holds public pages, sign-in and registration, candidate profile and questionnaire, company and employer needs pages, support cases, technical status, and remaining placeholders.
|
||||
- `src/widgets/` holds shells: `public-shell`, `candidate-shell`, `employer-shell`, plus the technical `system-status` widget.
|
||||
- `src/entities/` holds entity models, including `need` (see [Need entity](#need-entity)) and `company`; `src/features/` holds user actions and forms.
|
||||
- `src/shared/ui/` holds design tokens, fonts, logos, and primitives; `src/shared/config/` holds route paths; `src/shared/api/` holds the API client with generated endpoints, Zod schemas, and MSW mocks.
|
||||
@@ -17,13 +17,13 @@ From the repository root, `make -C frontend dev` starts development and `make -C
|
||||
|
||||
## Routes
|
||||
|
||||
| Group | Paths | Shell |
|
||||
| --------- | ---------------------------------------------------------------------------------------------------------------------------- | ---------------- |
|
||||
| Public | `/`, `/login`, `/register`, `/verify-email`, `/support`, `/status` | `PublicShell` |
|
||||
| Candidate | `/candidate` and `/candidate/` + `onboarding`, `profile`, `questionnaire`, `assessment`, `results`, `invitations`, `privacy` | `CandidateShell` |
|
||||
| Employer | `/employer` (redirects to `/employer/company`), `/employer/` + `company`, `needs`, `candidates`, `invitations` | `EmployerShell` |
|
||||
| Group | Paths | Shell |
|
||||
| --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------- |
|
||||
| Public | `/`, `/login`, `/register`, `/verify-email`, `/support`, `/status` | `PublicShell` |
|
||||
| Candidate | `/candidate` with `onboarding`, `profile`, `questionnaire`, `assessment`, `results`, `invitations`, `privacy`, `support/cases`, `support/cases/new`, `support/cases/manual-assessment`, and `support/cases/:caseId` | `CandidateShell` |
|
||||
| Employer | `/employer` redirects to `/employer/company`; `/employer/company`, `/employer/needs`, `/employer/needs/new`, `/employer/needs/:needId`, `/employer/support/cases`, `/employer/support/cases/new`, `/employer/support/cases/:caseId` | `EmployerShell` |
|
||||
|
||||
Each group has its own not-found page. Paths are defined once in `shared/config/paths.ts`. The router uses React Router data APIs (`createBrowserRouter`): a route-level error boundary, loader redirects, and later `lazy` code splitting for cabinets. Loaders do not fetch data; server data belongs to TanStack Query. Cabinet boundaries read the current session and direct guests to sign-in. The server checks authorization again for every operation.
|
||||
Each group has its own not-found page. Paths are defined once in `shared/config/paths.ts`. The router uses React Router data APIs (`createBrowserRouter`): a route-level error boundary, loader redirects, and later `lazy` code splitting for cabinets. Loaders do not fetch data; server data belongs to TanStack Query. Cabinet boundaries read the current session and direct guests to sign-in. `/support` sends a signed-in user to the support area for their account or to sign-in. Need pages pass `organization_id` in the query string, but the client checks the current owner directory and the server authorizes every request.
|
||||
|
||||
`/status` is a service page: it checks `/api/v1/healthz` and is linked from the public footer only. It is not a product readiness indicator. In development mode the same page shows a gallery of states built from local fixtures (an error with retry, loading, empty, forbidden, saving, trust levels); production builds do not include it.
|
||||
|
||||
@@ -49,15 +49,31 @@ After saving, the form reloads the session and shows the account step returned b
|
||||
|
||||
A 412 conflict retains the draft and offers explicit reload or replacement against the latest read version. Session errors hide private answers; responses from a previous account cannot repopulate the cache. Onboarding links follow the step returned by the server. `/candidate/questionnaire` is the destination for the saved questionnaire step.
|
||||
|
||||
## Candidate assessment
|
||||
|
||||
`/candidate/assessment` reads availability and creates attempts through the API; `/candidate/assessment/:attemptId` resumes an attempt, submits answers, and finalizes it through server commands. Real assessment requires current C3 consent. `demo_express` is labeled as a demonstration and does not award a qualification score or confirmed category. The attempt screen displays the server result, but the separate `/candidate/results` route is still a placeholder; result history and confirmed category assignment are not implemented. The client does not calculate scores.
|
||||
|
||||
The screen includes an informational notice about technical signals, but the browser does not yet collect or submit them. The server signal-ingest API exists separately; it is not connected to the UI.
|
||||
|
||||
## Privacy settings
|
||||
|
||||
`/candidate/privacy` currently shows consent management and a link to request manual assessment. Publication, search status, hidden organizations, preview, and history are available through the backend API, but a dedicated UI for these settings is not implemented. The employer candidate directory is also a placeholder; the server-side anonymous-card read API does not imply that this screen exists.
|
||||
|
||||
## Company profile
|
||||
|
||||
`pages/company` selects a company from the paginated active memberships of the current account. Only an owner may read or edit its profile. The form keeps its draft in memory, displays the server verification level without a promotion action, and builds its preview only from `candidate_card`.
|
||||
|
||||
Creation uses one idempotency key for retries of the same body after a lost response. A 412 version conflict preserves the draft; the user explicitly loads current data, reviews the reapplied changes, and saves again. Background refresh does not reset the draft. A 401/403/404 response hides the profile and clears its cached query, then reloads the company directory. This complements server membership checks rather than replacing them.
|
||||
|
||||
## Employer needs
|
||||
|
||||
`/employer/needs` shows a paginated list of organizations where the current account has an active owner membership and their needs. `/employer/needs/new?organization_id=...` creates a need, and `/employer/needs/:needId?organization_id=...` edits one. A URL or cached response grants no access: the client checks the current session and owner directory, and the server checks membership for every request. Cached data is scoped to the account and organization; a response from a prior session cannot populate the new cache. A 401/403/404 removes the organization's private queries.
|
||||
|
||||
The editor draft stays in memory. Fields and skills extracted from the source remain suggestions with provenance until the user confirms, edits, or deletes them. Unknown values are not replaced with defaults. Readiness questions appear next to missing fields; recommendation status and categories come from the API, with no fabricated results. If a create response is uncertain, retry sends the unchanged body with the same idempotency key. A 412 conflict retains the draft, offers the latest version, and requires review of reapplied changes before another save.
|
||||
|
||||
## Need entity
|
||||
|
||||
`entities/need` converts the generated DTOs of the need contract (`Need`, `NeedCreate`, `NeedUpdate`) to a form model and back. It is pure functions without React and without its own store; server data stays in the TanStack Query cache. The need UI is not implemented yet.
|
||||
`entities/need` converts the generated DTOs of the need contract (`Need`, `NeedCreate`, `NeedUpdate`) to a form model and back. It is pure functions without React and without its own store; server data stays in the TanStack Query cache. Need pages and forms live in `pages/needs`, `pages/need-editor`, and `features/edit-need`.
|
||||
|
||||
- `fromTransport` builds a draft from a `Need`. Each requirement field is an explicit state: `unknown` without a value, `extracted` as a stored suggestion with its provenance and quote, and `confirmed` as a confirmed value. An unknown field never becomes an empty string, an empty list, or a default value; a skill outside the taxonomy keeps `taxonomy_code: null`. Data that breaks the rule "value and source are null exactly when unknown" is rejected with `NeedTransportError`.
|
||||
- `toUpdateBody(need, draft)` sends only the fields whose request value changed, plus the `expected_version` of the read version. An untouched suggestion is not sent; when its field or list is sent for another reason, it goes with status `extracted`. A cleared field is sent as null, an emptied list as `[]`, and an untouched list is absent.
|
||||
@@ -67,6 +83,12 @@ Creation uses one idempotency key for retries of the same body after a lost resp
|
||||
|
||||
The tests take their fixtures from the named contract examples in `api/core/openapi.bundle.yml` and check every body with the generated `NeedCreate` and `NeedUpdate` schemas.
|
||||
|
||||
## Support and manual assessment
|
||||
|
||||
`/candidate/support/cases` and `/employer/support/cases` show each account's paginated support history. Their `.../new` routes create a case and `.../:caseId` routes show its status and history. The public `/support` route directs a signed-in user to their cabinet. The form draft stays in memory, and a retry of an unchanged request reuses its idempotency key. Support history is scoped to the current account and cleared when the session changes or the server denies access.
|
||||
|
||||
Candidates can use `/candidate/support/cases/manual-assessment` to submit a support request with a specialization, desired grade, and description. This does not run automatic assessment, create an attempt, change C3, or grant a confirmed grade. The case page displays the status and rubric version returned by the server; the client does not create an outcome.
|
||||
|
||||
## API client generation
|
||||
|
||||
`make -C frontend generate` runs Orval with `codegen/orval.config.ts` and then `codegen/mock-patterns.ts`. For a string with a `pattern`, Orval 8.40 writes `faker.helpers.fromRegExp(pattern)` into the MSW mock: faker prints the `^` and `$` anchors and `(?:...)` groups as plain text, and Orval ignores `minLength` and `maxLength` when a `pattern` is present. The second step replaces such calls with `fakeFromPattern(pattern, {minLength, maxLength})` from `src/shared/api/mock-pattern.ts`. It takes the length bounds from the OpenAPI contract by the name of the property that holds the call and by the pattern. The step fails when a call has an unexpected form, when the contract has no such property with that pattern, or when the matching schemas disagree on the length bounds. It leaves its own output unchanged, so generation is reproducible and `make check-generated` stays stable. Enums in the mocks are written as literals (`enumGenerationType: "union"`): `Object.values` of a `zod.enum` returns Zod internals, not the values.
|
||||
|
||||
Reference in new issue
Block a user