feat(api): add invitation, terms version, acceptance, and contact grant contract

This commit is contained in:
shira committed 2026-10-06 13:48:35 +03:00
1 parent b856d4ff54
commit d2c6f1375a
140 files changed
+39767 -303

No files matched your search

@@ -19,6 +19,7 @@ import (
var regexMap = map[string]ogenregex.Regexp{
"\\S": ogenregex.MustCompile("\\S"),
"^(/([^~/]|~[01])*)*$": ogenregex.MustCompile("^(/([^~/]|~[01])*)*$"),
"^@[A-Za-z0-9_]{5,32}$": ogenregex.MustCompile("^@[A-Za-z0-9_]{5,32}$"),
"^SC-[0-9]{4}-[0-9]{6,10}$": ogenregex.MustCompile("^SC-[0-9]{4}-[0-9]{6,10}$"),
"^[A-Za-z0-9._-]+$": ogenregex.MustCompile("^[A-Za-z0-9._-]+$"),
"^[A-Za-z0-9._:-]+$": ogenregex.MustCompile("^[A-Za-z0-9._:-]+$"),
@@ -27,6 +28,7 @@ var regexMap = map[string]ogenregex.Regexp{
"^[a-z0-9_+-]+$": ogenregex.MustCompile("^[a-z0-9_+-]+$"),
"^[a-z0-9_]+$": ogenregex.MustCompile("^[a-z0-9_]+$"),
"^[a-z][a-z0-9_]*$": ogenregex.MustCompile("^[a-z][a-z0-9_]*$"),
"^\\+[1-9][0-9]{6,14}$": ogenregex.MustCompile("^\\+[1-9][0-9]{6,14}$"),
"^\\S(?:.*\\S)?$": ogenregex.MustCompile("^\\S(?:.*\\S)?$"),
"^__Host-lincodex_session=": ogenregex.MustCompile("^__Host-lincodex_session="),
}
File diff suppressed because it is too large. Load diff
@@ -1,6 +1,14 @@
// Code generated by ogen, DO NOT EDIT.
package api
type AcceptMyInvitationRes interface {
acceptMyInvitationRes()
}
type CancelMyInvitationRes interface {
cancelMyInvitationRes()
}
type ConfirmEmailRes interface {
confirmEmailRes()
}
@@ -13,10 +21,18 @@ type CreateMySupportCaseRes interface {
createMySupportCaseRes()
}
type CreateOrganizationInvitationRes interface {
createOrganizationInvitationRes()
}
type CreateOrganizationNeedRes interface {
createOrganizationNeedRes()
}
type DeclineMyInvitationRes interface {
declineMyInvitationRes()
}
type FinalizeMyAssessmentAttemptRes interface {
finalizeMyAssessmentAttemptRes()
}
@@ -45,6 +61,10 @@ type GetMyAssessmentResultRes interface {
getMyAssessmentResultRes()
}
type GetMyInvitationRes interface {
getMyInvitationRes()
}
type GetMyQuestionnaireRes interface {
getMyQuestionnaireRes()
}
@@ -53,14 +73,30 @@ type GetMySupportCaseRes interface {
getMySupportCaseRes()
}
type GetOrganizationInvitationContactsRes interface {
getOrganizationInvitationContactsRes()
}
type GetOrganizationInvitationRes interface {
getOrganizationInvitationRes()
}
type GetOrganizationNeedRes interface {
getOrganizationNeedRes()
}
type ListMyInvitationsRes interface {
listMyInvitationsRes()
}
type ListMySupportCasesRes interface {
listMySupportCasesRes()
}
type ListOrganizationInvitationsRes interface {
listOrganizationInvitationsRes()
}
type ListOrganizationNeedsRes interface {
listOrganizationNeedsRes()
}
@@ -73,6 +109,10 @@ type LogoutRes interface {
logoutRes()
}
type RaiseOrganizationInvitationSalaryRes interface {
raiseOrganizationInvitationSalaryRes()
}
type RegisterAccountRes interface {
registerAccountRes()
}
@@ -85,10 +125,26 @@ type SaveMyQuestionnaireRes interface {
saveMyQuestionnaireRes()
}
type SendOrganizationInvitationRes interface {
sendOrganizationInvitationRes()
}
type SubmitMyAssessmentAnswerRes interface {
submitMyAssessmentAnswerRes()
}
type UpdateOrganizationInvitationRes interface {
updateOrganizationInvitationRes()
}
type UpdateOrganizationNeedRes interface {
updateOrganizationNeedRes()
}
type ViewMyInvitationRes interface {
viewMyInvitationRes()
}
type WithdrawOrganizationInvitationRes interface {
withdrawOrganizationInvitationRes()
}
File diff suppressed because it is too large. Load diff
@@ -6,29 +6,43 @@ package api
type OperationName = string
const (
ConfirmEmailOperation OperationName = "ConfirmEmail"
CreateMyAssessmentAttemptOperation OperationName = "CreateMyAssessmentAttempt"
CreateMySupportCaseOperation OperationName = "CreateMySupportCase"
CreateOrganizationNeedOperation OperationName = "CreateOrganizationNeed"
FinalizeMyAssessmentAttemptOperation OperationName = "FinalizeMyAssessmentAttempt"
GetConsentTextOperation OperationName = "GetConsentText"
GetCurrentAccountOperation OperationName = "GetCurrentAccount"
GetCurrentSessionOperation OperationName = "GetCurrentSession"
GetHealthzOperation OperationName = "GetHealthz"
GetMyAssessmentAttemptOperation OperationName = "GetMyAssessmentAttempt"
GetMyAssessmentAvailabilityOperation OperationName = "GetMyAssessmentAvailability"
GetMyAssessmentResultOperation OperationName = "GetMyAssessmentResult"
GetMyQuestionnaireOperation OperationName = "GetMyQuestionnaire"
GetMySupportCaseOperation OperationName = "GetMySupportCase"
GetOrganizationNeedOperation OperationName = "GetOrganizationNeed"
GetSpecializationCatalogOperation OperationName = "GetSpecializationCatalog"
ListMySupportCasesOperation OperationName = "ListMySupportCases"
ListOrganizationNeedsOperation OperationName = "ListOrganizationNeeds"
LoginOperation OperationName = "Login"
LogoutOperation OperationName = "Logout"
RegisterAccountOperation OperationName = "RegisterAccount"
ResendEmailVerificationOperation OperationName = "ResendEmailVerification"
SaveMyQuestionnaireOperation OperationName = "SaveMyQuestionnaire"
SubmitMyAssessmentAnswerOperation OperationName = "SubmitMyAssessmentAnswer"
UpdateOrganizationNeedOperation OperationName = "UpdateOrganizationNeed"
AcceptMyInvitationOperation OperationName = "AcceptMyInvitation"
CancelMyInvitationOperation OperationName = "CancelMyInvitation"
ConfirmEmailOperation OperationName = "ConfirmEmail"
CreateMyAssessmentAttemptOperation OperationName = "CreateMyAssessmentAttempt"
CreateMySupportCaseOperation OperationName = "CreateMySupportCase"
CreateOrganizationInvitationOperation OperationName = "CreateOrganizationInvitation"
CreateOrganizationNeedOperation OperationName = "CreateOrganizationNeed"
DeclineMyInvitationOperation OperationName = "DeclineMyInvitation"
FinalizeMyAssessmentAttemptOperation OperationName = "FinalizeMyAssessmentAttempt"
GetConsentTextOperation OperationName = "GetConsentText"
GetCurrentAccountOperation OperationName = "GetCurrentAccount"
GetCurrentSessionOperation OperationName = "GetCurrentSession"
GetHealthzOperation OperationName = "GetHealthz"
GetMyAssessmentAttemptOperation OperationName = "GetMyAssessmentAttempt"
GetMyAssessmentAvailabilityOperation OperationName = "GetMyAssessmentAvailability"
GetMyAssessmentResultOperation OperationName = "GetMyAssessmentResult"
GetMyInvitationOperation OperationName = "GetMyInvitation"
GetMyQuestionnaireOperation OperationName = "GetMyQuestionnaire"
GetMySupportCaseOperation OperationName = "GetMySupportCase"
GetOrganizationInvitationOperation OperationName = "GetOrganizationInvitation"
GetOrganizationInvitationContactsOperation OperationName = "GetOrganizationInvitationContacts"
GetOrganizationNeedOperation OperationName = "GetOrganizationNeed"
GetSpecializationCatalogOperation OperationName = "GetSpecializationCatalog"
ListMyInvitationsOperation OperationName = "ListMyInvitations"
ListMySupportCasesOperation OperationName = "ListMySupportCases"
ListOrganizationInvitationsOperation OperationName = "ListOrganizationInvitations"
ListOrganizationNeedsOperation OperationName = "ListOrganizationNeeds"
LoginOperation OperationName = "Login"
LogoutOperation OperationName = "Logout"
RaiseOrganizationInvitationSalaryOperation OperationName = "RaiseOrganizationInvitationSalary"
RegisterAccountOperation OperationName = "RegisterAccount"
ResendEmailVerificationOperation OperationName = "ResendEmailVerification"
SaveMyQuestionnaireOperation OperationName = "SaveMyQuestionnaire"
SendOrganizationInvitationOperation OperationName = "SendOrganizationInvitation"
SubmitMyAssessmentAnswerOperation OperationName = "SubmitMyAssessmentAnswer"
UpdateOrganizationInvitationOperation OperationName = "UpdateOrganizationInvitation"
UpdateOrganizationNeedOperation OperationName = "UpdateOrganizationNeed"
ViewMyInvitationOperation OperationName = "ViewMyInvitation"
WithdrawOrganizationInvitationOperation OperationName = "WithdrawOrganizationInvitation"
)
File diff suppressed because it is too large. Load diff
@@ -14,6 +14,164 @@ import (
"github.com/ogen-go/ogen/validate"
)
func (s *Server) decodeAcceptMyInvitationRequest(r *http.Request) (
req *InvitationAcceptance,
rawBody []byte,
close func() error,
rerr error,
) {
var closers []func() error
close = func() error {
var merr error
// Close in reverse order, to match defer behavior.
for i := len(closers) - 1; i >= 0; i-- {
c := closers[i]
merr = errors.Join(merr, c())
}
return merr
}
defer func() {
if rerr != nil {
rerr = errors.Join(rerr, close())
}
}()
ct, _, err := mime.ParseMediaType(r.Header.Get("Content-Type"))
if err != nil {
return req, rawBody, close, errors.Wrap(err, "parse media type")
}
switch {
case ct == "application/json":
if r.ContentLength == 0 {
return req, rawBody, close, validate.ErrBodyRequired
}
buf, err := io.ReadAll(r.Body)
defer func() {
_ = r.Body.Close()
}()
if err != nil {
return req, rawBody, close, err
}
// Reset the body to allow for downstream reading.
r.Body = io.NopCloser(bytes.NewBuffer(buf))
if len(buf) == 0 {
return req, rawBody, close, validate.ErrBodyRequired
}
rawBody = append(rawBody, buf...)
d := jx.DecodeBytes(buf)
var request InvitationAcceptance
if err := func() error {
if err := request.Decode(d); err != nil {
return err
}
if err := d.Skip(); err != io.EOF {
return errors.New("unexpected trailing data")
}
return nil
}(); err != nil {
err = &ogenerrors.DecodeBodyError{
ContentType: ct,
Body: buf,
Err: err,
}
return req, rawBody, close, err
}
if err := func() error {
if err := request.Validate(); err != nil {
return err
}
return nil
}(); err != nil {
return req, rawBody, close, errors.Wrap(err, "validate")
}
return &request, rawBody, close, nil
default:
return req, rawBody, close, validate.InvalidContentType(ct)
}
}
func (s *Server) decodeCancelMyInvitationRequest(r *http.Request) (
req *InvitationCommand,
rawBody []byte,
close func() error,
rerr error,
) {
var closers []func() error
close = func() error {
var merr error
// Close in reverse order, to match defer behavior.
for i := len(closers) - 1; i >= 0; i-- {
c := closers[i]
merr = errors.Join(merr, c())
}
return merr
}
defer func() {
if rerr != nil {
rerr = errors.Join(rerr, close())
}
}()
ct, _, err := mime.ParseMediaType(r.Header.Get("Content-Type"))
if err != nil {
return req, rawBody, close, errors.Wrap(err, "parse media type")
}
switch {
case ct == "application/json":
if r.ContentLength == 0 {
return req, rawBody, close, validate.ErrBodyRequired
}
buf, err := io.ReadAll(r.Body)
defer func() {
_ = r.Body.Close()
}()
if err != nil {
return req, rawBody, close, err
}
// Reset the body to allow for downstream reading.
r.Body = io.NopCloser(bytes.NewBuffer(buf))
if len(buf) == 0 {
return req, rawBody, close, validate.ErrBodyRequired
}
rawBody = append(rawBody, buf...)
d := jx.DecodeBytes(buf)
var request InvitationCommand
if err := func() error {
if err := request.Decode(d); err != nil {
return err
}
if err := d.Skip(); err != io.EOF {
return errors.New("unexpected trailing data")
}
return nil
}(); err != nil {
err = &ogenerrors.DecodeBodyError{
ContentType: ct,
Body: buf,
Err: err,
}
return req, rawBody, close, err
}
if err := func() error {
if err := request.Validate(); err != nil {
return err
}
return nil
}(); err != nil {
return req, rawBody, close, errors.Wrap(err, "validate")
}
return &request, rawBody, close, nil
default:
return req, rawBody, close, validate.InvalidContentType(ct)
}
}
func (s *Server) decodeConfirmEmailRequest(r *http.Request) (
req *EmailVerificationRequest,
rawBody []byte,
@@ -251,6 +409,85 @@ func (s *Server) decodeCreateMySupportCaseRequest(r *http.Request) (
}
}
func (s *Server) decodeCreateOrganizationInvitationRequest(r *http.Request) (
req *OrganizationInvitationCreate,
rawBody []byte,
close func() error,
rerr error,
) {
var closers []func() error
close = func() error {
var merr error
// Close in reverse order, to match defer behavior.
for i := len(closers) - 1; i >= 0; i-- {
c := closers[i]
merr = errors.Join(merr, c())
}
return merr
}
defer func() {
if rerr != nil {
rerr = errors.Join(rerr, close())
}
}()
ct, _, err := mime.ParseMediaType(r.Header.Get("Content-Type"))
if err != nil {
return req, rawBody, close, errors.Wrap(err, "parse media type")
}
switch {
case ct == "application/json":
if r.ContentLength == 0 {
return req, rawBody, close, validate.ErrBodyRequired
}
buf, err := io.ReadAll(r.Body)
defer func() {
_ = r.Body.Close()
}()
if err != nil {
return req, rawBody, close, err
}
// Reset the body to allow for downstream reading.
r.Body = io.NopCloser(bytes.NewBuffer(buf))
if len(buf) == 0 {
return req, rawBody, close, validate.ErrBodyRequired
}
rawBody = append(rawBody, buf...)
d := jx.DecodeBytes(buf)
var request OrganizationInvitationCreate
if err := func() error {
if err := request.Decode(d); err != nil {
return err
}
if err := d.Skip(); err != io.EOF {
return errors.New("unexpected trailing data")
}
return nil
}(); err != nil {
err = &ogenerrors.DecodeBodyError{
ContentType: ct,
Body: buf,
Err: err,
}
return req, rawBody, close, err
}
if err := func() error {
if err := request.Validate(); err != nil {
return err
}
return nil
}(); err != nil {
return req, rawBody, close, errors.Wrap(err, "validate")
}
return &request, rawBody, close, nil
default:
return req, rawBody, close, validate.InvalidContentType(ct)
}
}
func (s *Server) decodeCreateOrganizationNeedRequest(r *http.Request) (
req *NeedCreate,
rawBody []byte,
@@ -330,6 +567,85 @@ func (s *Server) decodeCreateOrganizationNeedRequest(r *http.Request) (
}
}
func (s *Server) decodeDeclineMyInvitationRequest(r *http.Request) (
req *InvitationDeclineRequest,
rawBody []byte,
close func() error,
rerr error,
) {
var closers []func() error
close = func() error {
var merr error
// Close in reverse order, to match defer behavior.
for i := len(closers) - 1; i >= 0; i-- {
c := closers[i]
merr = errors.Join(merr, c())
}
return merr
}
defer func() {
if rerr != nil {
rerr = errors.Join(rerr, close())
}
}()
ct, _, err := mime.ParseMediaType(r.Header.Get("Content-Type"))
if err != nil {
return req, rawBody, close, errors.Wrap(err, "parse media type")
}
switch {
case ct == "application/json":
if r.ContentLength == 0 {
return req, rawBody, close, validate.ErrBodyRequired
}
buf, err := io.ReadAll(r.Body)
defer func() {
_ = r.Body.Close()
}()
if err != nil {
return req, rawBody, close, err
}
// Reset the body to allow for downstream reading.
r.Body = io.NopCloser(bytes.NewBuffer(buf))
if len(buf) == 0 {
return req, rawBody, close, validate.ErrBodyRequired
}
rawBody = append(rawBody, buf...)
d := jx.DecodeBytes(buf)
var request InvitationDeclineRequest
if err := func() error {
if err := request.Decode(d); err != nil {
return err
}
if err := d.Skip(); err != io.EOF {
return errors.New("unexpected trailing data")
}
return nil
}(); err != nil {
err = &ogenerrors.DecodeBodyError{
ContentType: ct,
Body: buf,
Err: err,
}
return req, rawBody, close, err
}
if err := func() error {
if err := request.Validate(); err != nil {
return err
}
return nil
}(); err != nil {
return req, rawBody, close, errors.Wrap(err, "validate")
}
return &request, rawBody, close, nil
default:
return req, rawBody, close, validate.InvalidContentType(ct)
}
}
func (s *Server) decodeFinalizeMyAssessmentAttemptRequest(r *http.Request) (
req *AssessmentFinalization,
rawBody []byte,
@@ -488,6 +804,85 @@ func (s *Server) decodeLoginRequest(r *http.Request) (
}
}
func (s *Server) decodeRaiseOrganizationInvitationSalaryRequest(r *http.Request) (
req *InvitationSalaryRaise,
rawBody []byte,
close func() error,
rerr error,
) {
var closers []func() error
close = func() error {
var merr error
// Close in reverse order, to match defer behavior.
for i := len(closers) - 1; i >= 0; i-- {
c := closers[i]
merr = errors.Join(merr, c())
}
return merr
}
defer func() {
if rerr != nil {
rerr = errors.Join(rerr, close())
}
}()
ct, _, err := mime.ParseMediaType(r.Header.Get("Content-Type"))
if err != nil {
return req, rawBody, close, errors.Wrap(err, "parse media type")
}
switch {
case ct == "application/json":
if r.ContentLength == 0 {
return req, rawBody, close, validate.ErrBodyRequired
}
buf, err := io.ReadAll(r.Body)
defer func() {
_ = r.Body.Close()
}()
if err != nil {
return req, rawBody, close, err
}
// Reset the body to allow for downstream reading.
r.Body = io.NopCloser(bytes.NewBuffer(buf))
if len(buf) == 0 {
return req, rawBody, close, validate.ErrBodyRequired
}
rawBody = append(rawBody, buf...)
d := jx.DecodeBytes(buf)
var request InvitationSalaryRaise
if err := func() error {
if err := request.Decode(d); err != nil {
return err
}
if err := d.Skip(); err != io.EOF {
return errors.New("unexpected trailing data")
}
return nil
}(); err != nil {
err = &ogenerrors.DecodeBodyError{
ContentType: ct,
Body: buf,
Err: err,
}
return req, rawBody, close, err
}
if err := func() error {
if err := request.Validate(); err != nil {
return err
}
return nil
}(); err != nil {
return req, rawBody, close, errors.Wrap(err, "validate")
}
return &request, rawBody, close, nil
default:
return req, rawBody, close, validate.InvalidContentType(ct)
}
}
func (s *Server) decodeRegisterAccountRequest(r *http.Request) (
req *RegistrationRequest,
rawBody []byte,
@@ -725,6 +1120,85 @@ func (s *Server) decodeSaveMyQuestionnaireRequest(r *http.Request) (
}
}
func (s *Server) decodeSendOrganizationInvitationRequest(r *http.Request) (
req *InvitationCommand,
rawBody []byte,
close func() error,
rerr error,
) {
var closers []func() error
close = func() error {
var merr error
// Close in reverse order, to match defer behavior.
for i := len(closers) - 1; i >= 0; i-- {
c := closers[i]
merr = errors.Join(merr, c())
}
return merr
}
defer func() {
if rerr != nil {
rerr = errors.Join(rerr, close())
}
}()
ct, _, err := mime.ParseMediaType(r.Header.Get("Content-Type"))
if err != nil {
return req, rawBody, close, errors.Wrap(err, "parse media type")
}
switch {
case ct == "application/json":
if r.ContentLength == 0 {
return req, rawBody, close, validate.ErrBodyRequired
}
buf, err := io.ReadAll(r.Body)
defer func() {
_ = r.Body.Close()
}()
if err != nil {
return req, rawBody, close, err
}
// Reset the body to allow for downstream reading.
r.Body = io.NopCloser(bytes.NewBuffer(buf))
if len(buf) == 0 {
return req, rawBody, close, validate.ErrBodyRequired
}
rawBody = append(rawBody, buf...)
d := jx.DecodeBytes(buf)
var request InvitationCommand
if err := func() error {
if err := request.Decode(d); err != nil {
return err
}
if err := d.Skip(); err != io.EOF {
return errors.New("unexpected trailing data")
}
return nil
}(); err != nil {
err = &ogenerrors.DecodeBodyError{
ContentType: ct,
Body: buf,
Err: err,
}
return req, rawBody, close, err
}
if err := func() error {
if err := request.Validate(); err != nil {
return err
}
return nil
}(); err != nil {
return req, rawBody, close, errors.Wrap(err, "validate")
}
return &request, rawBody, close, nil
default:
return req, rawBody, close, validate.InvalidContentType(ct)
}
}
func (s *Server) decodeSubmitMyAssessmentAnswerRequest(r *http.Request) (
req *AssessmentAnswerSubmission,
rawBody []byte,
@@ -804,6 +1278,85 @@ func (s *Server) decodeSubmitMyAssessmentAnswerRequest(r *http.Request) (
}
}
func (s *Server) decodeUpdateOrganizationInvitationRequest(r *http.Request) (
req *OrganizationInvitationUpdate,
rawBody []byte,
close func() error,
rerr error,
) {
var closers []func() error
close = func() error {
var merr error
// Close in reverse order, to match defer behavior.
for i := len(closers) - 1; i >= 0; i-- {
c := closers[i]
merr = errors.Join(merr, c())
}
return merr
}
defer func() {
if rerr != nil {
rerr = errors.Join(rerr, close())
}
}()
ct, _, err := mime.ParseMediaType(r.Header.Get("Content-Type"))
if err != nil {
return req, rawBody, close, errors.Wrap(err, "parse media type")
}
switch {
case ct == "application/json":
if r.ContentLength == 0 {
return req, rawBody, close, validate.ErrBodyRequired
}
buf, err := io.ReadAll(r.Body)
defer func() {
_ = r.Body.Close()
}()
if err != nil {
return req, rawBody, close, err
}
// Reset the body to allow for downstream reading.
r.Body = io.NopCloser(bytes.NewBuffer(buf))
if len(buf) == 0 {
return req, rawBody, close, validate.ErrBodyRequired
}
rawBody = append(rawBody, buf...)
d := jx.DecodeBytes(buf)
var request OrganizationInvitationUpdate
if err := func() error {
if err := request.Decode(d); err != nil {
return err
}
if err := d.Skip(); err != io.EOF {
return errors.New("unexpected trailing data")
}
return nil
}(); err != nil {
err = &ogenerrors.DecodeBodyError{
ContentType: ct,
Body: buf,
Err: err,
}
return req, rawBody, close, err
}
if err := func() error {
if err := request.Validate(); err != nil {
return err
}
return nil
}(); err != nil {
return req, rawBody, close, errors.Wrap(err, "validate")
}
return &request, rawBody, close, nil
default:
return req, rawBody, close, validate.InvalidContentType(ct)
}
}
func (s *Server) decodeUpdateOrganizationNeedRequest(r *http.Request) (
req *NeedUpdate,
rawBody []byte,
@@ -882,3 +1435,82 @@ func (s *Server) decodeUpdateOrganizationNeedRequest(r *http.Request) (
return req, rawBody, close, validate.InvalidContentType(ct)
}
}
func (s *Server) decodeWithdrawOrganizationInvitationRequest(r *http.Request) (
req *InvitationCommand,
rawBody []byte,
close func() error,
rerr error,
) {
var closers []func() error
close = func() error {
var merr error
// Close in reverse order, to match defer behavior.
for i := len(closers) - 1; i >= 0; i-- {
c := closers[i]
merr = errors.Join(merr, c())
}
return merr
}
defer func() {
if rerr != nil {
rerr = errors.Join(rerr, close())
}
}()
ct, _, err := mime.ParseMediaType(r.Header.Get("Content-Type"))
if err != nil {
return req, rawBody, close, errors.Wrap(err, "parse media type")
}
switch {
case ct == "application/json":
if r.ContentLength == 0 {
return req, rawBody, close, validate.ErrBodyRequired
}
buf, err := io.ReadAll(r.Body)
defer func() {
_ = r.Body.Close()
}()
if err != nil {
return req, rawBody, close, err
}
// Reset the body to allow for downstream reading.
r.Body = io.NopCloser(bytes.NewBuffer(buf))
if len(buf) == 0 {
return req, rawBody, close, validate.ErrBodyRequired
}
rawBody = append(rawBody, buf...)
d := jx.DecodeBytes(buf)
var request InvitationCommand
if err := func() error {
if err := request.Decode(d); err != nil {
return err
}
if err := d.Skip(); err != io.EOF {
return errors.New("unexpected trailing data")
}
return nil
}(); err != nil {
err = &ogenerrors.DecodeBodyError{
ContentType: ct,
Body: buf,
Err: err,
}
return req, rawBody, close, err
}
if err := func() error {
if err := request.Validate(); err != nil {
return err
}
return nil
}(); err != nil {
return req, rawBody, close, errors.Wrap(err, "validate")
}
return &request, rawBody, close, nil
default:
return req, rawBody, close, validate.InvalidContentType(ct)
}
}
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -56,24 +56,38 @@ func findAuthorization(h http.Header, prefix string) (string, bool) {
// operationRolesSessionCookie is a private map storing roles per operation.
var operationRolesSessionCookie = map[string][]string{
CreateMyAssessmentAttemptOperation: []string{},
CreateMySupportCaseOperation: []string{},
CreateOrganizationNeedOperation: []string{},
FinalizeMyAssessmentAttemptOperation: []string{},
GetCurrentAccountOperation: []string{},
GetCurrentSessionOperation: []string{},
GetMyAssessmentAttemptOperation: []string{},
GetMyAssessmentAvailabilityOperation: []string{},
GetMyAssessmentResultOperation: []string{},
GetMyQuestionnaireOperation: []string{},
GetMySupportCaseOperation: []string{},
GetOrganizationNeedOperation: []string{},
ListMySupportCasesOperation: []string{},
ListOrganizationNeedsOperation: []string{},
LogoutOperation: []string{},
SaveMyQuestionnaireOperation: []string{},
SubmitMyAssessmentAnswerOperation: []string{},
UpdateOrganizationNeedOperation: []string{},
AcceptMyInvitationOperation: []string{},
CancelMyInvitationOperation: []string{},
CreateMyAssessmentAttemptOperation: []string{},
CreateMySupportCaseOperation: []string{},
CreateOrganizationInvitationOperation: []string{},
CreateOrganizationNeedOperation: []string{},
DeclineMyInvitationOperation: []string{},
FinalizeMyAssessmentAttemptOperation: []string{},
GetCurrentAccountOperation: []string{},
GetCurrentSessionOperation: []string{},
GetMyAssessmentAttemptOperation: []string{},
GetMyAssessmentAvailabilityOperation: []string{},
GetMyAssessmentResultOperation: []string{},
GetMyInvitationOperation: []string{},
GetMyQuestionnaireOperation: []string{},
GetMySupportCaseOperation: []string{},
GetOrganizationInvitationOperation: []string{},
GetOrganizationInvitationContactsOperation: []string{},
GetOrganizationNeedOperation: []string{},
ListMyInvitationsOperation: []string{},
ListMySupportCasesOperation: []string{},
ListOrganizationInvitationsOperation: []string{},
ListOrganizationNeedsOperation: []string{},
LogoutOperation: []string{},
RaiseOrganizationInvitationSalaryOperation: []string{},
SaveMyQuestionnaireOperation: []string{},
SendOrganizationInvitationOperation: []string{},
SubmitMyAssessmentAnswerOperation: []string{},
UpdateOrganizationInvitationOperation: []string{},
UpdateOrganizationNeedOperation: []string{},
ViewMyInvitationOperation: []string{},
WithdrawOrganizationInvitationOperation: []string{},
}
// GetRolesForSessionCookie returns the required roles for the given operation.
@@ -99,14 +113,23 @@ func GetRolesForSessionCookie(operation string) []string {
// operationRolesSessionCsrf is a private map storing roles per operation.
var operationRolesSessionCsrf = map[string][]string{
CreateMyAssessmentAttemptOperation: []string{},
CreateMySupportCaseOperation: []string{},
CreateOrganizationNeedOperation: []string{},
FinalizeMyAssessmentAttemptOperation: []string{},
LogoutOperation: []string{},
SaveMyQuestionnaireOperation: []string{},
SubmitMyAssessmentAnswerOperation: []string{},
UpdateOrganizationNeedOperation: []string{},
AcceptMyInvitationOperation: []string{},
CancelMyInvitationOperation: []string{},
CreateMyAssessmentAttemptOperation: []string{},
CreateMySupportCaseOperation: []string{},
CreateOrganizationInvitationOperation: []string{},
CreateOrganizationNeedOperation: []string{},
DeclineMyInvitationOperation: []string{},
FinalizeMyAssessmentAttemptOperation: []string{},
LogoutOperation: []string{},
RaiseOrganizationInvitationSalaryOperation: []string{},
SaveMyQuestionnaireOperation: []string{},
SendOrganizationInvitationOperation: []string{},
SubmitMyAssessmentAnswerOperation: []string{},
UpdateOrganizationInvitationOperation: []string{},
UpdateOrganizationNeedOperation: []string{},
ViewMyInvitationOperation: []string{},
WithdrawOrganizationInvitationOperation: []string{},
}
// GetRolesForSessionCsrf returns the required roles for the given operation.
@@ -8,6 +8,94 @@ import (
// Handler handles operations described by OpenAPI v3 specification.
type Handler interface {
// AcceptMyInvitation implements AcceptMyInvitation operation.
//
// Requires the session cookie of a candidate account, the CSRF token of that session in X-CSRF-Token,
// an allowed Origin, and an Idempotency-Key. The candidate comes from the session.
//
// Only an acceptance of the current terms version with the consent C4 creates access to contacts (PRD
// FR12). The body names the `terms_version` the candidate read and accepts, the `expected_version` of
// the invitation, and `consent_c4`: the C4 text version that the candidate saw, `accepted: true`, and
// the contact fields the candidate selected. At least one field is required and nothing is preselected
// or defaulted, so a grant never covers a field the candidate did not choose. The fields come only
// from the candidate's profile; the request never carries contact values.
//
// Allowed in `delivered` and `viewed` before `response_deadline_at`; accepting directly from
// `delivered` is allowed, as in the PRD FR12 transition table. In one transaction the server moves the
// invitation to `accepted`, records the consent C4 in the consent ledger with the organization, the
// fields, the invitation, the terms version, and the text version and its hash (TASK-062), creates the
// contact grant for exactly those fields, and writes the audit event (TASK-201). The response is the
// invitation with `contact_grant`. The acceptance never publishes the profile (C2) and never bypasses
// a profile hidden from the organization: the grant alone does not guarantee a read, and the
// organization reads only while the visibility allows it.
//
// 412 or 409: a `terms_version` or `expected_version` that is not current answers 412
// version_conflict, the repository status for a stale version, and records nothing; this is the stale
// terms case, for example after the organization raised the salary, and the client reads the
// invitation again and shows the new terms for a new decision. A state that does not allow an
// acceptance answers 409 state_conflict: `withdrawn`, `expired`, `declined`, `cancelled_by_candidate`,
// the planned `counter`, or a command received at the deadline or later, which is late. A terminal
// state and a passed deadline are checked before the versions: the server first applies the due
// expiry, and the client then gets 409 for a withdrawn, expired, or late invitation even when its
// versions are stale, so it shows the final state instead of rereading and retrying. TASK-197,
// TASK-201, and TASK-204 say 409 for stale terms; the repository rule keeps 412 for any stale version,
// so clients branch on `version_conflict` to reread and on `state_conflict` to show the final state.
//
// Repeats return the same result: a retry with the same Idempotency-Key replays the stored response,
// and an acceptance of an invitation that is already `accepted` whose `terms_version` and set of
// fields equal those of its `contact_grant`, the terms version and fields that the candidate accepted,
// answers 200 with it even with a new key, an older `expected_version`, or a current `terms_version`
// that a later raise advanced; no second consent, grant, or audit event is created. A different terms
// version or field set on an accepted invitation answers 409 state_conflict; changing the disclosed
// fields is a matter of the consent operations (TASK-064). Of two concurrent acceptances only one
// makes the transition.
//
// Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400),
// account scenario (403 forbidden for an employer), the Idempotency-Key (422, 409
// idempotency_in_progress, replay), the invitation (404 not_found, after any due expiry), the repeat
// on an accepted invitation (200), a terminal state or a passed deadline (409 state_conflict, whatever
// the versions), the versions (412), any other state that does not allow an acceptance (409
// state_conflict), then the consent rules (400 with the pointer `/consent_c4/text_version` for a text
// version that is not the published one, or `/consent_c4/fields/0` for a field that the profile does
// not hold). The schema rejects a missing `terms_version`, an empty or repeated field list, an unknown
// field kind, `accepted` other than true, and unknown fields such as `email` or `phone`. The general
// rate limit can answer 429 with Retry-After before any check. 404 and 409 state_conflict are stored
// under the key; 400, 412, and 429 are not.
//
// POST /api/v1/me/invitations/{invitation_id}/accept
AcceptMyInvitation(ctx context.Context, req *InvitationAcceptance, params AcceptMyInvitationParams) (AcceptMyInvitationRes, error)
// CancelMyInvitation implements CancelMyInvitation operation.
//
// Requires the session cookie of a candidate account, the CSRF token of that session in X-CSRF-Token,
// an allowed Origin, and an Idempotency-Key. The candidate comes from the session.
//
// Moves an unfinished invitation to the terminal state `cancelled_by_candidate` (PRD FR12):
// `delivered`, `viewed`, `accepted`, and the planned stages up to `negotiation`. The process closes.
// In the same transaction the server revokes the contact grant that the acceptance of this invitation
// created, with the reason `participation_cancelled`, so the next contact read of the organization
// answers 404. Grants of other invitations or applications stay; revoking the consent C4 for the
// organization as a whole, which closes all of them, belongs to the consent operations (TASK-064).
//
// Cancel differs from decline and withdraw: a decline is the structured answer before an acceptance
// and counts as a response; a cancellation leaves the process at any unfinished stage, mostly after an
// acceptance, and carries no reason; a withdrawal is the organization's command and keeps the grant.
// Before an answer the client offers the decline.
//
// Repeats return the same result: a retry with the same Idempotency-Key replays the stored response,
// and a cancellation of an invitation that is already `cancelled_by_candidate` answers 200 with it
// even with a new key or an older `expected_version`. A terminal state other than
// `cancelled_by_candidate` answers 409 state_conflict even with a stale `expected_version`; otherwise
// a stale `expected_version` answers 412 version_conflict. The deadline does not limit a cancellation.
//
// Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400),
// account scenario (403 forbidden for an employer), the Idempotency-Key (422, 409
// idempotency_in_progress, replay), the invitation (404 not_found, after any due expiry), the repeat
// on a cancelled invitation (200), a terminal state (409 state_conflict, whatever the version), then
// the version (412). The general rate limit can answer 429 with Retry-After before any check. 404 and
// 409 state_conflict are stored under the key; 400, 412, and 429 are not.
//
// POST /api/v1/me/invitations/{invitation_id}/cancel
CancelMyInvitation(ctx context.Context, req *InvitationCommand, params CancelMyInvitationParams) (CancelMyInvitationRes, error)
// ConfirmEmail implements ConfirmEmail operation.
//
// Public operation without a session. The verification link has the form
@@ -99,10 +187,11 @@ type Handler interface {
//
// An organization is visible to a candidate when it sent the candidate an invitation or when the
// organization contract (TASK-077) shows the candidate its profile, and to an employer account when
// the account has an active membership in it. Invitations are not in the contract yet, so until they
// are, every `invitation` reference answers 404 not_found; anti-cheat review decisions are not either,
// so until TASK-173 every anti-cheat appeal answers 409 state_conflict. The schema rejects an object
// type that the case type does not accept, for example an organization in a grade appeal.
// the account has an active membership in it. Invitations are in the contract (TASK-196) but not
// implemented yet, so until they are, every `invitation` reference answers 404 not_found; anti-cheat
// review decisions are not either, so until TASK-173 every anti-cheat appeal answers 409
// state_conflict. The schema rejects an object type that the case type does not accept, for example an
// organization in a grade appeal.
//
// Ownership of the reference: the server checks the object against the session account on every
// create. An unknown object and an object of someone else, such as another candidate's attempt,
@@ -110,8 +199,7 @@ type Handler interface {
// a reference never reveals whether a foreign object exists. An own case that a grade appeal cannot
// dispute, because it is not a manual assessment, is not resolved yet, or was resolved with another
// outcome, answers 409 state_conflict. An identifier that is not a UUID fails validation with the
// whole-body pointer, because the decoder does not record the path inside the selected variant. The
// case stores only the type and the identifier of the object.
// pointer `/object/id`. The case stores only the type and the identifier of the object.
//
// Limits: an attempt and a resolved manual assessment each accept at most one grade appeal, and an
// attempt at most one anti-cheat appeal, in any status; a disagreement with the decision goes into a
@@ -165,6 +253,58 @@ type Handler interface {
//
// POST /api/v1/me/support-cases
CreateMySupportCase(ctx context.Context, req SupportCaseCreate, params CreateMySupportCaseParams) (CreateMySupportCaseRes, error)
// CreateOrganizationInvitation implements CreateOrganizationInvitation operation.
//
// 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, an allowed Origin, and an Idempotency-Key. The organization
// comes from the path and the server-side membership; the body has no organization, membership, or
// role field. In the MVP only the owner of the organization may create an invitation.
//
// The draft is addressed to one person from a search result of this organization: `candidate_handle`
// is the opaque handle of that card, never an email address, a phone number, or an account identifier.
// The server resolves the handle for this organization only. An unknown handle, a handle of another
// organization, and a profile that the organization may no longer see, because the candidate revoked
// the publication C2 or hid the profile from it, all answer 400 with the pointer `/candidate_handle`,
// so a handle never reveals which case applies. `need` is optional: a direct invitation has none, and
// a need given must be a need of the organization with a `requirements_version` that it has had,
// otherwise 400 with the pointer `/need`. `response_period_days` is 3, 7, or 14 and defaults to 7.
//
// The terms are complete from the start (PRD FR12): the role, the specialization and the grade, the
// offer type, the tasks, the team, the technology stack, the work formats and the place of work, the
// communication method, the salary range in RUB with its tax basis, and the package. Each package
// condition is either `provided` with a description or explicitly `not_provided`; leaving one out
// fails validation. A draft without the tax basis or the communication method therefore cannot exist.
// The draft is created as version 1 with terms version 1, and the candidate does not see it until
// SendOrganizationInvitation.
//
// Salary: SalaryRange applies the same rules as for a need: whole rubles, positive multiples of 1000,
// `salary_from < salary_to`, and a width from 10% to 40% of the midpoint, checked by the server in
// integer arithmetic. The response carries `salary_fit`, the coarse indicator of PRD FR13 against the
// candidate's hidden minimum; the exact minimum appears in no response. The server never rejects a
// range because of the minimum, since a rejection would reveal it. Creating a draft is an
// indicator-relevant setting: it counts against the limit shared by the whole organization with the
// ranges of needs, at most three settings a day, and against the withheld counter, after five settings
// within seven days the indicator is `withheld` for seven days from the fifth, on every draft and
// invitation of the organization (PRD FR13, planned in TASK-211; see InvitationSalaryFit). Over the
// limit the server answers 429 with Retry-After and creates nothing.
//
// 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 draft. A different body with the same key answers
// 422 idempotency_key_reused. 400 and 429 are never stored.
//
// Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400),
// account scenario (403 forbidden for a candidate), membership (404 not_found) and role (403
// forbidden), the Idempotency-Key (422, 409 idempotency_in_progress, replay), domain rules (400 with a
// pointer: `/candidate_handle`, `/need`, `/terms/salary/salary_to` for a reversed range or a width
// outside 10-40%, `/terms/location` for the `office` or `hybrid` format without a place of work, or
// `/terms/tech_stack/1` for a repeated technology), then the salary limit (429). The schema already
// rejects a missing term or package condition, a salary bound that is not a positive multiple of 1000,
// an unknown currency, period, or tax basis, and unknown fields such as `state`, `version`,
// `salary_fit`, `candidate_email`, or `salary_minimum`. The general rate limit can answer 429 with
// Retry-After before any check.
//
// POST /api/v1/organizations/{org_id}/invitations
CreateOrganizationInvitation(ctx context.Context, req *OrganizationInvitationCreate, params CreateOrganizationInvitationParams) (CreateOrganizationInvitationRes, error)
// CreateOrganizationNeed implements CreateOrganizationNeed operation.
//
// Requires the session cookie of an employer account with an active membership in `org_id`, the CSRF
@@ -218,6 +358,43 @@ type Handler interface {
//
// POST /api/v1/organizations/{org_id}/needs
CreateOrganizationNeed(ctx context.Context, req *NeedCreate, params CreateOrganizationNeedParams) (CreateOrganizationNeedRes, error)
// DeclineMyInvitation implements DeclineMyInvitation operation.
//
// Requires the session cookie of a candidate account, the CSRF token of that session in X-CSRF-Token,
// an allowed Origin, and an Idempotency-Key. The candidate comes from the session.
//
// Allowed in `delivered`, `viewed`, and the planned `counter`, before `response_deadline_at`. Moves
// the invitation to the terminal state `declined` with the reason and the optional comment; no consent
// and no access arise (PRD FR12). A timely decline counts as an answer for the responsiveness metrics,
// not as a consent or a hire. The reason is one of InvitationDeclineReason, including the neutral
// `other`; no reason requires a comment.
//
// Visibility: the organization sees only the state `declined` and `responded_at`. It never sees the
// reason or the comment of an individual decline, because a reason such as `salary` would tell it that
// the hidden minimum is above the range. Reasons feed only aggregates with a minimum group size
// (planned); the comment is never shown to the organization, published, logged, or sent in a
// notification. The candidate reads both back in `decline`. A new invitation of the same organization
// to this candidate is possible only after the 30-day pause.
//
// Repeats return the same result: a retry with the same Idempotency-Key replays the stored response,
// and a decline of an invitation that is already `declined` with the same reason and comment answers
// 200 with it even with a new key or an older `expected_version`. A terminal state, another reason or
// comment on a declined invitation, and a command at the deadline or later answer 409 state_conflict
// even with a stale `expected_version`; otherwise a stale `expected_version` answers 412
// version_conflict.
//
// Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400),
// account scenario (403 forbidden for an employer), the Idempotency-Key (422, 409
// idempotency_in_progress, replay), the invitation (404 not_found, after any due expiry), the repeat
// on a declined invitation (200), a terminal state or a passed deadline (409 state_conflict, whatever
// the version), the version (412), then any other state that does not allow a decline (409
// state_conflict). The schema rejects an unknown reason, an empty comment or one of only white space,
// a comment over 500 characters, and unknown fields. The general rate limit can answer 429 with
// Retry-After before any check. 404 and 409 state_conflict are stored under the key; 400, 412, and 429
// are not.
//
// POST /api/v1/me/invitations/{invitation_id}/decline
DeclineMyInvitation(ctx context.Context, req *InvitationDeclineRequest, params DeclineMyInvitationParams) (DeclineMyInvitationRes, error)
// FinalizeMyAssessmentAttempt implements FinalizeMyAssessmentAttempt operation.
//
// Requires the session cookie of a candidate account, the CSRF token of that session in X-CSRF-Token,
@@ -365,6 +542,37 @@ type Handler interface {
//
// GET /api/v1/me/assessment-attempts/{attempt_id}/result
GetMyAssessmentResult(ctx context.Context, params GetMyAssessmentResultParams) (GetMyAssessmentResultRes, error)
// GetMyInvitation implements GetMyInvitation operation.
//
// Requires the session cookie of a candidate account. The candidate comes from the session; the
// invitation must be addressed to this candidate.
//
// Returns the organization, the current terms version with the full terms, the state, and the
// deadline. While an acceptance is possible (`delivered` or `viewed` before the deadline),
// `contact_consent` holds the published text of the consent C4 for this organization and the kinds of
// contact that the profile holds, with nothing preselected; otherwise it is null. It is null as well
// when the profile holds no contact: a grant must cover at least one field, so the client asks the
// candidate to add a contact to the profile before accepting. After an answer the response holds the
// candidate's own decline or the contact grant that the acceptance created, with the selected kinds,
// its status, and whether the organization can read it now (`readable`, with `blocked_by` `visibility`
// when the profile is not published or is hidden from the organization), never contact values. The
// response never carries the candidate's handle, the need of the organization, the salary indicator of
// the organization, or any contact or salary minimum of the candidate.
//
// Reading has no side effect on the invitation: it never records a view. The client records that the
// candidate opened the terms with ViewMyInvitation, an explicit command, so a prefetch, a retry, or a
// cache refresh never changes the state that the organization sees. The only change a read can cause
// is the due expiry: a read at the deadline or later first applies the server transition to `expired`
// with `invitation_timeout`, which would happen without the read as well, and the response shows it.
// Reading earlier terms versions is planned as a separate operation.
//
// Access: a missing, unknown, expired, or revoked session answers 401 unauthenticated; an employer
// account answers 403 forbidden; a draft, an invitation addressed to another candidate, and an unknown
// identifier all answer 404 not_found, so identifiers cannot be enumerated. An `invitation_id` that is
// not a UUID answers 400 validation_failed with the path pointer.
//
// GET /api/v1/me/invitations/{invitation_id}
GetMyInvitation(ctx context.Context, params GetMyInvitationParams) (GetMyInvitationRes, error)
// GetMyQuestionnaire implements GetMyQuestionnaire operation.
//
// Requires the session cookie of a candidate account. The candidate comes from the session, never from
@@ -400,6 +608,65 @@ type Handler interface {
//
// GET /api/v1/me/support-cases/{case_id}
GetMySupportCase(ctx context.Context, params GetMySupportCaseParams) (GetMySupportCaseRes, error)
// GetOrganizationInvitation implements GetOrganizationInvitation operation.
//
// Requires the session cookie of an employer account with an active membership in `org_id`. The
// organization and the role come from the server-side membership, never from the request. In the MVP
// only the owner of the organization reads invitations.
//
// Returns the invitation with the current terms version, the state, the deadline, the coarse salary
// indicator `salary_fit`, and `contact_access`. The candidate appears only as the opaque
// `candidate_handle`: before and after an acceptance this response never carries the candidate's name,
// email address, phone number, or other contact, the exact salary minimum, or the reason and comment
// of a decline. Contact values come only from GetOrganizationInvitationContacts while
// `contact_access.status` is `available`. Reading earlier terms versions is planned as a separate
// operation.
//
// 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, an
// unknown organization, an unknown invitation, and an invitation of another organization all answer
// 404 not_found, so identifiers cannot be probed; a member whose role does not allow reading the
// invitation answers 403 forbidden. An `org_id` or `invitation_id` that is not a UUID answers 400
// validation_failed with the path pointer.
//
// GET /api/v1/organizations/{org_id}/invitations/{invitation_id}
GetOrganizationInvitation(ctx context.Context, params GetOrganizationInvitationParams) (GetOrganizationInvitationRes, error)
// GetOrganizationInvitationContacts implements GetOrganizationInvitationContacts operation.
//
// Requires the session cookie of an employer account with an active membership in `org_id`. In the MVP
// only the owner of the organization reads contacts (TASK-202); the other roles of PRD FR07 are
// planned.
//
// This is the only operation that returns contact values, and its response is separate from the terms
// and from the invitation. It answers only while a grant created by the acceptance of this invitation
// is active and the read is allowed now: on every request the server checks the membership, the
// consent C4 for this organization, the grant and its fields, and the current visibility of the
// profile (C2 and the organizations the candidate hid the profile from), with no cache in between, so
// a revocation closes the next read at once. The response holds exactly the fields that the grant
// covers; every other field is null. A grant of organization A never answers for organization B.
//
// Without such a grant the contacts do not exist for the caller, and the operation answers 404
// not_found, the same as for an unknown invitation: before an acceptance, after a decline or an
// expiry, after the candidate revoked C4 or cancelled the participation, after the candidate closed
// the visibility, and while a grant created when the profile was not published or was hidden from the
// organization stays blocked. The answer does not tell which applies; `contact_access` of
// GetOrganizationInvitation tells the organization whether access is `not_granted`, `available`, or
// `closed`, without the reason, and the candidate sees `readable` and `blocked_by` on the grant.
// Withdrawing the invitation keeps an existing grant. A later publication of the profile never reopens
// a closed grant; only a new explicit C4 creates a new one.
//
// Every successful read is recorded in the access audit (planned in TASK-090 and TASK-202), and the
// response has `Cache-Control: no-store`.
//
// 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, an
// unknown organization, an unknown invitation, an invitation of another organization, and an
// invitation without an active readable grant all answer 404 not_found; a member whose role does not
// allow reading contacts answers 403 forbidden. An `org_id` or `invitation_id` that is not a UUID
// answers 400 validation_failed with the path pointer.
//
// GET /api/v1/organizations/{org_id}/invitations/{invitation_id}/contacts
GetOrganizationInvitationContacts(ctx context.Context, params GetOrganizationInvitationContactsParams) (GetOrganizationInvitationContactsRes, error)
// GetOrganizationNeed implements GetOrganizationNeed operation.
//
// Requires the session cookie of an employer account with an active membership in `org_id`. The
@@ -451,6 +718,24 @@ type Handler interface {
//
// GET /api/v1/specializations
GetSpecializationCatalog(ctx context.Context) (*SpecializationCatalog, error)
// ListMyInvitations implements ListMyInvitations operation.
//
// Requires the session cookie of a candidate account. The candidate comes from the session, never from
// a request parameter. Returns a page of the candidate's inbox, newest first by delivery time with the
// identifier as the tie-breaker, with cursor pagination: every invitation that was delivered to this
// candidate, in any later state, including withdrawn and expired ones. Drafts and invitations
// addressed to other candidates are never listed.
//
// A summary has the organization, the state, the versions, the role, the salary range, the work
// formats, and the deadline. Listing never records a view: the state `delivered` stays until
// ViewMyInvitation records that the candidate opened the terms. Responsiveness metrics of the
// organization and filters by state are planned and add fields or optional parameters.
//
// Access: a missing, unknown, expired, or revoked session answers 401 unauthenticated; an employer
// account answers 403 forbidden. A malformed `limit` or `cursor` answers 400 validation_failed.
//
// GET /api/v1/me/invitations
ListMyInvitations(ctx context.Context, params ListMyInvitationsParams) (ListMyInvitationsRes, error)
// ListMySupportCases implements ListMySupportCases operation.
//
// Requires the session cookie of a candidate or an employer account. Returns a page of the cases that
@@ -466,6 +751,28 @@ type Handler interface {
//
// GET /api/v1/me/support-cases
ListMySupportCases(ctx context.Context, params ListMySupportCasesParams) (ListMySupportCasesRes, error)
// ListOrganizationInvitations implements ListOrganizationInvitations operation.
//
// Requires the session cookie of an employer account with an active membership in `org_id`. The
// organization and the role come from the membership that the server holds for the session account,
// never from the request. In the MVP only the owner of the organization works with invitations, as
// with needs; the other roles of the PRD FR07 matrix are planned and change no field of this contract.
//
// Returns a page of invitation summaries in every state, drafts included, newest first by creation
// time with the identifier as the tie-breaker, with cursor pagination. A summary names the candidate
// only by the opaque `candidate_handle` and has the state, the versions, the role, the salary range,
// the deadline, and the contact access without any contact value. A declined invitation shows the
// state `declined` without the reason or the comment. Filters by state and need are planned and add
// optional parameters.
//
// 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 and an
// unknown organization both answer 404 not_found, so organizations cannot be enumerated; a member
// whose role does not allow reading invitations answers 403 forbidden. A malformed `org_id`, `limit`,
// or `cursor` answers 400 validation_failed.
//
// GET /api/v1/organizations/{org_id}/invitations
ListOrganizationInvitations(ctx context.Context, params ListOrganizationInvitationsParams) (ListOrganizationInvitationsRes, error)
// ListOrganizationNeeds implements ListOrganizationNeeds operation.
//
// Requires the session cookie of an employer account with an active membership in `org_id`. The
@@ -521,6 +828,45 @@ type Handler interface {
//
// DELETE /api/v1/identity/sessions/current
Logout(ctx context.Context) (LogoutRes, error)
// RaiseOrganizationInvitationSalary implements RaiseOrganizationInvitationSalary operation.
//
// 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, an allowed Origin, and an Idempotency-Key. In the MVP only
// the owner of the organization changes invitations.
//
// After sending, the salary base is fixed and the lower bound never decreases; the upper bound may be
// raised exactly once in the whole history of the invitation (PRD FR13). The body carries only the new
// `salary_to`, so the request cannot change the lower bound, the currency, the period, or the tax
// basis. The new bound must be above the current one and keep the width of the range from 10% to 40%
// of its midpoint, otherwise 400 validation_failed with the pointer `/salary_to`. The raise creates
// the next terms version with every other term unchanged and the next invitation version; the
// candidate sees the new terms, and an acceptance that names the previous terms version answers 412
// version_conflict. The deadline does not change. The raise follows its own once-only rule and does
// not count against the organization-wide daily limit of three range settings, but it counts against
// the withheld counter of `salary_fit` (five settings within seven days), because it moves the upper
// bound that the indicator compares.
//
// Allowed in `delivered`, `viewed`, and `accepted`, and in the planned states `counter`,
// `interview_scheduled`, `interviewed`, and `no_deal`, where FR13 lets a raise open an early repeated
// final. During `negotiation`, after `terms_agreed`, in a terminal state, in a `draft` (change the
// draft instead), and after the raise was used, the server answers 409 state_conflict. A raise after
// an acceptance changes neither the accepted terms version of the grant nor the grant.
//
// Repeats return the same result: a retry with the same Idempotency-Key replays the stored response,
// and a raise to the same `salary_to` that was already applied answers 200 with the current invitation
// even with a new key or an older `expected_version`.
//
// Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400),
// account scenario (403 forbidden for a candidate), membership (404 not_found) and role (403
// forbidden), the Idempotency-Key (422, 409 idempotency_in_progress, replay), the invitation (404
// not_found, after any due expiry), the repeat of an applied raise (200), a terminal state (409
// state_conflict, whatever the version), the version (412), any other state that does not allow a
// raise and the used raise (409 state_conflict), then the bound and the width (400). The general rate
// limit can answer 429 with Retry-After before any check. 404 and 409 state_conflict are stored under
// the key; 400, 412, and 429 are not.
//
// POST /api/v1/organizations/{org_id}/invitations/{invitation_id}/salary-raise
RaiseOrganizationInvitationSalary(ctx context.Context, req *InvitationSalaryRaise, params RaiseOrganizationInvitationSalaryParams) (RaiseOrganizationInvitationSalaryRes, error)
// RegisterAccount implements RegisterAccount operation.
//
// Public operation without a session. The client reads the current C1 text with GetConsentText and
@@ -617,6 +963,43 @@ type Handler interface {
//
// PUT /api/v1/me/questionnaire
SaveMyQuestionnaire(ctx context.Context, req *CandidateQuestionnaireUpdate) (SaveMyQuestionnaireRes, error)
// SendOrganizationInvitation implements SendOrganizationInvitation operation.
//
// 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, an allowed Origin, and an Idempotency-Key. In the MVP only
// the owner of the organization sends invitations.
//
// Sends the current terms version of a `draft`. Sending is internal and never visible as a state: in
// one transaction the server records the delivery, creates the candidate's inbox entry, starts the
// deadline `response_deadline_at = delivered_at + response_period_days`, spends one invitation of the
// weekly organization quota, and writes the outbox event for the notification (TASK-199), then answers
// 200 with the state `delivered`. A successful answer therefore means the candidate can already read
// the invitation; an email is a separate notification that never blocks or delays it, and its retries
// never move the deadline. No contact of the candidate is disclosed by sending.
//
// The server checks again that the candidate is still visible to the organization: a revoked
// publication C2 or a profile hidden from the organization answers 409 state_conflict without telling
// which. It also enforces the limits of the product policy: at most 20 invitations waiting for an
// answer per need (`delivered`, `viewed`, `counter`) and the 30-day pause for the pair of the
// organization and the candidate after a decline or a no deal, regardless of the member or the need,
// both with 409 state_conflict; and the rolling weekly quota of the organization (TASK-087), with 429
// and Retry-After. The pending limit and the quota are planned in TASK-205 and TASK-087.
//
// Repeats return the same result: a retry with the same Idempotency-Key replays the stored response,
// and a send of an invitation that was already sent answers 200 with the invitation in its current
// state even with a new key or an older `expected_version`; the quota is spent once. A stale
// `expected_version` on a draft answers 412 version_conflict, so the organization never sends terms it
// did not read.
//
// Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400),
// account scenario (403 forbidden for a candidate), membership (404 not_found) and role (403
// forbidden), the Idempotency-Key (422, 409 idempotency_in_progress, replay), the invitation (404
// not_found), the repeat of a completed send (200), the version (412), the state, the visibility of
// the candidate, the pending limit and the pause (409 state_conflict), then the quota (429). 404 and
// 409 state_conflict are stored under the key; 400, 412, and 429 are not.
//
// POST /api/v1/organizations/{org_id}/invitations/{invitation_id}/send
SendOrganizationInvitation(ctx context.Context, req *InvitationCommand, params SendOrganizationInvitationParams) (SendOrganizationInvitationRes, error)
// SubmitMyAssessmentAnswer implements SubmitMyAssessmentAnswer operation.
//
// Requires the session cookie of a candidate account, the CSRF token of that session in X-CSRF-Token,
@@ -674,6 +1057,50 @@ type Handler interface {
//
// POST /api/v1/me/assessment-attempts/{attempt_id}/answers
SubmitMyAssessmentAnswer(ctx context.Context, req *AssessmentAnswerSubmission, params SubmitMyAssessmentAnswerParams) (SubmitMyAssessmentAnswerRes, error)
// UpdateOrganizationInvitation implements UpdateOrganizationInvitation operation.
//
// 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. The body has no organization,
// membership, or role field. In the MVP only the owner of the organization changes drafts.
//
// Only a `draft` can change; any other state answers 409 state_conflict. After sending, the only
// change of the terms is the one raise of the upper salary bound through
// RaiseOrganizationInvitationSalary. The candidate of a draft cannot change: a draft for another
// candidate is a new draft.
//
// 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. `terms` is
// always sent complete and replaces the terms as a whole, with the same validation as on creation, so
// a package condition is never dropped by omission. `need` sent as null unlinks the need.
//
// Versions: every committed change creates version `expected_version + 1`; a change of the terms also
// creates the next terms version, an immutable snapshot, and a change of anything else keeps the terms
// version. `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 invitation again. The
// version travels in the body because the generated client cannot read the ETag response header yet.
// The operation needs no Idempotency-Key: a body that changes nothing when applied to the current
// version, such as a retry of a change that already succeeded, keeps the version and answers 200 with
// the current invitation even when `expected_version` is older.
//
// Salary limit: every change that can move `salary_fit` is an indicator-relevant setting: a change of
// either salary bound, of the tax basis, or of `work_formats`, because the indicator compares with the
// candidate's minimum for the offered formats, and switching formats or the basis would otherwise
// probe the minimum for free. Such a change counts against the limit shared by the organization with
// needs and other drafts, at most three settings a day, and against the withheld counter, which
// withholds `salary_fit` for seven days from the fifth setting within seven days (PRD FR13, planned in
// TASK-211; see InvitationSalaryFit). Over the limit the server answers 429 with Retry-After and
// changes nothing. A change that keeps the range, the basis, and the formats does not count. The
// operation follows the convention of UpdateOrganizationNeed: no Idempotency-Key, and a body that
// changes nothing answers 200.
//
// Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400),
// account scenario (403 forbidden for a candidate), membership (404 not_found) and role (403
// forbidden), the invitation (404 not_found), a body that changes nothing (200), the version (412),
// the state (409 state_conflict), domain rules (400 with the pointers of
// CreateOrganizationInvitation), then the salary limit (429).
//
// PATCH /api/v1/organizations/{org_id}/invitations/{invitation_id}
UpdateOrganizationInvitation(ctx context.Context, req *OrganizationInvitationUpdate, params UpdateOrganizationInvitationParams) (UpdateOrganizationInvitationRes, error)
// UpdateOrganizationNeed implements UpdateOrganizationNeed operation.
//
// Requires the session cookie of an employer account with an active membership in `org_id`, the CSRF
@@ -741,6 +1168,67 @@ type Handler interface {
//
// PATCH /api/v1/organizations/{org_id}/needs/{need_id}
UpdateOrganizationNeed(ctx context.Context, req *NeedUpdate, params UpdateOrganizationNeedParams) (UpdateOrganizationNeedRes, error)
// ViewMyInvitation implements ViewMyInvitation operation.
//
// Requires the session cookie of a candidate account, the CSRF token of that session in X-CSRF-Token,
// and an allowed Origin. The candidate comes from the session. The request has no body.
//
// The view transition of PRD FR12 (TASK-200) is an explicit command, so reading the invitation with
// GetMyInvitation stays free of side effects. The client sends it when the candidate opens the terms
// screen. For a `delivered` invitation the server moves it to `viewed`, sets `viewed_at`, advances
// `version`, and keeps the deadline. In any other state, including `viewed`, `accepted`, and the
// terminal states, it changes nothing and answers 200 with the current invitation. A view never
// reopens, extends, or answers an invitation, and the organization sees only the state `viewed` and
// `viewed_at`.
//
// The command is idempotent by its effect: the first view wins and every repeat returns the current
// invitation. It therefore needs no Idempotency-Key and no `expected_version`: a view must never fail
// because the invitation changed after the client read it, for example after a salary raise. A view at
// the deadline or later first applies the due expiry and answers 200 with `expired`.
//
// The general rate limit can answer 429 with Retry-After before any check.
//
// Access: a missing, unknown, expired, or revoked session answers 401 unauthenticated; a missing or
// wrong CSRF token or a disallowed Origin answers 403 csrf_check_failed; an employer account answers
// 403 forbidden; a draft, an invitation addressed to another candidate, and an unknown identifier all
// answer 404 not_found. An `invitation_id` that is not a UUID answers 400 validation_failed with the
// path pointer.
//
// POST /api/v1/me/invitations/{invitation_id}/view
ViewMyInvitation(ctx context.Context, params ViewMyInvitationParams) (ViewMyInvitationRes, error)
// WithdrawOrganizationInvitation implements WithdrawOrganizationInvitation operation.
//
// 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, an allowed Origin, and an Idempotency-Key. In the MVP only
// the owner of the organization withdraws invitations.
//
// Moves an unfinished invitation to the terminal state `withdrawn` (PRD FR12): a `draft`, which the
// candidate never sees, a `delivered` or `viewed` invitation before the answer, an `accepted` one, and
// the planned stages up to `negotiation`. The process closes and no further transition happens in it.
// Withdrawing a delivered invitation frees its place in the pending limit of the need but never
// returns the weekly quota. Withdrawing never revokes the consent C4 or a grant that already exists:
// an accepted invitation keeps its `contact_access`, because only the candidate closes the access, by
// revoking C4, cancelling the participation, or closing the visibility.
//
// `withdrawn` differs from `cancelled_by_candidate`: the organization withdraws, and the grant stays;
// the candidate cancels through CancelMyInvitation, and the grant of this invitation is revoked. A
// terminal invitation (`declined`, `expired`, `cancelled_by_candidate`) answers 409 state_conflict,
// even with a stale `expected_version`, so the organization sees the final state at once.
//
// Repeats return the same result: a retry with the same Idempotency-Key replays the stored response,
// and a withdrawal of an invitation that is already `withdrawn` answers 200 with it even with a new
// key or an older `expected_version`.
//
// Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400),
// account scenario (403 forbidden for a candidate), membership (404 not_found) and role (403
// forbidden), the Idempotency-Key (422, 409 idempotency_in_progress, replay), the invitation (404
// not_found, after any due expiry), the repeat on a withdrawn invitation (200), a terminal state (409
// state_conflict, whatever the version), then the version (412). The general rate limit can answer 429
// with Retry-After before any check. 404 and 409 state_conflict are stored under the key; 400, 412,
// and 429 are not.
//
// POST /api/v1/organizations/{org_id}/invitations/{invitation_id}/withdraw
WithdrawOrganizationInvitation(ctx context.Context, req *InvitationCommand, params WithdrawOrganizationInvitationParams) (WithdrawOrganizationInvitationRes, error)
// NewError creates *ProblemStatusCode from error returned by handler.
//
// Used for common default response.
@@ -13,6 +13,100 @@ type UnimplementedHandler struct{}
var _ Handler = UnimplementedHandler{}
// AcceptMyInvitation implements AcceptMyInvitation operation.
//
// Requires the session cookie of a candidate account, the CSRF token of that session in X-CSRF-Token,
// an allowed Origin, and an Idempotency-Key. The candidate comes from the session.
//
// Only an acceptance of the current terms version with the consent C4 creates access to contacts (PRD
// FR12). The body names the `terms_version` the candidate read and accepts, the `expected_version` of
// the invitation, and `consent_c4`: the C4 text version that the candidate saw, `accepted: true`, and
// the contact fields the candidate selected. At least one field is required and nothing is preselected
// or defaulted, so a grant never covers a field the candidate did not choose. The fields come only
// from the candidate's profile; the request never carries contact values.
//
// Allowed in `delivered` and `viewed` before `response_deadline_at`; accepting directly from
// `delivered` is allowed, as in the PRD FR12 transition table. In one transaction the server moves the
// invitation to `accepted`, records the consent C4 in the consent ledger with the organization, the
// fields, the invitation, the terms version, and the text version and its hash (TASK-062), creates the
// contact grant for exactly those fields, and writes the audit event (TASK-201). The response is the
// invitation with `contact_grant`. The acceptance never publishes the profile (C2) and never bypasses
// a profile hidden from the organization: the grant alone does not guarantee a read, and the
// organization reads only while the visibility allows it.
//
// 412 or 409: a `terms_version` or `expected_version` that is not current answers 412
// version_conflict, the repository status for a stale version, and records nothing; this is the stale
// terms case, for example after the organization raised the salary, and the client reads the
// invitation again and shows the new terms for a new decision. A state that does not allow an
// acceptance answers 409 state_conflict: `withdrawn`, `expired`, `declined`, `cancelled_by_candidate`,
// the planned `counter`, or a command received at the deadline or later, which is late. A terminal
// state and a passed deadline are checked before the versions: the server first applies the due
// expiry, and the client then gets 409 for a withdrawn, expired, or late invitation even when its
// versions are stale, so it shows the final state instead of rereading and retrying. TASK-197,
// TASK-201, and TASK-204 say 409 for stale terms; the repository rule keeps 412 for any stale version,
// so clients branch on `version_conflict` to reread and on `state_conflict` to show the final state.
//
// Repeats return the same result: a retry with the same Idempotency-Key replays the stored response,
// and an acceptance of an invitation that is already `accepted` whose `terms_version` and set of
// fields equal those of its `contact_grant`, the terms version and fields that the candidate accepted,
// answers 200 with it even with a new key, an older `expected_version`, or a current `terms_version`
// that a later raise advanced; no second consent, grant, or audit event is created. A different terms
// version or field set on an accepted invitation answers 409 state_conflict; changing the disclosed
// fields is a matter of the consent operations (TASK-064). Of two concurrent acceptances only one
// makes the transition.
//
// Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400),
// account scenario (403 forbidden for an employer), the Idempotency-Key (422, 409
// idempotency_in_progress, replay), the invitation (404 not_found, after any due expiry), the repeat
// on an accepted invitation (200), a terminal state or a passed deadline (409 state_conflict, whatever
// the versions), the versions (412), any other state that does not allow an acceptance (409
// state_conflict), then the consent rules (400 with the pointer `/consent_c4/text_version` for a text
// version that is not the published one, or `/consent_c4/fields/0` for a field that the profile does
// not hold). The schema rejects a missing `terms_version`, an empty or repeated field list, an unknown
// field kind, `accepted` other than true, and unknown fields such as `email` or `phone`. The general
// rate limit can answer 429 with Retry-After before any check. 404 and 409 state_conflict are stored
// under the key; 400, 412, and 429 are not.
//
// POST /api/v1/me/invitations/{invitation_id}/accept
func (UnimplementedHandler) AcceptMyInvitation(ctx context.Context, req *InvitationAcceptance, params AcceptMyInvitationParams) (r AcceptMyInvitationRes, _ error) {
return r, ht.ErrNotImplemented
}
// CancelMyInvitation implements CancelMyInvitation operation.
//
// Requires the session cookie of a candidate account, the CSRF token of that session in X-CSRF-Token,
// an allowed Origin, and an Idempotency-Key. The candidate comes from the session.
//
// Moves an unfinished invitation to the terminal state `cancelled_by_candidate` (PRD FR12):
// `delivered`, `viewed`, `accepted`, and the planned stages up to `negotiation`. The process closes.
// In the same transaction the server revokes the contact grant that the acceptance of this invitation
// created, with the reason `participation_cancelled`, so the next contact read of the organization
// answers 404. Grants of other invitations or applications stay; revoking the consent C4 for the
// organization as a whole, which closes all of them, belongs to the consent operations (TASK-064).
//
// Cancel differs from decline and withdraw: a decline is the structured answer before an acceptance
// and counts as a response; a cancellation leaves the process at any unfinished stage, mostly after an
// acceptance, and carries no reason; a withdrawal is the organization's command and keeps the grant.
// Before an answer the client offers the decline.
//
// Repeats return the same result: a retry with the same Idempotency-Key replays the stored response,
// and a cancellation of an invitation that is already `cancelled_by_candidate` answers 200 with it
// even with a new key or an older `expected_version`. A terminal state other than
// `cancelled_by_candidate` answers 409 state_conflict even with a stale `expected_version`; otherwise
// a stale `expected_version` answers 412 version_conflict. The deadline does not limit a cancellation.
//
// Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400),
// account scenario (403 forbidden for an employer), the Idempotency-Key (422, 409
// idempotency_in_progress, replay), the invitation (404 not_found, after any due expiry), the repeat
// on a cancelled invitation (200), a terminal state (409 state_conflict, whatever the version), then
// the version (412). The general rate limit can answer 429 with Retry-After before any check. 404 and
// 409 state_conflict are stored under the key; 400, 412, and 429 are not.
//
// POST /api/v1/me/invitations/{invitation_id}/cancel
func (UnimplementedHandler) CancelMyInvitation(ctx context.Context, req *InvitationCommand, params CancelMyInvitationParams) (r CancelMyInvitationRes, _ error) {
return r, ht.ErrNotImplemented
}
// ConfirmEmail implements ConfirmEmail operation.
//
// Public operation without a session. The verification link has the form
@@ -110,10 +204,11 @@ func (UnimplementedHandler) CreateMyAssessmentAttempt(ctx context.Context, req *
//
// An organization is visible to a candidate when it sent the candidate an invitation or when the
// organization contract (TASK-077) shows the candidate its profile, and to an employer account when
// the account has an active membership in it. Invitations are not in the contract yet, so until they
// are, every `invitation` reference answers 404 not_found; anti-cheat review decisions are not either,
// so until TASK-173 every anti-cheat appeal answers 409 state_conflict. The schema rejects an object
// type that the case type does not accept, for example an organization in a grade appeal.
// the account has an active membership in it. Invitations are in the contract (TASK-196) but not
// implemented yet, so until they are, every `invitation` reference answers 404 not_found; anti-cheat
// review decisions are not either, so until TASK-173 every anti-cheat appeal answers 409
// state_conflict. The schema rejects an object type that the case type does not accept, for example an
// organization in a grade appeal.
//
// Ownership of the reference: the server checks the object against the session account on every
// create. An unknown object and an object of someone else, such as another candidate's attempt,
@@ -121,8 +216,7 @@ func (UnimplementedHandler) CreateMyAssessmentAttempt(ctx context.Context, req *
// a reference never reveals whether a foreign object exists. An own case that a grade appeal cannot
// dispute, because it is not a manual assessment, is not resolved yet, or was resolved with another
// outcome, answers 409 state_conflict. An identifier that is not a UUID fails validation with the
// whole-body pointer, because the decoder does not record the path inside the selected variant. The
// case stores only the type and the identifier of the object.
// pointer `/object/id`. The case stores only the type and the identifier of the object.
//
// Limits: an attempt and a resolved manual assessment each accept at most one grade appeal, and an
// attempt at most one anti-cheat appeal, in any status; a disagreement with the decision goes into a
@@ -179,6 +273,61 @@ func (UnimplementedHandler) CreateMySupportCase(ctx context.Context, req Support
return r, ht.ErrNotImplemented
}
// CreateOrganizationInvitation implements CreateOrganizationInvitation operation.
//
// 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, an allowed Origin, and an Idempotency-Key. The organization
// comes from the path and the server-side membership; the body has no organization, membership, or
// role field. In the MVP only the owner of the organization may create an invitation.
//
// The draft is addressed to one person from a search result of this organization: `candidate_handle`
// is the opaque handle of that card, never an email address, a phone number, or an account identifier.
// The server resolves the handle for this organization only. An unknown handle, a handle of another
// organization, and a profile that the organization may no longer see, because the candidate revoked
// the publication C2 or hid the profile from it, all answer 400 with the pointer `/candidate_handle`,
// so a handle never reveals which case applies. `need` is optional: a direct invitation has none, and
// a need given must be a need of the organization with a `requirements_version` that it has had,
// otherwise 400 with the pointer `/need`. `response_period_days` is 3, 7, or 14 and defaults to 7.
//
// The terms are complete from the start (PRD FR12): the role, the specialization and the grade, the
// offer type, the tasks, the team, the technology stack, the work formats and the place of work, the
// communication method, the salary range in RUB with its tax basis, and the package. Each package
// condition is either `provided` with a description or explicitly `not_provided`; leaving one out
// fails validation. A draft without the tax basis or the communication method therefore cannot exist.
// The draft is created as version 1 with terms version 1, and the candidate does not see it until
// SendOrganizationInvitation.
//
// Salary: SalaryRange applies the same rules as for a need: whole rubles, positive multiples of 1000,
// `salary_from < salary_to`, and a width from 10% to 40% of the midpoint, checked by the server in
// integer arithmetic. The response carries `salary_fit`, the coarse indicator of PRD FR13 against the
// candidate's hidden minimum; the exact minimum appears in no response. The server never rejects a
// range because of the minimum, since a rejection would reveal it. Creating a draft is an
// indicator-relevant setting: it counts against the limit shared by the whole organization with the
// ranges of needs, at most three settings a day, and against the withheld counter, after five settings
// within seven days the indicator is `withheld` for seven days from the fifth, on every draft and
// invitation of the organization (PRD FR13, planned in TASK-211; see InvitationSalaryFit). Over the
// limit the server answers 429 with Retry-After and creates nothing.
//
// 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 draft. A different body with the same key answers
// 422 idempotency_key_reused. 400 and 429 are never stored.
//
// Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400),
// account scenario (403 forbidden for a candidate), membership (404 not_found) and role (403
// forbidden), the Idempotency-Key (422, 409 idempotency_in_progress, replay), domain rules (400 with a
// pointer: `/candidate_handle`, `/need`, `/terms/salary/salary_to` for a reversed range or a width
// outside 10-40%, `/terms/location` for the `office` or `hybrid` format without a place of work, or
// `/terms/tech_stack/1` for a repeated technology), then the salary limit (429). The schema already
// rejects a missing term or package condition, a salary bound that is not a positive multiple of 1000,
// an unknown currency, period, or tax basis, and unknown fields such as `state`, `version`,
// `salary_fit`, `candidate_email`, or `salary_minimum`. The general rate limit can answer 429 with
// Retry-After before any check.
//
// POST /api/v1/organizations/{org_id}/invitations
func (UnimplementedHandler) CreateOrganizationInvitation(ctx context.Context, req *OrganizationInvitationCreate, params CreateOrganizationInvitationParams) (r CreateOrganizationInvitationRes, _ error) {
return r, ht.ErrNotImplemented
}
// CreateOrganizationNeed implements CreateOrganizationNeed operation.
//
// Requires the session cookie of an employer account with an active membership in `org_id`, the CSRF
@@ -235,6 +384,46 @@ func (UnimplementedHandler) CreateOrganizationNeed(ctx context.Context, req *Nee
return r, ht.ErrNotImplemented
}
// DeclineMyInvitation implements DeclineMyInvitation operation.
//
// Requires the session cookie of a candidate account, the CSRF token of that session in X-CSRF-Token,
// an allowed Origin, and an Idempotency-Key. The candidate comes from the session.
//
// Allowed in `delivered`, `viewed`, and the planned `counter`, before `response_deadline_at`. Moves
// the invitation to the terminal state `declined` with the reason and the optional comment; no consent
// and no access arise (PRD FR12). A timely decline counts as an answer for the responsiveness metrics,
// not as a consent or a hire. The reason is one of InvitationDeclineReason, including the neutral
// `other`; no reason requires a comment.
//
// Visibility: the organization sees only the state `declined` and `responded_at`. It never sees the
// reason or the comment of an individual decline, because a reason such as `salary` would tell it that
// the hidden minimum is above the range. Reasons feed only aggregates with a minimum group size
// (planned); the comment is never shown to the organization, published, logged, or sent in a
// notification. The candidate reads both back in `decline`. A new invitation of the same organization
// to this candidate is possible only after the 30-day pause.
//
// Repeats return the same result: a retry with the same Idempotency-Key replays the stored response,
// and a decline of an invitation that is already `declined` with the same reason and comment answers
// 200 with it even with a new key or an older `expected_version`. A terminal state, another reason or
// comment on a declined invitation, and a command at the deadline or later answer 409 state_conflict
// even with a stale `expected_version`; otherwise a stale `expected_version` answers 412
// version_conflict.
//
// Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400),
// account scenario (403 forbidden for an employer), the Idempotency-Key (422, 409
// idempotency_in_progress, replay), the invitation (404 not_found, after any due expiry), the repeat
// on a declined invitation (200), a terminal state or a passed deadline (409 state_conflict, whatever
// the version), the version (412), then any other state that does not allow a decline (409
// state_conflict). The schema rejects an unknown reason, an empty comment or one of only white space,
// a comment over 500 characters, and unknown fields. The general rate limit can answer 429 with
// Retry-After before any check. 404 and 409 state_conflict are stored under the key; 400, 412, and 429
// are not.
//
// POST /api/v1/me/invitations/{invitation_id}/decline
func (UnimplementedHandler) DeclineMyInvitation(ctx context.Context, req *InvitationDeclineRequest, params DeclineMyInvitationParams) (r DeclineMyInvitationRes, _ error) {
return r, ht.ErrNotImplemented
}
// FinalizeMyAssessmentAttempt implements FinalizeMyAssessmentAttempt operation.
//
// Requires the session cookie of a candidate account, the CSRF token of that session in X-CSRF-Token,
@@ -406,6 +595,40 @@ func (UnimplementedHandler) GetMyAssessmentResult(ctx context.Context, params Ge
return r, ht.ErrNotImplemented
}
// GetMyInvitation implements GetMyInvitation operation.
//
// Requires the session cookie of a candidate account. The candidate comes from the session; the
// invitation must be addressed to this candidate.
//
// Returns the organization, the current terms version with the full terms, the state, and the
// deadline. While an acceptance is possible (`delivered` or `viewed` before the deadline),
// `contact_consent` holds the published text of the consent C4 for this organization and the kinds of
// contact that the profile holds, with nothing preselected; otherwise it is null. It is null as well
// when the profile holds no contact: a grant must cover at least one field, so the client asks the
// candidate to add a contact to the profile before accepting. After an answer the response holds the
// candidate's own decline or the contact grant that the acceptance created, with the selected kinds,
// its status, and whether the organization can read it now (`readable`, with `blocked_by` `visibility`
// when the profile is not published or is hidden from the organization), never contact values. The
// response never carries the candidate's handle, the need of the organization, the salary indicator of
// the organization, or any contact or salary minimum of the candidate.
//
// Reading has no side effect on the invitation: it never records a view. The client records that the
// candidate opened the terms with ViewMyInvitation, an explicit command, so a prefetch, a retry, or a
// cache refresh never changes the state that the organization sees. The only change a read can cause
// is the due expiry: a read at the deadline or later first applies the server transition to `expired`
// with `invitation_timeout`, which would happen without the read as well, and the response shows it.
// Reading earlier terms versions is planned as a separate operation.
//
// Access: a missing, unknown, expired, or revoked session answers 401 unauthenticated; an employer
// account answers 403 forbidden; a draft, an invitation addressed to another candidate, and an unknown
// identifier all answer 404 not_found, so identifiers cannot be enumerated. An `invitation_id` that is
// not a UUID answers 400 validation_failed with the path pointer.
//
// GET /api/v1/me/invitations/{invitation_id}
func (UnimplementedHandler) GetMyInvitation(ctx context.Context, params GetMyInvitationParams) (r GetMyInvitationRes, _ error) {
return r, ht.ErrNotImplemented
}
// GetMyQuestionnaire implements GetMyQuestionnaire operation.
//
// Requires the session cookie of a candidate account. The candidate comes from the session, never from
@@ -447,6 +670,71 @@ func (UnimplementedHandler) GetMySupportCase(ctx context.Context, params GetMySu
return r, ht.ErrNotImplemented
}
// GetOrganizationInvitation implements GetOrganizationInvitation operation.
//
// Requires the session cookie of an employer account with an active membership in `org_id`. The
// organization and the role come from the server-side membership, never from the request. In the MVP
// only the owner of the organization reads invitations.
//
// Returns the invitation with the current terms version, the state, the deadline, the coarse salary
// indicator `salary_fit`, and `contact_access`. The candidate appears only as the opaque
// `candidate_handle`: before and after an acceptance this response never carries the candidate's name,
// email address, phone number, or other contact, the exact salary minimum, or the reason and comment
// of a decline. Contact values come only from GetOrganizationInvitationContacts while
// `contact_access.status` is `available`. Reading earlier terms versions is planned as a separate
// operation.
//
// 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, an
// unknown organization, an unknown invitation, and an invitation of another organization all answer
// 404 not_found, so identifiers cannot be probed; a member whose role does not allow reading the
// invitation answers 403 forbidden. An `org_id` or `invitation_id` that is not a UUID answers 400
// validation_failed with the path pointer.
//
// GET /api/v1/organizations/{org_id}/invitations/{invitation_id}
func (UnimplementedHandler) GetOrganizationInvitation(ctx context.Context, params GetOrganizationInvitationParams) (r GetOrganizationInvitationRes, _ error) {
return r, ht.ErrNotImplemented
}
// GetOrganizationInvitationContacts implements GetOrganizationInvitationContacts operation.
//
// Requires the session cookie of an employer account with an active membership in `org_id`. In the MVP
// only the owner of the organization reads contacts (TASK-202); the other roles of PRD FR07 are
// planned.
//
// This is the only operation that returns contact values, and its response is separate from the terms
// and from the invitation. It answers only while a grant created by the acceptance of this invitation
// is active and the read is allowed now: on every request the server checks the membership, the
// consent C4 for this organization, the grant and its fields, and the current visibility of the
// profile (C2 and the organizations the candidate hid the profile from), with no cache in between, so
// a revocation closes the next read at once. The response holds exactly the fields that the grant
// covers; every other field is null. A grant of organization A never answers for organization B.
//
// Without such a grant the contacts do not exist for the caller, and the operation answers 404
// not_found, the same as for an unknown invitation: before an acceptance, after a decline or an
// expiry, after the candidate revoked C4 or cancelled the participation, after the candidate closed
// the visibility, and while a grant created when the profile was not published or was hidden from the
// organization stays blocked. The answer does not tell which applies; `contact_access` of
// GetOrganizationInvitation tells the organization whether access is `not_granted`, `available`, or
// `closed`, without the reason, and the candidate sees `readable` and `blocked_by` on the grant.
// Withdrawing the invitation keeps an existing grant. A later publication of the profile never reopens
// a closed grant; only a new explicit C4 creates a new one.
//
// Every successful read is recorded in the access audit (planned in TASK-090 and TASK-202), and the
// response has `Cache-Control: no-store`.
//
// 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, an
// unknown organization, an unknown invitation, an invitation of another organization, and an
// invitation without an active readable grant all answer 404 not_found; a member whose role does not
// allow reading contacts answers 403 forbidden. An `org_id` or `invitation_id` that is not a UUID
// answers 400 validation_failed with the path pointer.
//
// GET /api/v1/organizations/{org_id}/invitations/{invitation_id}/contacts
func (UnimplementedHandler) GetOrganizationInvitationContacts(ctx context.Context, params GetOrganizationInvitationContactsParams) (r GetOrganizationInvitationContactsRes, _ error) {
return r, ht.ErrNotImplemented
}
// GetOrganizationNeed implements GetOrganizationNeed operation.
//
// Requires the session cookie of an employer account with an active membership in `org_id`. The
@@ -504,6 +792,27 @@ func (UnimplementedHandler) GetSpecializationCatalog(ctx context.Context) (r *Sp
return r, ht.ErrNotImplemented
}
// ListMyInvitations implements ListMyInvitations operation.
//
// Requires the session cookie of a candidate account. The candidate comes from the session, never from
// a request parameter. Returns a page of the candidate's inbox, newest first by delivery time with the
// identifier as the tie-breaker, with cursor pagination: every invitation that was delivered to this
// candidate, in any later state, including withdrawn and expired ones. Drafts and invitations
// addressed to other candidates are never listed.
//
// A summary has the organization, the state, the versions, the role, the salary range, the work
// formats, and the deadline. Listing never records a view: the state `delivered` stays until
// ViewMyInvitation records that the candidate opened the terms. Responsiveness metrics of the
// organization and filters by state are planned and add fields or optional parameters.
//
// Access: a missing, unknown, expired, or revoked session answers 401 unauthenticated; an employer
// account answers 403 forbidden. A malformed `limit` or `cursor` answers 400 validation_failed.
//
// GET /api/v1/me/invitations
func (UnimplementedHandler) ListMyInvitations(ctx context.Context, params ListMyInvitationsParams) (r ListMyInvitationsRes, _ error) {
return r, ht.ErrNotImplemented
}
// ListMySupportCases implements ListMySupportCases operation.
//
// Requires the session cookie of a candidate or an employer account. Returns a page of the cases that
@@ -522,6 +831,31 @@ func (UnimplementedHandler) ListMySupportCases(ctx context.Context, params ListM
return r, ht.ErrNotImplemented
}
// ListOrganizationInvitations implements ListOrganizationInvitations operation.
//
// Requires the session cookie of an employer account with an active membership in `org_id`. The
// organization and the role come from the membership that the server holds for the session account,
// never from the request. In the MVP only the owner of the organization works with invitations, as
// with needs; the other roles of the PRD FR07 matrix are planned and change no field of this contract.
//
// Returns a page of invitation summaries in every state, drafts included, newest first by creation
// time with the identifier as the tie-breaker, with cursor pagination. A summary names the candidate
// only by the opaque `candidate_handle` and has the state, the versions, the role, the salary range,
// the deadline, and the contact access without any contact value. A declined invitation shows the
// state `declined` without the reason or the comment. Filters by state and need are planned and add
// optional parameters.
//
// 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 and an
// unknown organization both answer 404 not_found, so organizations cannot be enumerated; a member
// whose role does not allow reading invitations answers 403 forbidden. A malformed `org_id`, `limit`,
// or `cursor` answers 400 validation_failed.
//
// GET /api/v1/organizations/{org_id}/invitations
func (UnimplementedHandler) ListOrganizationInvitations(ctx context.Context, params ListOrganizationInvitationsParams) (r ListOrganizationInvitationsRes, _ error) {
return r, ht.ErrNotImplemented
}
// ListOrganizationNeeds implements ListOrganizationNeeds operation.
//
// Requires the session cookie of an employer account with an active membership in `org_id`. The
@@ -586,6 +920,48 @@ func (UnimplementedHandler) Logout(ctx context.Context) (r LogoutRes, _ error) {
return r, ht.ErrNotImplemented
}
// RaiseOrganizationInvitationSalary implements RaiseOrganizationInvitationSalary operation.
//
// 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, an allowed Origin, and an Idempotency-Key. In the MVP only
// the owner of the organization changes invitations.
//
// After sending, the salary base is fixed and the lower bound never decreases; the upper bound may be
// raised exactly once in the whole history of the invitation (PRD FR13). The body carries only the new
// `salary_to`, so the request cannot change the lower bound, the currency, the period, or the tax
// basis. The new bound must be above the current one and keep the width of the range from 10% to 40%
// of its midpoint, otherwise 400 validation_failed with the pointer `/salary_to`. The raise creates
// the next terms version with every other term unchanged and the next invitation version; the
// candidate sees the new terms, and an acceptance that names the previous terms version answers 412
// version_conflict. The deadline does not change. The raise follows its own once-only rule and does
// not count against the organization-wide daily limit of three range settings, but it counts against
// the withheld counter of `salary_fit` (five settings within seven days), because it moves the upper
// bound that the indicator compares.
//
// Allowed in `delivered`, `viewed`, and `accepted`, and in the planned states `counter`,
// `interview_scheduled`, `interviewed`, and `no_deal`, where FR13 lets a raise open an early repeated
// final. During `negotiation`, after `terms_agreed`, in a terminal state, in a `draft` (change the
// draft instead), and after the raise was used, the server answers 409 state_conflict. A raise after
// an acceptance changes neither the accepted terms version of the grant nor the grant.
//
// Repeats return the same result: a retry with the same Idempotency-Key replays the stored response,
// and a raise to the same `salary_to` that was already applied answers 200 with the current invitation
// even with a new key or an older `expected_version`.
//
// Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400),
// account scenario (403 forbidden for a candidate), membership (404 not_found) and role (403
// forbidden), the Idempotency-Key (422, 409 idempotency_in_progress, replay), the invitation (404
// not_found, after any due expiry), the repeat of an applied raise (200), a terminal state (409
// state_conflict, whatever the version), the version (412), any other state that does not allow a
// raise and the used raise (409 state_conflict), then the bound and the width (400). The general rate
// limit can answer 429 with Retry-After before any check. 404 and 409 state_conflict are stored under
// the key; 400, 412, and 429 are not.
//
// POST /api/v1/organizations/{org_id}/invitations/{invitation_id}/salary-raise
func (UnimplementedHandler) RaiseOrganizationInvitationSalary(ctx context.Context, req *InvitationSalaryRaise, params RaiseOrganizationInvitationSalaryParams) (r RaiseOrganizationInvitationSalaryRes, _ error) {
return r, ht.ErrNotImplemented
}
// RegisterAccount implements RegisterAccount operation.
//
// Public operation without a session. The client reads the current C1 text with GetConsentText and
@@ -691,6 +1067,46 @@ func (UnimplementedHandler) SaveMyQuestionnaire(ctx context.Context, req *Candid
return r, ht.ErrNotImplemented
}
// SendOrganizationInvitation implements SendOrganizationInvitation operation.
//
// 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, an allowed Origin, and an Idempotency-Key. In the MVP only
// the owner of the organization sends invitations.
//
// Sends the current terms version of a `draft`. Sending is internal and never visible as a state: in
// one transaction the server records the delivery, creates the candidate's inbox entry, starts the
// deadline `response_deadline_at = delivered_at + response_period_days`, spends one invitation of the
// weekly organization quota, and writes the outbox event for the notification (TASK-199), then answers
// 200 with the state `delivered`. A successful answer therefore means the candidate can already read
// the invitation; an email is a separate notification that never blocks or delays it, and its retries
// never move the deadline. No contact of the candidate is disclosed by sending.
//
// The server checks again that the candidate is still visible to the organization: a revoked
// publication C2 or a profile hidden from the organization answers 409 state_conflict without telling
// which. It also enforces the limits of the product policy: at most 20 invitations waiting for an
// answer per need (`delivered`, `viewed`, `counter`) and the 30-day pause for the pair of the
// organization and the candidate after a decline or a no deal, regardless of the member or the need,
// both with 409 state_conflict; and the rolling weekly quota of the organization (TASK-087), with 429
// and Retry-After. The pending limit and the quota are planned in TASK-205 and TASK-087.
//
// Repeats return the same result: a retry with the same Idempotency-Key replays the stored response,
// and a send of an invitation that was already sent answers 200 with the invitation in its current
// state even with a new key or an older `expected_version`; the quota is spent once. A stale
// `expected_version` on a draft answers 412 version_conflict, so the organization never sends terms it
// did not read.
//
// Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400),
// account scenario (403 forbidden for a candidate), membership (404 not_found) and role (403
// forbidden), the Idempotency-Key (422, 409 idempotency_in_progress, replay), the invitation (404
// not_found), the repeat of a completed send (200), the version (412), the state, the visibility of
// the candidate, the pending limit and the pause (409 state_conflict), then the quota (429). 404 and
// 409 state_conflict are stored under the key; 400, 412, and 429 are not.
//
// POST /api/v1/organizations/{org_id}/invitations/{invitation_id}/send
func (UnimplementedHandler) SendOrganizationInvitation(ctx context.Context, req *InvitationCommand, params SendOrganizationInvitationParams) (r SendOrganizationInvitationRes, _ error) {
return r, ht.ErrNotImplemented
}
// SubmitMyAssessmentAnswer implements SubmitMyAssessmentAnswer operation.
//
// Requires the session cookie of a candidate account, the CSRF token of that session in X-CSRF-Token,
@@ -751,6 +1167,53 @@ func (UnimplementedHandler) SubmitMyAssessmentAnswer(ctx context.Context, req *A
return r, ht.ErrNotImplemented
}
// UpdateOrganizationInvitation implements UpdateOrganizationInvitation operation.
//
// 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. The body has no organization,
// membership, or role field. In the MVP only the owner of the organization changes drafts.
//
// Only a `draft` can change; any other state answers 409 state_conflict. After sending, the only
// change of the terms is the one raise of the upper salary bound through
// RaiseOrganizationInvitationSalary. The candidate of a draft cannot change: a draft for another
// candidate is a new draft.
//
// 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. `terms` is
// always sent complete and replaces the terms as a whole, with the same validation as on creation, so
// a package condition is never dropped by omission. `need` sent as null unlinks the need.
//
// Versions: every committed change creates version `expected_version + 1`; a change of the terms also
// creates the next terms version, an immutable snapshot, and a change of anything else keeps the terms
// version. `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 invitation again. The
// version travels in the body because the generated client cannot read the ETag response header yet.
// The operation needs no Idempotency-Key: a body that changes nothing when applied to the current
// version, such as a retry of a change that already succeeded, keeps the version and answers 200 with
// the current invitation even when `expected_version` is older.
//
// Salary limit: every change that can move `salary_fit` is an indicator-relevant setting: a change of
// either salary bound, of the tax basis, or of `work_formats`, because the indicator compares with the
// candidate's minimum for the offered formats, and switching formats or the basis would otherwise
// probe the minimum for free. Such a change counts against the limit shared by the organization with
// needs and other drafts, at most three settings a day, and against the withheld counter, which
// withholds `salary_fit` for seven days from the fifth setting within seven days (PRD FR13, planned in
// TASK-211; see InvitationSalaryFit). Over the limit the server answers 429 with Retry-After and
// changes nothing. A change that keeps the range, the basis, and the formats does not count. The
// operation follows the convention of UpdateOrganizationNeed: no Idempotency-Key, and a body that
// changes nothing answers 200.
//
// Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400),
// account scenario (403 forbidden for a candidate), membership (404 not_found) and role (403
// forbidden), the invitation (404 not_found), a body that changes nothing (200), the version (412),
// the state (409 state_conflict), domain rules (400 with the pointers of
// CreateOrganizationInvitation), then the salary limit (429).
//
// PATCH /api/v1/organizations/{org_id}/invitations/{invitation_id}
func (UnimplementedHandler) UpdateOrganizationInvitation(ctx context.Context, req *OrganizationInvitationUpdate, params UpdateOrganizationInvitationParams) (r UpdateOrganizationInvitationRes, _ error) {
return r, ht.ErrNotImplemented
}
// UpdateOrganizationNeed implements UpdateOrganizationNeed operation.
//
// Requires the session cookie of an employer account with an active membership in `org_id`, the CSRF
@@ -821,6 +1284,73 @@ func (UnimplementedHandler) UpdateOrganizationNeed(ctx context.Context, req *Nee
return r, ht.ErrNotImplemented
}
// ViewMyInvitation implements ViewMyInvitation operation.
//
// Requires the session cookie of a candidate account, the CSRF token of that session in X-CSRF-Token,
// and an allowed Origin. The candidate comes from the session. The request has no body.
//
// The view transition of PRD FR12 (TASK-200) is an explicit command, so reading the invitation with
// GetMyInvitation stays free of side effects. The client sends it when the candidate opens the terms
// screen. For a `delivered` invitation the server moves it to `viewed`, sets `viewed_at`, advances
// `version`, and keeps the deadline. In any other state, including `viewed`, `accepted`, and the
// terminal states, it changes nothing and answers 200 with the current invitation. A view never
// reopens, extends, or answers an invitation, and the organization sees only the state `viewed` and
// `viewed_at`.
//
// The command is idempotent by its effect: the first view wins and every repeat returns the current
// invitation. It therefore needs no Idempotency-Key and no `expected_version`: a view must never fail
// because the invitation changed after the client read it, for example after a salary raise. A view at
// the deadline or later first applies the due expiry and answers 200 with `expired`.
//
// The general rate limit can answer 429 with Retry-After before any check.
//
// Access: a missing, unknown, expired, or revoked session answers 401 unauthenticated; a missing or
// wrong CSRF token or a disallowed Origin answers 403 csrf_check_failed; an employer account answers
// 403 forbidden; a draft, an invitation addressed to another candidate, and an unknown identifier all
// answer 404 not_found. An `invitation_id` that is not a UUID answers 400 validation_failed with the
// path pointer.
//
// POST /api/v1/me/invitations/{invitation_id}/view
func (UnimplementedHandler) ViewMyInvitation(ctx context.Context, params ViewMyInvitationParams) (r ViewMyInvitationRes, _ error) {
return r, ht.ErrNotImplemented
}
// WithdrawOrganizationInvitation implements WithdrawOrganizationInvitation operation.
//
// 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, an allowed Origin, and an Idempotency-Key. In the MVP only
// the owner of the organization withdraws invitations.
//
// Moves an unfinished invitation to the terminal state `withdrawn` (PRD FR12): a `draft`, which the
// candidate never sees, a `delivered` or `viewed` invitation before the answer, an `accepted` one, and
// the planned stages up to `negotiation`. The process closes and no further transition happens in it.
// Withdrawing a delivered invitation frees its place in the pending limit of the need but never
// returns the weekly quota. Withdrawing never revokes the consent C4 or a grant that already exists:
// an accepted invitation keeps its `contact_access`, because only the candidate closes the access, by
// revoking C4, cancelling the participation, or closing the visibility.
//
// `withdrawn` differs from `cancelled_by_candidate`: the organization withdraws, and the grant stays;
// the candidate cancels through CancelMyInvitation, and the grant of this invitation is revoked. A
// terminal invitation (`declined`, `expired`, `cancelled_by_candidate`) answers 409 state_conflict,
// even with a stale `expected_version`, so the organization sees the final state at once.
//
// Repeats return the same result: a retry with the same Idempotency-Key replays the stored response,
// and a withdrawal of an invitation that is already `withdrawn` answers 200 with it even with a new
// key or an older `expected_version`.
//
// Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400),
// account scenario (403 forbidden for a candidate), membership (404 not_found) and role (403
// forbidden), the Idempotency-Key (422, 409 idempotency_in_progress, replay), the invitation (404
// not_found, after any due expiry), the repeat on a withdrawn invitation (200), a terminal state (409
// state_conflict, whatever the version), then the version (412). The general rate limit can answer 429
// with Retry-After before any check. 404 and 409 state_conflict are stored under the key; 400, 412,
// and 429 are not.
//
// POST /api/v1/organizations/{org_id}/invitations/{invitation_id}/withdraw
func (UnimplementedHandler) WithdrawOrganizationInvitation(ctx context.Context, req *InvitationCommand, params WithdrawOrganizationInvitationParams) (r WithdrawOrganizationInvitationRes, _ error) {
return r, ht.ErrNotImplemented
}
// NewError creates *ProblemStatusCode from error returned by handler.
//
// Used for common default response.
File diff suppressed because it is too large. Load diff