Add right requests
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
@@ -260,6 +260,42 @@ enum ContinualImprovementPriority
|
||||
)
|
||||
}
|
||||
|
||||
enum RightsRequestType
|
||||
@goModel(
|
||||
model: "go.probo.inc/probo/pkg/coredata.RightsRequestType"
|
||||
) {
|
||||
ACCESS
|
||||
@goEnum(
|
||||
value: "go.probo.inc/probo/pkg/coredata.RightsRequestTypeAccess"
|
||||
)
|
||||
DELETION
|
||||
@goEnum(
|
||||
value: "go.probo.inc/probo/pkg/coredata.RightsRequestTypeDeletion"
|
||||
)
|
||||
PORTABILITY
|
||||
@goEnum(
|
||||
value: "go.probo.inc/probo/pkg/coredata.RightsRequestTypePortability"
|
||||
)
|
||||
}
|
||||
|
||||
enum RightsRequestState
|
||||
@goModel(
|
||||
model: "go.probo.inc/probo/pkg/coredata.RightsRequestState"
|
||||
) {
|
||||
TODO
|
||||
@goEnum(
|
||||
value: "go.probo.inc/probo/pkg/coredata.RightsRequestStateTodo"
|
||||
)
|
||||
IN_PROGRESS
|
||||
@goEnum(
|
||||
value: "go.probo.inc/probo/pkg/coredata.RightsRequestStateInProgress"
|
||||
)
|
||||
DONE
|
||||
@goEnum(
|
||||
value: "go.probo.inc/probo/pkg/coredata.RightsRequestStateDone"
|
||||
)
|
||||
}
|
||||
|
||||
enum ProcessingActivitySpecialOrCriminalDatum
|
||||
@goModel(
|
||||
model: "go.probo.inc/probo/pkg/coredata.ProcessingActivitySpecialOrCriminalDatum"
|
||||
@@ -1065,6 +1101,28 @@ enum ContinualImprovementOrderField
|
||||
)
|
||||
}
|
||||
|
||||
enum RightsRequestOrderField
|
||||
@goModel(
|
||||
model: "go.probo.inc/probo/pkg/coredata.RightsRequestOrderField"
|
||||
) {
|
||||
CREATED_AT
|
||||
@goEnum(
|
||||
value: "go.probo.inc/probo/pkg/coredata.RightsRequestOrderFieldCreatedAt"
|
||||
)
|
||||
DEADLINE
|
||||
@goEnum(
|
||||
value: "go.probo.inc/probo/pkg/coredata.RightsRequestOrderFieldDeadline"
|
||||
)
|
||||
STATE
|
||||
@goEnum(
|
||||
value: "go.probo.inc/probo/pkg/coredata.RightsRequestOrderFieldState"
|
||||
)
|
||||
TYPE
|
||||
@goEnum(
|
||||
value: "go.probo.inc/probo/pkg/coredata.RightsRequestOrderFieldType"
|
||||
)
|
||||
}
|
||||
|
||||
enum ProcessingActivityOrderField
|
||||
@goModel(
|
||||
model: "go.probo.inc/probo/pkg/coredata.ProcessingActivityOrderField"
|
||||
@@ -1344,6 +1402,14 @@ input ContinualImprovementOrder
|
||||
field: ContinualImprovementOrderField!
|
||||
}
|
||||
|
||||
input RightsRequestOrder
|
||||
@goModel(
|
||||
model: "go.probo.inc/probo/pkg/server/api/console/v1/types.RightsRequestOrderBy"
|
||||
) {
|
||||
direction: OrderDirection!
|
||||
field: RightsRequestOrderField!
|
||||
}
|
||||
|
||||
input ProcessingActivityOrder
|
||||
@goModel(
|
||||
model: "go.probo.inc/probo/pkg/server/api/console/v1/types.ProcessingActivityOrderBy"
|
||||
@@ -1513,6 +1579,7 @@ input ContinualImprovementFilter {
|
||||
snapshotId: ID
|
||||
}
|
||||
|
||||
|
||||
input ProcessingActivityFilter {
|
||||
snapshotId: ID
|
||||
}
|
||||
@@ -1727,6 +1794,14 @@ type Organization implements Node {
|
||||
filter: ContinualImprovementFilter = { snapshotId: null }
|
||||
): ContinualImprovementConnection! @goField(forceResolver: true)
|
||||
|
||||
rightsRequests(
|
||||
first: Int
|
||||
after: CursorKey
|
||||
last: Int
|
||||
before: CursorKey
|
||||
orderBy: RightsRequestOrder
|
||||
): RightsRequestConnection! @goField(forceResolver: true)
|
||||
|
||||
processingActivities(
|
||||
first: Int
|
||||
after: CursorKey
|
||||
@@ -2326,6 +2401,20 @@ type ContinualImprovement implements Node {
|
||||
updatedAt: Datetime!
|
||||
}
|
||||
|
||||
type RightsRequest implements Node {
|
||||
id: ID!
|
||||
organization: Organization! @goField(forceResolver: true)
|
||||
requestType: RightsRequestType!
|
||||
requestState: RightsRequestState!
|
||||
dataSubject: String
|
||||
contact: String
|
||||
details: String
|
||||
deadline: Datetime
|
||||
actionTaken: String
|
||||
createdAt: Datetime!
|
||||
updatedAt: Datetime!
|
||||
}
|
||||
|
||||
type ProcessingActivity implements Node {
|
||||
id: ID!
|
||||
snapshotId: ID
|
||||
@@ -2879,6 +2968,20 @@ type ContinualImprovementEdge {
|
||||
node: ContinualImprovement!
|
||||
}
|
||||
|
||||
type RightsRequestConnection
|
||||
@goModel(
|
||||
model: "go.probo.inc/probo/pkg/server/api/console/v1/types.RightsRequestConnection"
|
||||
) {
|
||||
totalCount: Int! @goField(forceResolver: true)
|
||||
edges: [RightsRequestEdge!]!
|
||||
pageInfo: PageInfo!
|
||||
}
|
||||
|
||||
type RightsRequestEdge {
|
||||
cursor: CursorKey!
|
||||
node: RightsRequest!
|
||||
}
|
||||
|
||||
type ProcessingActivityConnection
|
||||
@goModel(
|
||||
model: "go.probo.inc/probo/pkg/server/api/console/v1/types.ProcessingActivityConnection"
|
||||
@@ -3246,6 +3349,20 @@ type Mutation {
|
||||
deleteContinualImprovement(
|
||||
input: DeleteContinualImprovementInput!
|
||||
): DeleteContinualImprovementPayload!
|
||||
|
||||
# Rights Request mutations
|
||||
createRightsRequest(
|
||||
input: CreateRightsRequestInput!
|
||||
): CreateRightsRequestPayload!
|
||||
|
||||
updateRightsRequest(
|
||||
input: UpdateRightsRequestInput!
|
||||
): UpdateRightsRequestPayload!
|
||||
|
||||
deleteRightsRequest(
|
||||
input: DeleteRightsRequestInput!
|
||||
): DeleteRightsRequestPayload!
|
||||
|
||||
# Processing Activity mutations
|
||||
createProcessingActivity(
|
||||
input: CreateProcessingActivityInput!
|
||||
@@ -4022,6 +4139,32 @@ input DeleteContinualImprovementInput {
|
||||
continualImprovementId: ID!
|
||||
}
|
||||
|
||||
input CreateRightsRequestInput {
|
||||
organizationId: ID!
|
||||
requestType: RightsRequestType!
|
||||
requestState: RightsRequestState!
|
||||
dataSubject: String
|
||||
contact: String
|
||||
details: String
|
||||
deadline: Datetime
|
||||
actionTaken: String
|
||||
}
|
||||
|
||||
input UpdateRightsRequestInput {
|
||||
id: ID!
|
||||
requestType: RightsRequestType
|
||||
requestState: RightsRequestState
|
||||
dataSubject: String @goField(omittable: true)
|
||||
contact: String @goField(omittable: true)
|
||||
details: String @goField(omittable: true)
|
||||
deadline: Datetime @goField(omittable: true)
|
||||
actionTaken: String @goField(omittable: true)
|
||||
}
|
||||
|
||||
input DeleteRightsRequestInput {
|
||||
rightsRequestId: ID!
|
||||
}
|
||||
|
||||
input CreateProcessingActivityInput {
|
||||
organizationId: ID!
|
||||
name: String!
|
||||
@@ -4964,6 +5107,18 @@ type DeleteContinualImprovementPayload {
|
||||
deletedContinualImprovementId: ID!
|
||||
}
|
||||
|
||||
type CreateRightsRequestPayload {
|
||||
rightsRequestEdge: RightsRequestEdge!
|
||||
}
|
||||
|
||||
type UpdateRightsRequestPayload {
|
||||
rightsRequest: RightsRequest!
|
||||
}
|
||||
|
||||
type DeleteRightsRequestPayload {
|
||||
deletedRightsRequestId: ID!
|
||||
}
|
||||
|
||||
type CreateProcessingActivityPayload {
|
||||
processingActivityEdge: ProcessingActivityEdge!
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
75
pkg/server/api/console/v1/types/rights_request.go
Normal file
75
pkg/server/api/console/v1/types/rights_request.go
Normal file
@@ -0,0 +1,75 @@
|
||||
// Copyright (c) 2025 Probo Inc <hello@getprobo.com>.
|
||||
//
|
||||
// Permission to use, copy, modify, and/or distribute this software for any
|
||||
// purpose with or without fee is hereby granted, provided that the above
|
||||
// copyright notice and this permission notice appear in all copies.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
// AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
// PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
package types
|
||||
|
||||
import (
|
||||
"go.probo.inc/probo/pkg/coredata"
|
||||
"go.probo.inc/probo/pkg/gid"
|
||||
"go.probo.inc/probo/pkg/page"
|
||||
)
|
||||
|
||||
type (
|
||||
RightsRequestOrderBy OrderBy[coredata.RightsRequestOrderField]
|
||||
|
||||
RightsRequestConnection struct {
|
||||
TotalCount int
|
||||
Edges []*RightsRequestEdge
|
||||
PageInfo PageInfo
|
||||
|
||||
Resolver any
|
||||
ParentID gid.GID
|
||||
}
|
||||
)
|
||||
|
||||
func NewRightsRequestConnection(
|
||||
p *page.Page[*coredata.RightsRequest, coredata.RightsRequestOrderField],
|
||||
parentType any,
|
||||
parentID gid.GID,
|
||||
) *RightsRequestConnection {
|
||||
edges := make([]*RightsRequestEdge, len(p.Data))
|
||||
for i, request := range p.Data {
|
||||
edges[i] = NewRightsRequestEdge(request, p.Cursor.OrderBy.Field)
|
||||
}
|
||||
|
||||
return &RightsRequestConnection{
|
||||
Edges: edges,
|
||||
PageInfo: *NewPageInfo(p),
|
||||
|
||||
Resolver: parentType,
|
||||
ParentID: parentID,
|
||||
}
|
||||
}
|
||||
|
||||
func NewRightsRequest(rr *coredata.RightsRequest) *RightsRequest {
|
||||
return &RightsRequest{
|
||||
ID: rr.ID,
|
||||
RequestType: rr.RequestType,
|
||||
RequestState: rr.RequestState,
|
||||
DataSubject: rr.DataSubject,
|
||||
Contact: rr.Contact,
|
||||
Details: rr.Details,
|
||||
Deadline: rr.Deadline,
|
||||
ActionTaken: rr.ActionTaken,
|
||||
CreatedAt: rr.CreatedAt,
|
||||
UpdatedAt: rr.UpdatedAt,
|
||||
}
|
||||
}
|
||||
|
||||
func NewRightsRequestEdge(rr *coredata.RightsRequest, orderField coredata.RightsRequestOrderField) *RightsRequestEdge {
|
||||
return &RightsRequestEdge{
|
||||
Node: NewRightsRequest(rr),
|
||||
Cursor: rr.CursorKey(orderField),
|
||||
}
|
||||
}
|
||||
@@ -464,6 +464,21 @@ type CreateProcessingActivityPayload struct {
|
||||
ProcessingActivityEdge *ProcessingActivityEdge `json:"processingActivityEdge"`
|
||||
}
|
||||
|
||||
type CreateRightsRequestInput struct {
|
||||
OrganizationID gid.GID `json:"organizationId"`
|
||||
RequestType coredata.RightsRequestType `json:"requestType"`
|
||||
RequestState coredata.RightsRequestState `json:"requestState"`
|
||||
DataSubject *string `json:"dataSubject,omitempty"`
|
||||
Contact *string `json:"contact,omitempty"`
|
||||
Details *string `json:"details,omitempty"`
|
||||
Deadline *time.Time `json:"deadline,omitempty"`
|
||||
ActionTaken *string `json:"actionTaken,omitempty"`
|
||||
}
|
||||
|
||||
type CreateRightsRequestPayload struct {
|
||||
RightsRequestEdge *RightsRequestEdge `json:"rightsRequestEdge"`
|
||||
}
|
||||
|
||||
type CreateRiskDocumentMappingInput struct {
|
||||
RiskID gid.GID `json:"riskId"`
|
||||
DocumentID gid.GID `json:"documentId"`
|
||||
@@ -934,6 +949,14 @@ type DeleteProcessingActivityPayload struct {
|
||||
DeletedProcessingActivityID gid.GID `json:"deletedProcessingActivityId"`
|
||||
}
|
||||
|
||||
type DeleteRightsRequestInput struct {
|
||||
RightsRequestID gid.GID `json:"rightsRequestId"`
|
||||
}
|
||||
|
||||
type DeleteRightsRequestPayload struct {
|
||||
DeletedRightsRequestID gid.GID `json:"deletedRightsRequestId"`
|
||||
}
|
||||
|
||||
type DeleteRiskDocumentMappingInput struct {
|
||||
RiskID gid.GID `json:"riskId"`
|
||||
DocumentID gid.GID `json:"documentId"`
|
||||
@@ -1515,6 +1538,7 @@ type Organization struct {
|
||||
Nonconformities *NonconformityConnection `json:"nonconformities"`
|
||||
Obligations *ObligationConnection `json:"obligations"`
|
||||
ContinualImprovements *ContinualImprovementConnection `json:"continualImprovements"`
|
||||
RightsRequests *RightsRequestConnection `json:"rightsRequests"`
|
||||
ProcessingActivities *ProcessingActivityConnection `json:"processingActivities"`
|
||||
DataProtectionImpactAssessments *DataProtectionImpactAssessmentConnection `json:"dataProtectionImpactAssessments"`
|
||||
TransferImpactAssessments *TransferImpactAssessmentConnection `json:"transferImpactAssessments"`
|
||||
@@ -1682,6 +1706,28 @@ type RequestSignaturePayload struct {
|
||||
DocumentVersionSignatureEdge *DocumentVersionSignatureEdge `json:"documentVersionSignatureEdge"`
|
||||
}
|
||||
|
||||
type RightsRequest struct {
|
||||
ID gid.GID `json:"id"`
|
||||
Organization *Organization `json:"organization"`
|
||||
RequestType coredata.RightsRequestType `json:"requestType"`
|
||||
RequestState coredata.RightsRequestState `json:"requestState"`
|
||||
DataSubject *string `json:"dataSubject,omitempty"`
|
||||
Contact *string `json:"contact,omitempty"`
|
||||
Details *string `json:"details,omitempty"`
|
||||
Deadline *time.Time `json:"deadline,omitempty"`
|
||||
ActionTaken *string `json:"actionTaken,omitempty"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
}
|
||||
|
||||
func (RightsRequest) IsNode() {}
|
||||
func (this RightsRequest) GetID() gid.GID { return this.ID }
|
||||
|
||||
type RightsRequestEdge struct {
|
||||
Cursor page.CursorKey `json:"cursor"`
|
||||
Node *RightsRequest `json:"node"`
|
||||
}
|
||||
|
||||
type Risk struct {
|
||||
ID gid.GID `json:"id"`
|
||||
SnapshotID *gid.GID `json:"snapshotId,omitempty"`
|
||||
@@ -2199,6 +2245,21 @@ type UpdateProcessingActivityPayload struct {
|
||||
ProcessingActivity *ProcessingActivity `json:"processingActivity"`
|
||||
}
|
||||
|
||||
type UpdateRightsRequestInput struct {
|
||||
ID gid.GID `json:"id"`
|
||||
RequestType *coredata.RightsRequestType `json:"requestType,omitempty"`
|
||||
RequestState *coredata.RightsRequestState `json:"requestState,omitempty"`
|
||||
DataSubject graphql.Omittable[*string] `json:"dataSubject,omitempty"`
|
||||
Contact graphql.Omittable[*string] `json:"contact,omitempty"`
|
||||
Details graphql.Omittable[*string] `json:"details,omitempty"`
|
||||
Deadline graphql.Omittable[*time.Time] `json:"deadline,omitempty"`
|
||||
ActionTaken graphql.Omittable[*string] `json:"actionTaken,omitempty"`
|
||||
}
|
||||
|
||||
type UpdateRightsRequestPayload struct {
|
||||
RightsRequest *RightsRequest `json:"rightsRequest"`
|
||||
}
|
||||
|
||||
type UpdateRiskInput struct {
|
||||
ID gid.GID `json:"id"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
|
||||
@@ -4243,6 +4243,76 @@ func (r *mutationResolver) DeleteContinualImprovement(ctx context.Context, input
|
||||
}, nil
|
||||
}
|
||||
|
||||
// CreateRightsRequest is the resolver for the createRightsRequest field.
|
||||
func (r *mutationResolver) CreateRightsRequest(ctx context.Context, input types.CreateRightsRequestInput) (*types.CreateRightsRequestPayload, error) {
|
||||
r.MustBeAuthorized(ctx, input.OrganizationID, authz.ActionCreateRightsRequest)
|
||||
|
||||
prb := r.ProboService(ctx, input.OrganizationID.TenantID())
|
||||
|
||||
req := probo.CreateRightsRequestRequest{
|
||||
OrganizationID: input.OrganizationID,
|
||||
RequestType: &input.RequestType,
|
||||
RequestState: &input.RequestState,
|
||||
DataSubject: input.DataSubject,
|
||||
Contact: input.Contact,
|
||||
Details: input.Details,
|
||||
Deadline: input.Deadline,
|
||||
ActionTaken: input.ActionTaken,
|
||||
}
|
||||
|
||||
rightsRequest, err := prb.RightsRequests.Create(ctx, &req)
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("cannot create rights request: %w", err))
|
||||
}
|
||||
|
||||
return &types.CreateRightsRequestPayload{
|
||||
RightsRequestEdge: types.NewRightsRequestEdge(rightsRequest, coredata.RightsRequestOrderFieldCreatedAt),
|
||||
}, nil
|
||||
}
|
||||
|
||||
// UpdateRightsRequest is the resolver for the updateRightsRequest field.
|
||||
func (r *mutationResolver) UpdateRightsRequest(ctx context.Context, input types.UpdateRightsRequestInput) (*types.UpdateRightsRequestPayload, error) {
|
||||
r.MustBeAuthorized(ctx, input.ID, authz.ActionUpdateRightsRequest)
|
||||
|
||||
prb := r.ProboService(ctx, input.ID.TenantID())
|
||||
|
||||
req := probo.UpdateRightsRequestRequest{
|
||||
ID: input.ID,
|
||||
RequestType: input.RequestType,
|
||||
RequestState: input.RequestState,
|
||||
DataSubject: UnwrapOmittable(input.DataSubject),
|
||||
Contact: UnwrapOmittable(input.Contact),
|
||||
Details: UnwrapOmittable(input.Details),
|
||||
Deadline: UnwrapOmittable(input.Deadline),
|
||||
ActionTaken: UnwrapOmittable(input.ActionTaken),
|
||||
}
|
||||
|
||||
rightsRequest, err := prb.RightsRequests.Update(ctx, &req)
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("cannot update rights request: %w", err))
|
||||
}
|
||||
|
||||
return &types.UpdateRightsRequestPayload{
|
||||
RightsRequest: types.NewRightsRequest(rightsRequest),
|
||||
}, nil
|
||||
}
|
||||
|
||||
// DeleteRightsRequest is the resolver for the deleteRightsRequest field.
|
||||
func (r *mutationResolver) DeleteRightsRequest(ctx context.Context, input types.DeleteRightsRequestInput) (*types.DeleteRightsRequestPayload, error) {
|
||||
r.MustBeAuthorized(ctx, input.RightsRequestID, authz.ActionDeleteRightsRequest)
|
||||
|
||||
prb := r.ProboService(ctx, input.RightsRequestID.TenantID())
|
||||
|
||||
err := prb.RightsRequests.Delete(ctx, input.RightsRequestID)
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("cannot delete rights request: %w", err))
|
||||
}
|
||||
|
||||
return &types.DeleteRightsRequestPayload{
|
||||
DeletedRightsRequestID: input.RightsRequestID,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// CreateProcessingActivity is the resolver for the createProcessingActivity field.
|
||||
func (r *mutationResolver) CreateProcessingActivity(ctx context.Context, input types.CreateProcessingActivityInput) (*types.CreateProcessingActivityPayload, error) {
|
||||
r.MustBeAuthorized(ctx, input.OrganizationID, authz.ActionCreateProcessingActivity)
|
||||
@@ -5535,6 +5605,34 @@ func (r *organizationResolver) ContinualImprovements(ctx context.Context, obj *t
|
||||
return types.NewContinualImprovementConnection(page, r, obj.ID, filter), nil
|
||||
}
|
||||
|
||||
// RightsRequests is the resolver for the rightsRequests field.
|
||||
func (r *organizationResolver) RightsRequests(ctx context.Context, obj *types.Organization, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.RightsRequestOrderBy) (*types.RightsRequestConnection, error) {
|
||||
r.MustBeAuthorized(ctx, obj.ID, authz.ActionListRightsRequests)
|
||||
|
||||
prb := r.ProboService(ctx, obj.ID.TenantID())
|
||||
|
||||
pageOrderBy := page.OrderBy[coredata.RightsRequestOrderField]{
|
||||
Field: coredata.RightsRequestOrderFieldCreatedAt,
|
||||
Direction: page.OrderDirectionDesc,
|
||||
}
|
||||
|
||||
if orderBy != nil {
|
||||
pageOrderBy = page.OrderBy[coredata.RightsRequestOrderField]{
|
||||
Field: orderBy.Field,
|
||||
Direction: orderBy.Direction,
|
||||
}
|
||||
}
|
||||
|
||||
cursor := types.NewCursor(first, after, last, before, pageOrderBy)
|
||||
|
||||
page, err := prb.RightsRequests.ListForOrganizationID(ctx, obj.ID, cursor)
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("cannot list organization rights requests: %w", err))
|
||||
}
|
||||
|
||||
return types.NewRightsRequestConnection(page, r, obj.ID), nil
|
||||
}
|
||||
|
||||
// ProcessingActivities is the resolver for the processingActivities field.
|
||||
func (r *organizationResolver) ProcessingActivities(ctx context.Context, obj *types.Organization, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.ProcessingActivityOrderBy, filter *types.ProcessingActivityFilter) (*types.ProcessingActivityConnection, error) {
|
||||
r.MustBeAuthorized(ctx, obj.ID, authz.ActionListProcessingActivities)
|
||||
@@ -6146,6 +6244,17 @@ func (r *queryResolver) Node(ctx context.Context, id gid.GID) (types.Node, error
|
||||
}
|
||||
|
||||
return types.NewMeeting(meeting), nil
|
||||
case coredata.RightsRequestEntityType:
|
||||
rightsRequest, err := prb.RightsRequests.Get(ctx, id)
|
||||
if err != nil {
|
||||
var errNotFound *coredata.ErrRightsRequestNotFound
|
||||
if errors.As(err, &errNotFound) {
|
||||
return nil, gqlutils.NotFound(errNotFound)
|
||||
}
|
||||
panic(fmt.Errorf("cannot get rights request: %w", err))
|
||||
}
|
||||
|
||||
return types.NewRightsRequest(rightsRequest), nil
|
||||
default:
|
||||
}
|
||||
|
||||
@@ -6201,6 +6310,48 @@ func (r *reportResolver) Audit(ctx context.Context, obj *types.Report) (*types.A
|
||||
return types.NewAudit(audit), nil
|
||||
}
|
||||
|
||||
// Organization is the resolver for the organization field.
|
||||
func (r *rightsRequestResolver) Organization(ctx context.Context, obj *types.RightsRequest) (*types.Organization, error) {
|
||||
r.MustBeAuthorized(ctx, obj.ID, authz.ActionGetOrganization)
|
||||
|
||||
prb := r.ProboService(ctx, obj.ID.TenantID())
|
||||
|
||||
rightsRequest, err := prb.RightsRequests.Get(ctx, obj.ID)
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("cannot get rights request: %w", err))
|
||||
}
|
||||
|
||||
organization, err := prb.Organizations.Get(ctx, rightsRequest.OrganizationID)
|
||||
if err != nil {
|
||||
var errNotFound *coredata.ErrOrganizationNotFound
|
||||
if errors.As(err, &errNotFound) {
|
||||
return nil, gqlutils.NotFound(errNotFound)
|
||||
}
|
||||
panic(fmt.Errorf("cannot get organization: %w", err))
|
||||
}
|
||||
|
||||
return types.NewOrganization(organization), nil
|
||||
}
|
||||
|
||||
// TotalCount is the resolver for the totalCount field.
|
||||
func (r *rightsRequestConnectionResolver) TotalCount(ctx context.Context, obj *types.RightsRequestConnection) (int, error) {
|
||||
r.MustBeAuthorized(ctx, obj.ParentID, authz.ActionTotalCount)
|
||||
|
||||
prb := r.ProboService(ctx, obj.ParentID.TenantID())
|
||||
|
||||
switch obj.Resolver.(type) {
|
||||
case *organizationResolver:
|
||||
count, err := prb.RightsRequests.CountByOrganizationID(ctx, obj.ParentID)
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("cannot count rights requests: %w", err))
|
||||
}
|
||||
|
||||
return count, nil
|
||||
default:
|
||||
panic(fmt.Errorf("unsupported resolver type for RightsRequestConnection: %T", obj.Resolver))
|
||||
}
|
||||
}
|
||||
|
||||
// Owner is the resolver for the owner field.
|
||||
func (r *riskResolver) Owner(ctx context.Context, obj *types.Risk) (*types.People, error) {
|
||||
r.MustBeAuthorized(ctx, obj.ID, authz.ActionGetOwner)
|
||||
@@ -7789,6 +7940,14 @@ func (r *Resolver) Query() schema.QueryResolver { return &queryResolver{r} }
|
||||
// Report returns schema.ReportResolver implementation.
|
||||
func (r *Resolver) Report() schema.ReportResolver { return &reportResolver{r} }
|
||||
|
||||
// RightsRequest returns schema.RightsRequestResolver implementation.
|
||||
func (r *Resolver) RightsRequest() schema.RightsRequestResolver { return &rightsRequestResolver{r} }
|
||||
|
||||
// RightsRequestConnection returns schema.RightsRequestConnectionResolver implementation.
|
||||
func (r *Resolver) RightsRequestConnection() schema.RightsRequestConnectionResolver {
|
||||
return &rightsRequestConnectionResolver{r}
|
||||
}
|
||||
|
||||
// Risk returns schema.RiskResolver implementation.
|
||||
func (r *Resolver) Risk() schema.RiskResolver { return &riskResolver{r} }
|
||||
|
||||
@@ -7947,6 +8106,8 @@ type processingActivityResolver struct{ *Resolver }
|
||||
type processingActivityConnectionResolver struct{ *Resolver }
|
||||
type queryResolver struct{ *Resolver }
|
||||
type reportResolver struct{ *Resolver }
|
||||
type rightsRequestResolver struct{ *Resolver }
|
||||
type rightsRequestConnectionResolver struct{ *Resolver }
|
||||
type riskResolver struct{ *Resolver }
|
||||
type riskConnectionResolver struct{ *Resolver }
|
||||
type sAMLConfigurationResolver struct{ *Resolver }
|
||||
|
||||
Reference in New Issue
Block a user