Files
probo/pkg/coredata/rights_request_state.go
Émile Ré 6623cbc6f2 Add data request pages to compliance portal
Let trust-portal data subjects submit and track GDPR/CCPA rights
requests. The new Data Requests page lists the viewer's own requests
and a dialog submits new ones, scoped server-side to the verified
viewer email so former or inactive users can still exercise their
rights. Submission requires magic-link sign-in (reusing the existing
gate) but not the NDA gate.

Extend the shared rights_request enums with RECTIFICATION, OBJECTION
and COMPLAINT types plus a REJECTED state, and keep the console
GraphQL, @probo/helpers and the MCP specification in sync. Expose a
trust GraphQL surface (myRightsRequests query, createRightsRequest
mutation) backed by a trust service and contact-scoped coredata
loaders.

Add the missing v2 UI kit primitives the dialog needs on top of Base
UI: a SegmentedControl radio-cards group, a form Textarea, and a
Field wrapper.

Signed-off-by: Émile Ré <emile@probo.com>
2026-07-20 14:31:42 +02:00

83 lines
2.4 KiB
Go

// Copyright (c) 2025-2026 Probo Inc <hello@probo.com>.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
package coredata
import (
"encoding"
"fmt"
)
type RightsRequestState string
const (
RightsRequestStateTodo RightsRequestState = "TODO"
RightsRequestStateInProgress RightsRequestState = "IN_PROGRESS"
RightsRequestStateDone RightsRequestState = "DONE"
RightsRequestStateRejected RightsRequestState = "REJECTED"
)
var (
_ fmt.Stringer = RightsRequestState("")
_ encoding.TextMarshaler = RightsRequestState("")
_ encoding.TextUnmarshaler = (*RightsRequestState)(nil)
)
func RightsRequestStates() []RightsRequestState {
return []RightsRequestState{
RightsRequestStateTodo,
RightsRequestStateInProgress,
RightsRequestStateDone,
RightsRequestStateRejected,
}
}
func (v RightsRequestState) IsValid() bool {
switch v {
case
RightsRequestStateTodo,
RightsRequestStateInProgress,
RightsRequestStateDone,
RightsRequestStateRejected:
return true
}
return false
}
func (v RightsRequestState) String() string {
return string(v)
}
func (v RightsRequestState) MarshalText() ([]byte, error) {
return []byte(v.String()), nil
}
func (v *RightsRequestState) UnmarshalText(text []byte) error {
val := RightsRequestState(text)
if !val.IsValid() {
return fmt.Errorf("invalid RightsRequestState value: %q", string(text))
}
*v = val
return nil
}