feat(accounts): add consent settings and organization management

This commit is contained in:
TakuyaYagam1 committed 2026-10-07 13:00:39 +03:00
1 parent 24638d46d2
commit 391af7a1ef
83 files changed
+10198 -613

No files matched your search

@@ -6261,6 +6261,117 @@ type ConfirmEmailForbidden Problem
func (*ConfirmEmailForbidden) confirmEmailRes() {}
// Durable request to delete the account and its personal data. The request is recorded before
// asynchronous processing starts; it does not mean deletion has completed.
// Ref: #/components/schemas/ConsentDeletionRequest
type ConsentDeletionRequest struct {
// Identifier of the durable deletion request.
ID uuid.UUID `json:"id"`
// Current state of the deletion request.
Status ConsentDeletionRequestStatus `json:"status"`
RequestedAt Timestamp `json:"requested_at"`
}
// GetID returns the value of ID.
func (s *ConsentDeletionRequest) GetID() uuid.UUID {
return s.ID
}
// GetStatus returns the value of Status.
func (s *ConsentDeletionRequest) GetStatus() ConsentDeletionRequestStatus {
return s.Status
}
// GetRequestedAt returns the value of RequestedAt.
func (s *ConsentDeletionRequest) GetRequestedAt() Timestamp {
return s.RequestedAt
}
// SetID sets the value of ID.
func (s *ConsentDeletionRequest) SetID(val uuid.UUID) {
s.ID = val
}
// SetStatus sets the value of Status.
func (s *ConsentDeletionRequest) SetStatus(val ConsentDeletionRequestStatus) {
s.Status = val
}
// SetRequestedAt sets the value of RequestedAt.
func (s *ConsentDeletionRequest) SetRequestedAt(val Timestamp) {
s.RequestedAt = val
}
// ConsentDeletionRequestHeaders wraps ConsentDeletionRequest with response headers.
type ConsentDeletionRequestHeaders struct {
CacheControl CacheControlNoStore
Response ConsentDeletionRequest
}
// GetCacheControl returns the value of CacheControl.
func (s *ConsentDeletionRequestHeaders) GetCacheControl() CacheControlNoStore {
return s.CacheControl
}
// GetResponse returns the value of Response.
func (s *ConsentDeletionRequestHeaders) GetResponse() ConsentDeletionRequest {
return s.Response
}
// SetCacheControl sets the value of CacheControl.
func (s *ConsentDeletionRequestHeaders) SetCacheControl(val CacheControlNoStore) {
s.CacheControl = val
}
// SetResponse sets the value of Response.
func (s *ConsentDeletionRequestHeaders) SetResponse(val ConsentDeletionRequest) {
s.Response = val
}
func (*ConsentDeletionRequestHeaders) requestMyAccountDeletionRes() {}
// Current state of the deletion request.
type ConsentDeletionRequestStatus string
const (
ConsentDeletionRequestStatusRequested ConsentDeletionRequestStatus = "requested"
ConsentDeletionRequestStatusProcessing ConsentDeletionRequestStatus = "processing"
)
// AllValues returns all ConsentDeletionRequestStatus values.
func (ConsentDeletionRequestStatus) AllValues() []ConsentDeletionRequestStatus {
return []ConsentDeletionRequestStatus{
ConsentDeletionRequestStatusRequested,
ConsentDeletionRequestStatusProcessing,
}
}
// MarshalText implements encoding.TextMarshaler.
func (s ConsentDeletionRequestStatus) MarshalText() ([]byte, error) {
switch s {
case ConsentDeletionRequestStatusRequested:
return []byte(s), nil
case ConsentDeletionRequestStatusProcessing:
return []byte(s), nil
default:
return nil, errors.Errorf("invalid value: %q", s)
}
}
// UnmarshalText implements encoding.TextUnmarshaler.
func (s *ConsentDeletionRequestStatus) UnmarshalText(data []byte) error {
switch ConsentDeletionRequestStatus(data) {
case ConsentDeletionRequestStatusRequested:
*s = ConsentDeletionRequestStatusRequested
return nil
case ConsentDeletionRequestStatusProcessing:
*s = ConsentDeletionRequestStatusProcessing
return nil
default:
return errors.Errorf("invalid value: %q", data)
}
}
// Organization of a c4 consent as the consent recorded it. `name` is a snapshot of the name that the
// shown consent text carried at the time of the consent, and the stored text hash proves that text
// with this name; a later rename of the organization does not change it, so it can differ from the
@@ -6559,6 +6670,34 @@ func (s *ConsentRecord) SetInvitationTermsVersion(val NilInvitationTermsVersion)
s.InvitationTermsVersion = val
}
// ConsentRecordHeaders wraps ConsentRecord with response headers.
type ConsentRecordHeaders struct {
CacheControl CacheControlNoStore
Response ConsentRecord
}
// GetCacheControl returns the value of CacheControl.
func (s *ConsentRecordHeaders) GetCacheControl() CacheControlNoStore {
return s.CacheControl
}
// GetResponse returns the value of Response.
func (s *ConsentRecordHeaders) GetResponse() ConsentRecord {
return s.Response
}
// SetCacheControl sets the value of CacheControl.
func (s *ConsentRecordHeaders) SetCacheControl(val CacheControlNoStore) {
s.CacheControl = val
}
// SetResponse sets the value of Response.
func (s *ConsentRecordHeaders) SetResponse(val ConsentRecord) {
s.Response = val
}
func (*ConsentRecordHeaders) grantMyConsentRes() {}
// One page of the consent ledger of the current account, newest grant first.
// Ref: #/components/schemas/ConsentRecordList
type ConsentRecordList struct {
@@ -6662,6 +6801,158 @@ func (s *ConsentRevocationSource) UnmarshalText(data []byte) error {
}
}
// Accept the current published text shown by GetMyConsentText. The server checks its version again
// before recording the grant.
// Ref: #/components/schemas/ConsentSettingsGrantRequest
type ConsentSettingsGrantRequest struct {
TextVersion ConsentTextVersion `json:"text_version"`
// Must be true to record an explicit acceptance.
Accepted ConsentSettingsGrantRequestAccepted `json:"accepted"`
}
// GetTextVersion returns the value of TextVersion.
func (s *ConsentSettingsGrantRequest) GetTextVersion() ConsentTextVersion {
return s.TextVersion
}
// GetAccepted returns the value of Accepted.
func (s *ConsentSettingsGrantRequest) GetAccepted() ConsentSettingsGrantRequestAccepted {
return s.Accepted
}
// SetTextVersion sets the value of TextVersion.
func (s *ConsentSettingsGrantRequest) SetTextVersion(val ConsentTextVersion) {
s.TextVersion = val
}
// SetAccepted sets the value of Accepted.
func (s *ConsentSettingsGrantRequest) SetAccepted(val ConsentSettingsGrantRequestAccepted) {
s.Accepted = val
}
// Must be true to record an explicit acceptance.
type ConsentSettingsGrantRequestAccepted bool
const (
ConsentSettingsGrantRequestAcceptedTrue ConsentSettingsGrantRequestAccepted = true
)
// AllValues returns all ConsentSettingsGrantRequestAccepted values.
func (ConsentSettingsGrantRequestAccepted) AllValues() []ConsentSettingsGrantRequestAccepted {
return []ConsentSettingsGrantRequestAccepted{
ConsentSettingsGrantRequestAcceptedTrue,
}
}
// Consent text that an authenticated account can read and accept in settings. C4 is scoped to an
// invitation and organization, so it is not available through the general settings flow.
// Ref: #/components/schemas/ConsentSettingsPurpose
type ConsentSettingsPurpose string
const (
ConsentSettingsPurposeC1 ConsentSettingsPurpose = "c1"
ConsentSettingsPurposeC2 ConsentSettingsPurpose = "c2"
ConsentSettingsPurposeC3 ConsentSettingsPurpose = "c3"
ConsentSettingsPurposeC5 ConsentSettingsPurpose = "c5"
)
// AllValues returns all ConsentSettingsPurpose values.
func (ConsentSettingsPurpose) AllValues() []ConsentSettingsPurpose {
return []ConsentSettingsPurpose{
ConsentSettingsPurposeC1,
ConsentSettingsPurposeC2,
ConsentSettingsPurposeC3,
ConsentSettingsPurposeC5,
}
}
// MarshalText implements encoding.TextMarshaler.
func (s ConsentSettingsPurpose) MarshalText() ([]byte, error) {
switch s {
case ConsentSettingsPurposeC1:
return []byte(s), nil
case ConsentSettingsPurposeC2:
return []byte(s), nil
case ConsentSettingsPurposeC3:
return []byte(s), nil
case ConsentSettingsPurposeC5:
return []byte(s), nil
default:
return nil, errors.Errorf("invalid value: %q", s)
}
}
// UnmarshalText implements encoding.TextUnmarshaler.
func (s *ConsentSettingsPurpose) UnmarshalText(data []byte) error {
switch ConsentSettingsPurpose(data) {
case ConsentSettingsPurposeC1:
*s = ConsentSettingsPurposeC1
return nil
case ConsentSettingsPurposeC2:
*s = ConsentSettingsPurposeC2
return nil
case ConsentSettingsPurposeC3:
*s = ConsentSettingsPurposeC3
return nil
case ConsentSettingsPurposeC5:
*s = ConsentSettingsPurposeC5
return nil
default:
return errors.Errorf("invalid value: %q", data)
}
}
// Consent that can be revoked through the general settings flow. C1 uses the account deletion request,
// and C4 must be revoked for one organization.
// Ref: #/components/schemas/ConsentSettingsRevokePurpose
type ConsentSettingsRevokePurpose string
const (
ConsentSettingsRevokePurposeC2 ConsentSettingsRevokePurpose = "c2"
ConsentSettingsRevokePurposeC3 ConsentSettingsRevokePurpose = "c3"
ConsentSettingsRevokePurposeC5 ConsentSettingsRevokePurpose = "c5"
)
// AllValues returns all ConsentSettingsRevokePurpose values.
func (ConsentSettingsRevokePurpose) AllValues() []ConsentSettingsRevokePurpose {
return []ConsentSettingsRevokePurpose{
ConsentSettingsRevokePurposeC2,
ConsentSettingsRevokePurposeC3,
ConsentSettingsRevokePurposeC5,
}
}
// MarshalText implements encoding.TextMarshaler.
func (s ConsentSettingsRevokePurpose) MarshalText() ([]byte, error) {
switch s {
case ConsentSettingsRevokePurposeC2:
return []byte(s), nil
case ConsentSettingsRevokePurposeC3:
return []byte(s), nil
case ConsentSettingsRevokePurposeC5:
return []byte(s), nil
default:
return nil, errors.Errorf("invalid value: %q", s)
}
}
// UnmarshalText implements encoding.TextUnmarshaler.
func (s *ConsentSettingsRevokePurpose) UnmarshalText(data []byte) error {
switch ConsentSettingsRevokePurpose(data) {
case ConsentSettingsRevokePurposeC2:
*s = ConsentSettingsRevokePurposeC2
return nil
case ConsentSettingsRevokePurposeC3:
*s = ConsentSettingsRevokePurposeC3
return nil
case ConsentSettingsRevokePurposeC5:
*s = ConsentSettingsRevokePurposeC5
return nil
default:
return errors.Errorf("invalid value: %q", data)
}
}
// Where the subject gave the consent.
//
// - registration: the c1 acceptance of RegisterAccount.
@@ -6780,7 +7071,7 @@ func (s *ConsentState) UnmarshalText(data []byte) error {
// of exactly this text.
// Ref: #/components/schemas/ConsentText
type ConsentText struct {
Purpose ConsentPurpose `json:"purpose"`
Purpose ConsentPurposeCode `json:"purpose"`
TextVersion ConsentTextVersion `json:"text_version"`
// Full consent text in plain UTF-8; paragraphs are separated by an empty line. The client shows it as
// text, never as HTML.
@@ -6789,7 +7080,7 @@ type ConsentText struct {
}
// GetPurpose returns the value of Purpose.
func (s *ConsentText) GetPurpose() ConsentPurpose {
func (s *ConsentText) GetPurpose() ConsentPurposeCode {
return s.Purpose
}
@@ -6809,7 +7100,7 @@ func (s *ConsentText) GetPublishedAt() Timestamp {
}
// SetPurpose sets the value of Purpose.
func (s *ConsentText) SetPurpose(val ConsentPurpose) {
func (s *ConsentText) SetPurpose(val ConsentPurposeCode) {
s.Purpose = val
}
@@ -6830,6 +7121,34 @@ func (s *ConsentText) SetPublishedAt(val Timestamp) {
func (*ConsentText) getConsentTextRes() {}
// ConsentTextHeaders wraps ConsentText with response headers.
type ConsentTextHeaders struct {
CacheControl CacheControlNoStore
Response ConsentText
}
// GetCacheControl returns the value of CacheControl.
func (s *ConsentTextHeaders) GetCacheControl() CacheControlNoStore {
return s.CacheControl
}
// GetResponse returns the value of Response.
func (s *ConsentTextHeaders) GetResponse() ConsentText {
return s.Response
}
// SetCacheControl sets the value of CacheControl.
func (s *ConsentTextHeaders) SetCacheControl(val CacheControlNoStore) {
s.CacheControl = val
}
// SetResponse sets the value of Response.
func (s *ConsentTextHeaders) SetResponse(val ConsentText) {
s.Response = val
}
func (*ConsentTextHeaders) getMyConsentTextRes() {}
type ConsentTextVersion string
// Why an active grant does not allow a read now, shown only to the candidate.
@@ -8046,6 +8365,14 @@ type GetMyCardPreviewUnauthorized Problem
func (*GetMyCardPreviewUnauthorized) getMyCardPreviewRes() {}
type GetMyConsentTextBadRequest Problem
func (*GetMyConsentTextBadRequest) getMyConsentTextRes() {}
type GetMyConsentTextUnauthorized Problem
func (*GetMyConsentTextUnauthorized) getMyConsentTextRes() {}
type GetMyInvitationBadRequest Problem
func (*GetMyInvitationBadRequest) getMyInvitationRes() {}
@@ -8222,6 +8549,18 @@ func (s *GradeCode) UnmarshalText(data []byte) error {
}
}
type GrantMyConsentBadRequest Problem
func (*GrantMyConsentBadRequest) grantMyConsentRes() {}
type GrantMyConsentForbidden Problem
func (*GrantMyConsentForbidden) grantMyConsentRes() {}
type GrantMyConsentUnauthorized Problem
func (*GrantMyConsentUnauthorized) grantMyConsentRes() {}
// Ref: #/components/schemas/HealthResponse
type HealthResponse struct {
Status HealthResponseStatus `json:"status"`
@@ -21991,6 +22330,14 @@ func (s *RegistrationRequest) SetConsentC1(val PersonalDataConsentAcceptance) {
s.ConsentC1 = val
}
type RequestMyAccountDeletionForbidden Problem
func (*RequestMyAccountDeletionForbidden) requestMyAccountDeletionRes() {}
type RequestMyAccountDeletionUnauthorized Problem
func (*RequestMyAccountDeletionUnauthorized) requestMyAccountDeletionRes() {}
type ResendEmailVerificationBadRequest Problem
func (*ResendEmailVerificationBadRequest) resendEmailVerificationRes() {}
@@ -21999,6 +22346,32 @@ type ResendEmailVerificationForbidden Problem
func (*ResendEmailVerificationForbidden) resendEmailVerificationRes() {}
type RevokeMyConsentForbidden Problem
func (*RevokeMyConsentForbidden) revokeMyConsentRes() {}
// RevokeMyConsentNoContent is response for RevokeMyConsent operation.
type RevokeMyConsentNoContent struct{}
func (*RevokeMyConsentNoContent) revokeMyConsentRes() {}
type RevokeMyConsentUnauthorized Problem
func (*RevokeMyConsentUnauthorized) revokeMyConsentRes() {}
type RevokeMyOrganizationContactConsentForbidden Problem
func (*RevokeMyOrganizationContactConsentForbidden) revokeMyOrganizationContactConsentRes() {}
// RevokeMyOrganizationContactConsentNoContent is response for RevokeMyOrganizationContactConsent operation.
type RevokeMyOrganizationContactConsentNoContent struct{}
func (*RevokeMyOrganizationContactConsentNoContent) revokeMyOrganizationContactConsentRes() {}
type RevokeMyOrganizationContactConsentUnauthorized Problem
func (*RevokeMyOrganizationContactConsentUnauthorized) revokeMyOrganizationContactConsentRes() {}
type RubAmount int64
// Pay period of a salary amount. The MVP uses only `month`; adding a value is a contract change.