feat(api): add specialization catalog and candidate questionnaire contract
This commit is contained in:
1 parent
c338c0c188
commit
faeeb5f157
64 files changed
+8339
-47
No files matched your search
@@ -71,6 +71,39 @@ type Handler interface {
|
||||
//
|
||||
// GET /api/v1/healthz
|
||||
GetHealthz(ctx context.Context) (*HealthResponse, error)
|
||||
// GetMyQuestionnaire implements GetMyQuestionnaire operation.
|
||||
//
|
||||
// Requires the session cookie of a candidate account. The candidate comes from the session, never from
|
||||
// a request parameter. A candidate who has not saved the questionnaire yet gets 200 with version 0 and
|
||||
// no specializations rather than 404, so the client reads the version for the first save in the same
|
||||
// way as for later ones and a missing questionnaire is not an error state.
|
||||
//
|
||||
// The response never contains a confirmed grade or a category; those come only from assessment
|
||||
// results. A missing, unknown, expired, or revoked session answers 401 unauthenticated; an employer
|
||||
// account answers 403 forbidden.
|
||||
//
|
||||
// GET /api/v1/me/questionnaire
|
||||
GetMyQuestionnaire(ctx context.Context) (GetMyQuestionnaireRes, error)
|
||||
// GetSpecializationCatalog implements GetSpecializationCatalog operation.
|
||||
//
|
||||
// Public operation without a session. Returns the directions with their specializations, the
|
||||
// assessment availability of each specialization, and the grade scale. The candidate picks
|
||||
// specializations and self-assessed grades from this catalog for the questionnaire, and the client
|
||||
// joins the codes stored in the questionnaire with the titles here.
|
||||
//
|
||||
// The catalog is public because it is the same for every caller and contains no personal data: the
|
||||
// product shows it before registration, and a public read lets intermediaries and the browser cache
|
||||
// it. It reveals nothing beyond what the landing pages already show.
|
||||
//
|
||||
// A category is a specialization together with a confirmed grade. Task languages and the stack are
|
||||
// attributes of a chosen specialization and never appear as categories. `test_availability` is derived
|
||||
// from the published task banks at the time of the request, so it changes when a bank is published,
|
||||
// without a contract change: the MVP opens an assessment only for a category with a published bank,
|
||||
// and every other specialization is marked `in_development`. Presence in the catalog never means that
|
||||
// its test is ready.
|
||||
//
|
||||
// GET /api/v1/specializations
|
||||
GetSpecializationCatalog(ctx context.Context) (*SpecializationCatalog, error)
|
||||
// Login implements Login operation.
|
||||
//
|
||||
// Public operation that starts a server session. The server verifies the password with Argon2id; for
|
||||
@@ -164,6 +197,43 @@ type Handler interface {
|
||||
//
|
||||
// POST /api/v1/identity/email-verification-requests
|
||||
ResendEmailVerification(ctx context.Context, req *EmailVerificationResendRequest) (ResendEmailVerificationRes, error)
|
||||
// SaveMyQuestionnaire implements SaveMyQuestionnaire operation.
|
||||
//
|
||||
// Requires the session cookie of a candidate account, the CSRF token of that session in X-CSRF-Token,
|
||||
// and an allowed Origin. The body is the complete new state: one or two specializations, each with a
|
||||
// self-assessed grade, task languages, stack tags, and stated experience or null, and the working
|
||||
// context. It replaces the stored questionnaire as a whole.
|
||||
//
|
||||
// Self-assessment is a claim. It influences where the assessment starts and which grade the assessment
|
||||
// step offers first, but it adds no points and never writes a confirmed grade or a category: a
|
||||
// self-assessed `senior`, or the word "Senior" in a stack tag, never assigns the Senior category. A
|
||||
// real profile stays invisible to employers until an assessment confirms a category. Choosing a
|
||||
// specialization whose test is `in_development` is allowed; no assessment starts for it until its bank
|
||||
// is published. Removing a specialization from the questionnaire does not change assessment results.
|
||||
//
|
||||
// Optimistic concurrency uses `expected_version` in the body: the client sends the `version` it read,
|
||||
// 0 for the first save. If it is not the current version, the server answers 412 version_conflict and
|
||||
// changes nothing; the client reads the questionnaire again. The version travels in the body rather
|
||||
// than in If-Match because the generated client cannot read the ETag response header yet. The status
|
||||
// and code are the same as for a failed If-Match, since the client action is the same.
|
||||
//
|
||||
// The operation needs no Idempotency-Key: it replaces the whole state and is idempotent. A body whose
|
||||
// specializations and working context equal the stored ones changes nothing, keeps the version, and
|
||||
// answers 200 with the current questionnaire even when `expected_version` is older, so a retry after a
|
||||
// lost response of a successful save succeeds instead of failing with 412.
|
||||
//
|
||||
// Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400),
|
||||
// account scenario (403 forbidden for an employer), domain rules (400), then the version (412). The
|
||||
// schema rejects more than two specializations, an unknown grade, specialization, or task language,
|
||||
// and unknown fields. The server also rejects a repeated specialization and a task language that the
|
||||
// specialization's published bank does not offer, with 400 validation_failed and pointers to the
|
||||
// items, for example `/specializations/1/specialization` or `/specializations/0/task_languages/0`.
|
||||
//
|
||||
// A successful save on the onboarding step candidate_questionnaire advances the account to
|
||||
// candidate_assessment (planned).
|
||||
//
|
||||
// PUT /api/v1/me/questionnaire
|
||||
SaveMyQuestionnaire(ctx context.Context, req *CandidateQuestionnaireUpdate) (SaveMyQuestionnaireRes, error)
|
||||
// NewError creates *ProblemStatusCode from error returned by handler.
|
||||
//
|
||||
// Used for common default response.
|
||||
|
||||
Reference in new issue
Block a user