feat(profile): persist candidate edits and enforce company access

This commit is contained in:
TakuyaYagam1 committed 2026-10-07 14:15:16 +03:00
1 parent 3ab6bd91a3
commit 73c7caa225
67 files changed
+5286 -229

No files matched your search

@@ -700,6 +700,10 @@ type Handler interface {
// establish and which no request writes. The profile needs no file, no ML extraction, and no FSP
// account.
//
// `experience_overlaps` lists every pair of entries whose inclusive month ranges overlap. Its indices
// refer to this response's `experience` array and are scoped to the same `version`; each pair is
// either `needs_confirmation` or `confirmed`.
//
// A missing, unknown, expired, or revoked session answers 401 unauthenticated; an employer account
// answers 403 forbidden.
//
@@ -742,9 +746,9 @@ type Handler interface {
GetMySupportCase(ctx context.Context, params GetMySupportCaseParams) (GetMySupportCaseRes, error)
// GetOrganization implements GetOrganization operation.
//
// 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.
// Requires the session cookie of a verified employer account with an active owner 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
@@ -752,15 +756,11 @@ type Handler interface {
// 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.
// not_found, so organizations cannot be enumerated. An active member whose role is not `owner` answers
// 403 forbidden. A malformed `org_id` answers 400 validation_failed with the path pointer.
//
// GET /api/v1/organizations/{org_id}
GetOrganization(ctx context.Context, params GetOrganizationParams) (GetOrganizationRes, error)
@@ -1293,9 +1293,9 @@ type Handler interface {
//
// Every field is optional in substance: a profile can be saved with any subset filled and the rest
// null or empty, so no value requires a resume, the ML service, an FSP account, or any other file or
// link. Which fields are needed to leave the onboarding step candidate_profile is an open product
// question that this contract does not decide; a save on that step advancing the account to
// candidate_questionnaire is planned.
// link. A successful save advances an account whose current onboarding step is candidate_profile to
// candidate_questionnaire, including a no-op save; it never moves a later step backwards. This update
// is atomic with the profile and its history.
//
// Provenance is the server's: a value typed in the form is `manual`, confirming a stored suggestion
// keeps its origin, and every claim keeps trust level 0. The body has no origin, trust level,
@@ -1320,6 +1320,17 @@ type Handler interface {
// therefore sends every suggestion that it received, and a client that read an older version gets 412
// instead of silently dropping a suggestion it never saw.
//
// Experience periods use inclusive calendar months. An overlap is allowed only when
// `confirmed_parallel_periods` explicitly acknowledges that the two date ranges are genuine parallel
// work. Each acknowledgement names two distinct experience indices and repeats their exact normalized
// `started_on` and `ended_on` values; both indices and periods must match the submitted array and
// `expected_version`. A new or changed period needs an acknowledgement in that PUT. The server carries
// an earlier acknowledgement only when the same two indices still contain the same dates; reordering
// or changing either date requires a new acknowledgement. Editing other experience fields does not
// invalidate a matching date-pair acknowledgement. A missing acknowledgement answers 400 with pointers
// to the period fields and changes nothing. Duplicate, out-of-range, self, and non-overlapping
// acknowledgements are invalid.
//
// Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400),
// account scenario (403 forbidden for an employer), a version above the current one (412), domain
// rules that depend on the body alone (400), then the rules that depend on the stored claims against
@@ -1330,9 +1341,9 @@ type Handler interface {
// without the leading @, an email that is not an address, a month outside `YYYY-MM`, a salary that is
// not a positive multiple of 1000, and more items than a list allows. The server also rejects a
// repeated tag, skill, or role specialization, a period that ends before it starts or lies in the
// future, and a decision `extracted` for a value that is not a stored suggestion, with 400
// validation_failed and pointers to the items, for example `/roles/1/specialization` or
// `/stack/1/status`. Error bodies never repeat a submitted value.
// future, a changed overlap without explicit confirmation, and a decision `extracted` for a value that
// is not a stored suggestion, with 400 validation_failed and pointers to the items, for example
// `/roles/1/specialization` or `/stack/1/status`. Error bodies never repeat a submitted value.
//
// PUT /api/v1/me/profile
SaveMyProfile(ctx context.Context, req *CandidateProfileUpdate) (SaveMyProfileRes, error)