Update console gql schema and resolver

Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
Émile Ré
2026-02-05 14:50:10 +04:00
parent f8744100e2
commit ae6c6719d2
24 changed files with 851 additions and 3000 deletions

View File

@@ -69,14 +69,14 @@ enum EvidenceState
@goEnum(value: "go.probo.inc/probo/pkg/coredata.EvidenceStateRequested")
}
enum PeopleKind @goModel(model: "go.probo.inc/probo/pkg/coredata.PeopleKind") {
enum MembershipProfileKind @goModel(model: "go.probo.inc/probo/pkg/coredata.MembershipProfileKind") {
EMPLOYEE
@goEnum(value: "go.probo.inc/probo/pkg/coredata.PeopleKindEmployee")
@goEnum(value: "go.probo.inc/probo/pkg/coredata.MembershipProfileKindEmployee")
CONTRACTOR
@goEnum(value: "go.probo.inc/probo/pkg/coredata.PeopleKindContractor")
@goEnum(value: "go.probo.inc/probo/pkg/coredata.MembershipProfileKindContractor")
SERVICE_ACCOUNT
@goEnum(
value: "go.probo.inc/probo/pkg/coredata.PeopleKindServiceAccount"
value: "go.probo.inc/probo/pkg/coredata.MembershipProfileKindServiceAccount"
)
}
@@ -402,17 +402,17 @@ enum ProcessingActivityRole
}
# Order Field Enums
enum PeopleOrderField
@goModel(model: "go.probo.inc/probo/pkg/coredata.PeopleOrderField") {
enum ProfileOrderField
@goModel(model: "go.probo.inc/probo/pkg/coredata.MembershipProfileOrderField") {
FULL_NAME
@goEnum(
value: "go.probo.inc/probo/pkg/coredata.PeopleOrderFieldFullName"
value: "go.probo.inc/probo/pkg/coredata.MembershipProfileOrderFieldFullName"
)
CREATED_AT
@goEnum(
value: "go.probo.inc/probo/pkg/coredata.PeopleOrderFieldCreatedAt"
value: "go.probo.inc/probo/pkg/coredata.MembershipProfileOrderFieldCreatedAt"
)
KIND @goEnum(value: "go.probo.inc/probo/pkg/coredata.PeopleOrderFieldKind")
KIND @goEnum(value: "go.probo.inc/probo/pkg/coredata.MembershipProfileOrderFieldKind")
}
enum VendorOrderField
@@ -1281,12 +1281,12 @@ enum SnapshotOrderField
}
# Input Types
input PeopleOrder
input ProfileOrder
@goModel(
model: "go.probo.inc/probo/pkg/server/api/console/v1/types.PeopleOrderBy"
model: "go.probo.inc/probo/pkg/server/api/console/v1/types.ProfileOrderBy"
) {
direction: OrderDirection!
field: PeopleOrderField!
field: ProfileOrderField!
}
input VendorOrder
@@ -1648,15 +1648,6 @@ type Organization implements Node {
filter: VendorFilter = { snapshotId: null }
): VendorConnection! @goField(forceResolver: true)
peoples(
first: Int
after: CursorKey
last: Int
before: CursorKey
orderBy: PeopleOrder
filter: PeopleFilter
): PeopleConnection! @goField(forceResolver: true)
documents(
first: Int
after: CursorKey
@@ -1844,24 +1835,9 @@ type SlackConnectionEdge {
type Profile implements Node {
id: ID!
fullName: String!
email_address: EmailAddr!
emailAddress: EmailAddr!
additionalEmailAddresses: [EmailAddr!]!
kind: PeopleKind!
position: String
contractStartDate: Datetime
contractEndDate: Datetime
createdAt: Datetime!
updatedAt: Datetime!
permission(action: String!): Boolean! @goField(forceResolver: true)
}
type People implements Node {
id: ID!
fullName: String!
primaryEmailAddress: EmailAddr!
additionalEmailAddresses: [EmailAddr!]!
kind: PeopleKind!
kind: MembershipProfileKind!
position: String
contractStartDate: Datetime
contractEndDate: Datetime
@@ -1917,8 +1893,8 @@ type Vendor implements Node {
orderBy: VendorRiskAssessmentOrder
): VendorRiskAssessmentConnection! @goField(forceResolver: true)
businessOwner: People @goField(forceResolver: true)
securityOwner: People @goField(forceResolver: true)
businessOwner: Profile @goField(forceResolver: true)
securityOwner: Profile @goField(forceResolver: true)
statusPageUrl: String
termsOfServiceUrl: String
@@ -2148,7 +2124,7 @@ type Task implements Node {
state: TaskState!
timeEstimate: Duration
deadline: Datetime
assignedTo: People @goField(forceResolver: true)
assignedTo: Profile @goField(forceResolver: true)
organization: Organization! @goField(forceResolver: true)
measure: Measure @goField(forceResolver: true)
@@ -2193,7 +2169,7 @@ type Document implements Node {
classification: DocumentClassification!
currentPublishedVersion: Int
trustCenterVisibility: TrustCenterVisibility!
owner: People! @goField(forceResolver: true)
owner: Profile! @goField(forceResolver: true)
organization: Organization! @goField(forceResolver: true)
versions(
@@ -2263,7 +2239,7 @@ type StateOfApplicability implements Node {
sourceId: ID
snapshotId: ID
organization: Organization @goField(forceResolver: true)
owner: People! @goField(forceResolver: true)
owner: Profile! @goField(forceResolver: true)
createdAt: Datetime!
updatedAt: Datetime!
@@ -2319,7 +2295,7 @@ type Risk implements Node {
residualRiskScore: Int!
note: String!
owner: People @goField(forceResolver: true)
owner: Profile @goField(forceResolver: true)
organization: Organization! @goField(forceResolver: true)
measures(
@@ -2401,7 +2377,7 @@ type Nonconformity implements Node {
dateIdentified: Datetime
rootCause: String!
correctiveAction: String
owner: People! @goField(forceResolver: true)
owner: Profile! @goField(forceResolver: true)
dueDate: Datetime
status: NonconformityStatus!
effectivenessCheck: String
@@ -2421,7 +2397,7 @@ type Obligation implements Node {
requirement: String
actionsToBeImplemented: String
regulator: String
owner: People! @goField(forceResolver: true)
owner: Profile! @goField(forceResolver: true)
lastReviewDate: Datetime
dueDate: Datetime
status: ObligationStatus!
@@ -2440,7 +2416,7 @@ type ContinualImprovement implements Node {
referenceId: String!
description: String
source: String
owner: People! @goField(forceResolver: true)
owner: Profile! @goField(forceResolver: true)
targetDate: Datetime
status: ContinualImprovementStatus!
priority: ContinualImprovementPriority!
@@ -2489,7 +2465,7 @@ type ProcessingActivity implements Node {
lastReviewDate: Datetime
nextReviewDate: Datetime
role: ProcessingActivityRole!
dataProtectionOfficer: People @goField(forceResolver: true)
dataProtectionOfficer: Profile @goField(forceResolver: true)
vendors(
first: Int
after: CursorKey
@@ -2710,11 +2686,10 @@ type TrustCenterFileEdge {
}
type ProfileConnection
# @goModel(
# model: "go.probo.inc/probo/pkg/server/api/console/v1/types.ProfileConnection"
# ) {
# totalCount: Int! @goField(forceResolver: true)
{
@goModel(
model: "go.probo.inc/probo/pkg/server/api/console/v1/types.ProfileConnection"
) {
totalCount: Int! @goField(forceResolver: true)
edges: [ProfileEdge!]!
pageInfo: PageInfo!
}
@@ -2724,20 +2699,6 @@ type ProfileEdge {
node: Profile!
}
type PeopleConnection
@goModel(
model: "go.probo.inc/probo/pkg/server/api/console/v1/types.PeopleConnection"
) {
totalCount: Int! @goField(forceResolver: true)
edges: [PeopleEdge!]!
pageInfo: PageInfo!
}
type PeopleEdge {
cursor: CursorKey!
node: People!
}
type VendorConnection
@goModel(
model: "go.probo.inc/probo/pkg/server/api/console/v1/types.VendorConnection"
@@ -3152,10 +3113,6 @@ type Mutation {
input: DeleteTrustCenterFileInput!
): DeleteTrustCenterFilePayload!
# People mutations
createPeople(input: CreatePeopleInput!): CreatePeoplePayload!
updatePeople(input: UpdatePeopleInput!): UpdatePeoplePayload!
deletePeople(input: DeletePeopleInput!): DeletePeoplePayload!
# Vendor mutations
createVendor(input: CreateVendorInput!): CreateVendorPayload!
updateVendor(input: UpdateVendorInput!): UpdateVendorPayload!
@@ -3657,32 +3614,6 @@ input DeleteVendorServiceInput {
vendorServiceId: ID!
}
input CreatePeopleInput {
organizationId: ID!
fullName: String!
primaryEmailAddress: EmailAddr!
additionalEmailAddresses: [EmailAddr!]!
kind: PeopleKind!
position: String
contractStartDate: Datetime
contractEndDate: Datetime
}
input UpdatePeopleInput {
id: ID!
fullName: String
primaryEmailAddress: EmailAddr
additionalEmailAddresses: [EmailAddr!] @goField(omittable: true)
kind: PeopleKind
position: String @goField(omittable: true)
contractStartDate: Datetime @goField(omittable: true)
contractEndDate: Datetime @goField(omittable: true)
}
input DeletePeopleInput {
peopleId: ID!
}
input CreateFrameworkInput {
organizationId: ID!
name: String!
@@ -4452,18 +4383,6 @@ type DeleteVendorServicePayload {
deletedVendorServiceId: ID!
}
type CreatePeoplePayload {
peopleEdge: PeopleEdge!
}
type UpdatePeoplePayload {
people: People!
}
type DeletePeoplePayload {
deletedPeopleId: ID!
}
type CreateFrameworkPayload {
frameworkEdge: FrameworkEdge!
}
@@ -4766,7 +4685,7 @@ type DocumentVersion implements Node {
changelog: String!
title: String!
classification: DocumentClassification!
owner: People! @goField(forceResolver: true)
owner: Profile! @goField(forceResolver: true)
signatures(
first: Int
@@ -4842,7 +4761,7 @@ type DocumentVersionSignature implements Node {
id: ID!
documentVersion: DocumentVersion! @goField(forceResolver: true)
state: DocumentVersionSignatureState!
signedBy: People! @goField(forceResolver: true)
signedBy: Profile! @goField(forceResolver: true)
signedAt: Datetime
requestedAt: Datetime!
createdAt: Datetime!
@@ -4988,7 +4907,7 @@ type Asset implements Node {
snapshotId: ID
name: String!
amount: Int!
owner: People! @goField(forceResolver: true)
owner: Profile! @goField(forceResolver: true)
vendors(
first: Int
after: CursorKey
@@ -5071,7 +4990,7 @@ type Datum implements Node
snapshotId: ID
name: String!
dataClassification: DataClassification!
owner: People! @goField(forceResolver: true)
owner: Profile! @goField(forceResolver: true)
vendors(
first: Int
after: CursorKey

File diff suppressed because it is too large Load Diff

View File

@@ -54,7 +54,7 @@ func NewAsset(asset *coredata.Asset) *Asset {
SnapshotID: asset.SnapshotID,
Name: asset.Name,
Amount: asset.Amount,
Owner: &People{
Owner: &Profile{
ID: asset.OwnerID,
},
AssetType: asset.AssetType,

View File

@@ -69,7 +69,7 @@ func NewContinualImprovement(ci *coredata.ContinualImprovement) *ContinualImprov
Organization: &Organization{
ID: ci.OrganizationID,
},
Owner: &People{
Owner: &Profile{
ID: ci.OwnerID,
},
SourceID: ci.SourceID,

View File

@@ -28,7 +28,7 @@ type Datum struct {
SnapshotID *gid.GID `json:"snapshotId,omitempty"`
Name string `json:"name"`
DataClassification coredata.DataClassification `json:"dataClassification"`
Owner *People `json:"owner"`
Owner *Profile `json:"owner"`
Vendors *VendorConnection `json:"vendors"`
Organization *Organization `json:"organization"`
CreatedAt time.Time `json:"createdAt"`
@@ -79,7 +79,7 @@ func NewDatum(d *coredata.Datum) *Datum {
Organization: &Organization{
ID: d.OrganizationID,
},
Owner: &People{
Owner: &Profile{
ID: d.OwnerID,
},
OrganizationID: d.OrganizationID,

View File

@@ -80,7 +80,7 @@ func NewDocument(document *coredata.Document) *Document {
Organization: &Organization{
ID: document.OrganizationID,
},
Owner: &People{
Owner: &Profile{
ID: document.OwnerID,
},
DocumentType: document.DocumentType,

View File

@@ -76,7 +76,7 @@ func NewDocumentVersion(documentVersion *coredata.DocumentVersion) *DocumentVers
Document: &Document{
ID: documentVersion.DocumentID,
},
Owner: &People{
Owner: &Profile{
ID: documentVersion.OwnerID,
},
Version: documentVersion.VersionNumber,

View File

@@ -76,7 +76,7 @@ func NewDocumentVersionSignature(documentVersionSignature *coredata.DocumentVers
DocumentVersion: &DocumentVersion{
ID: documentVersionSignature.DocumentVersionID,
},
SignedBy: &People{
SignedBy: &Profile{
ID: documentVersionSignature.SignedBy,
},
ID: documentVersionSignature.ID,

View File

@@ -68,7 +68,7 @@ func NewNonconformity(nr *coredata.Nonconformity) *Nonconformity {
Organization: &Organization{
ID: nr.OrganizationID,
},
Owner: &People{
Owner: &Profile{
ID: nr.OwnerID,
},
ReferenceID: nr.ReferenceID,

View File

@@ -63,7 +63,7 @@ func NewObligation(cr *coredata.Obligation) *Obligation {
Organization: &Organization{
ID: cr.OrganizationID,
},
Owner: &People{
Owner: &Profile{
ID: cr.OwnerID,
},
Area: cr.Area,

View File

@@ -1,79 +0,0 @@
// 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 (
PeopleOrderBy OrderBy[coredata.PeopleOrderField]
PeopleConnection struct {
TotalCount int
Edges []*PeopleEdge
PageInfo PageInfo
Resolver any
ParentID gid.GID
Filters *coredata.PeopleFilter
}
)
func NewPeopleConnection(
p *page.Page[*coredata.People, coredata.PeopleOrderField],
parentType any,
parentID gid.GID,
filters *coredata.PeopleFilter,
) *PeopleConnection {
var edges = make([]*PeopleEdge, len(p.Data))
for i := range edges {
edges[i] = NewPeopleEdge(p.Data[i], p.Cursor.OrderBy.Field)
}
return &PeopleConnection{
Edges: edges,
PageInfo: *NewPageInfo(p),
Resolver: parentType,
ParentID: parentID,
Filters: filters,
}
}
func NewPeopleEdge(p *coredata.People, orderBy coredata.PeopleOrderField) *PeopleEdge {
return &PeopleEdge{
Cursor: p.CursorKey(orderBy),
Node: NewPeople(p),
}
}
func NewPeople(p *coredata.People) *People {
return &People{
ID: p.ID,
FullName: p.FullName,
PrimaryEmailAddress: p.PrimaryEmailAddress,
AdditionalEmailAddresses: p.AdditionalEmailAddresses,
Kind: p.Kind,
Position: p.Position,
ContractStartDate: p.ContractStartDate,
ContractEndDate: p.ContractEndDate,
CreatedAt: p.CreatedAt,
UpdatedAt: p.UpdatedAt,
}
}

View File

@@ -93,7 +93,7 @@ func NewProcessingActivity(par *coredata.ProcessingActivity) *ProcessingActivity
}
if par.DataProtectionOfficerID != nil {
object.DataProtectionOfficer = &People{
object.DataProtectionOfficer = &Profile{
ID: *par.DataProtectionOfficerID,
}
}

View File

@@ -14,13 +14,66 @@
package types
import "go.probo.inc/probo/pkg/coredata"
import (
"go.probo.inc/probo/pkg/coredata"
"go.probo.inc/probo/pkg/gid"
"go.probo.inc/probo/pkg/page"
)
type (
ProfileOrderBy OrderBy[coredata.MembershipProfileOrderField]
ProfileConnection struct {
TotalCount int
Edges []*ProfileEdge
PageInfo PageInfo
Resolver any
ParentID gid.GID
Filters *coredata.MembershipProfileFilter
}
)
func NewProfileConnection(
p *page.Page[*coredata.MembershipProfile, coredata.MembershipProfileOrderField],
parentType any,
parentID gid.GID,
filters *coredata.MembershipProfileFilter,
) *ProfileConnection {
var edges = make([]*ProfileEdge, len(p.Data))
for i := range edges {
edges[i] = NewProfileEdge(p.Data[i], p.Cursor.OrderBy.Field)
}
return &ProfileConnection{
Edges: edges,
PageInfo: *NewPageInfo(p),
Resolver: parentType,
ParentID: parentID,
Filters: filters,
}
}
func NewProfileEdge(p *coredata.MembershipProfile, orderBy coredata.MembershipProfileOrderField) *ProfileEdge {
return &ProfileEdge{
Cursor: p.CursorKey(orderBy),
Node: NewProfile(p),
}
}
func NewProfile(profile *coredata.MembershipProfile) *Profile {
return &Profile{
ID: profile.ID,
FullName: profile.FullName,
CreatedAt: profile.CreatedAt,
UpdatedAt: profile.UpdatedAt,
ID: profile.ID,
FullName: profile.FullName,
EmailAddress: profile.EmailAddress,
AdditionalEmailAddresses: profile.AdditionalEmailAddresses,
Kind: profile.Kind,
Position: profile.Position,
ContractStartDate: profile.ContractStartDate,
ContractEndDate: profile.ContractEndDate,
CreatedAt: profile.CreatedAt,
UpdatedAt: profile.UpdatedAt,
}
}

View File

@@ -86,7 +86,7 @@ func NewRisk(r *coredata.Risk) *Risk {
}
if r.OwnerID != nil {
risk.Owner = &People{
risk.Owner = &Profile{
ID: *r.OwnerID,
}
}

View File

@@ -69,7 +69,7 @@ func NewStateOfApplicability(soa *coredata.StateOfApplicability) *StateOfApplica
Organization: &Organization{
ID: soa.OrganizationID,
},
Owner: &People{
Owner: &Profile{
ID: soa.OwnerID,
},
Name: soa.Name,

View File

@@ -83,7 +83,7 @@ func NewTask(t *coredata.Task) *Task {
}
if t.AssignedToID != nil {
node.AssignedTo = &People{
node.AssignedTo = &Profile{
ID: *t.AssignedToID,
}
}

View File

@@ -56,7 +56,7 @@ type Asset struct {
SnapshotID *gid.GID `json:"snapshotId,omitempty"`
Name string `json:"name"`
Amount int `json:"amount"`
Owner *People `json:"owner"`
Owner *Profile `json:"owner"`
Vendors *VendorConnection `json:"vendors"`
AssetType coredata.AssetType `json:"assetType"`
DataTypesStored string `json:"dataTypesStored"`
@@ -157,7 +157,7 @@ type ContinualImprovement struct {
ReferenceID string `json:"referenceId"`
Description *string `json:"description,omitempty"`
Source *string `json:"source,omitempty"`
Owner *People `json:"owner"`
Owner *Profile `json:"owner"`
TargetDate *time.Time `json:"targetDate,omitempty"`
Status coredata.ContinualImprovementStatus `json:"status"`
Priority coredata.ContinualImprovementPriority `json:"priority"`
@@ -457,21 +457,6 @@ type CreateObligationPayload struct {
ObligationEdge *ObligationEdge `json:"obligationEdge"`
}
type CreatePeopleInput struct {
OrganizationID gid.GID `json:"organizationId"`
FullName string `json:"fullName"`
PrimaryEmailAddress mail.Addr `json:"primaryEmailAddress"`
AdditionalEmailAddresses []mail.Addr `json:"additionalEmailAddresses"`
Kind coredata.PeopleKind `json:"kind"`
Position *string `json:"position,omitempty"`
ContractStartDate *time.Time `json:"contractStartDate,omitempty"`
ContractEndDate *time.Time `json:"contractEndDate,omitempty"`
}
type CreatePeoplePayload struct {
PeopleEdge *PeopleEdge `json:"peopleEdge"`
}
type CreateProcessingActivityInput struct {
OrganizationID gid.GID `json:"organizationId"`
Name string `json:"name"`
@@ -952,14 +937,6 @@ type DeleteObligationPayload struct {
DeletedObligationID gid.GID `json:"deletedObligationId"`
}
type DeletePeopleInput struct {
PeopleID gid.GID `json:"peopleId"`
}
type DeletePeoplePayload struct {
DeletedPeopleID gid.GID `json:"deletedPeopleId"`
}
type DeleteProcessingActivityInput struct {
ProcessingActivityID gid.GID `json:"processingActivityId"`
}
@@ -1134,7 +1111,7 @@ type Document struct {
Classification coredata.DocumentClassification `json:"classification"`
CurrentPublishedVersion *int `json:"currentPublishedVersion,omitempty"`
TrustCenterVisibility coredata.TrustCenterVisibility `json:"trustCenterVisibility"`
Owner *People `json:"owner"`
Owner *Profile `json:"owner"`
Organization *Organization `json:"organization"`
Versions *DocumentVersionConnection `json:"versions"`
Controls *ControlConnection `json:"controls"`
@@ -1164,7 +1141,7 @@ type DocumentVersion struct {
Changelog string `json:"changelog"`
Title string `json:"title"`
Classification coredata.DocumentClassification `json:"classification"`
Owner *People `json:"owner"`
Owner *Profile `json:"owner"`
Signatures *DocumentVersionSignatureConnection `json:"signatures"`
Signed bool `json:"signed"`
PublishedAt *time.Time `json:"publishedAt,omitempty"`
@@ -1189,7 +1166,7 @@ type DocumentVersionSignature struct {
ID gid.GID `json:"id"`
DocumentVersion *DocumentVersion `json:"documentVersion"`
State coredata.DocumentVersionSignatureState `json:"state"`
SignedBy *People `json:"signedBy"`
SignedBy *Profile `json:"signedBy"`
SignedAt *time.Time `json:"signedAt,omitempty"`
RequestedAt time.Time `json:"requestedAt"`
CreatedAt time.Time `json:"createdAt"`
@@ -1434,7 +1411,7 @@ type Nonconformity struct {
DateIdentified *time.Time `json:"dateIdentified,omitempty"`
RootCause string `json:"rootCause"`
CorrectiveAction *string `json:"correctiveAction,omitempty"`
Owner *People `json:"owner"`
Owner *Profile `json:"owner"`
DueDate *time.Time `json:"dueDate,omitempty"`
Status coredata.NonconformityStatus `json:"status"`
EffectivenessCheck *string `json:"effectivenessCheck,omitempty"`
@@ -1465,7 +1442,7 @@ type Obligation struct {
Requirement *string `json:"requirement,omitempty"`
ActionsToBeImplemented *string `json:"actionsToBeImplemented,omitempty"`
Regulator *string `json:"regulator,omitempty"`
Owner *People `json:"owner"`
Owner *Profile `json:"owner"`
LastReviewDate *time.Time `json:"lastReviewDate,omitempty"`
DueDate *time.Time `json:"dueDate,omitempty"`
Status coredata.ObligationStatus `json:"status"`
@@ -1501,7 +1478,6 @@ type Organization struct {
Frameworks *FrameworkConnection `json:"frameworks"`
Controls *ControlConnection `json:"controls"`
Vendors *VendorConnection `json:"vendors"`
Peoples *PeopleConnection `json:"peoples"`
Documents *DocumentConnection `json:"documents"`
Meetings *MeetingConnection `json:"meetings"`
StatesOfApplicability *StateOfApplicabilityConnection `json:"statesOfApplicability"`
@@ -1542,28 +1518,6 @@ type PageInfo struct {
EndCursor *page.CursorKey `json:"endCursor,omitempty"`
}
type People struct {
ID gid.GID `json:"id"`
FullName string `json:"fullName"`
PrimaryEmailAddress mail.Addr `json:"primaryEmailAddress"`
AdditionalEmailAddresses []mail.Addr `json:"additionalEmailAddresses"`
Kind coredata.PeopleKind `json:"kind"`
Position *string `json:"position,omitempty"`
ContractStartDate *time.Time `json:"contractStartDate,omitempty"`
ContractEndDate *time.Time `json:"contractEndDate,omitempty"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Permission bool `json:"permission"`
}
func (People) IsNode() {}
func (this People) GetID() gid.GID { return this.ID }
type PeopleEdge struct {
Cursor page.CursorKey `json:"cursor"`
Node *People `json:"node"`
}
type PeopleFilter struct {
ExcludeContractEnded *bool `json:"excludeContractEnded,omitempty"`
}
@@ -1591,7 +1545,7 @@ type ProcessingActivity struct {
LastReviewDate *time.Time `json:"lastReviewDate,omitempty"`
NextReviewDate *time.Time `json:"nextReviewDate,omitempty"`
Role coredata.ProcessingActivityRole `json:"role"`
DataProtectionOfficer *People `json:"dataProtectionOfficer,omitempty"`
DataProtectionOfficer *Profile `json:"dataProtectionOfficer,omitempty"`
Vendors *VendorConnection `json:"vendors"`
DataProtectionImpactAssessment *DataProtectionImpactAssessment `json:"dataProtectionImpactAssessment,omitempty"`
TransferImpactAssessment *TransferImpactAssessment `json:"transferImpactAssessment,omitempty"`
@@ -1613,27 +1567,22 @@ type ProcessingActivityFilter struct {
}
type Profile struct {
ID gid.GID `json:"id"`
FullName string `json:"fullName"`
EmailAddress mail.Addr `json:"email_address"`
AdditionalEmailAddresses []mail.Addr `json:"additionalEmailAddresses"`
Kind coredata.PeopleKind `json:"kind"`
Position *string `json:"position,omitempty"`
ContractStartDate *time.Time `json:"contractStartDate,omitempty"`
ContractEndDate *time.Time `json:"contractEndDate,omitempty"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Permission bool `json:"permission"`
ID gid.GID `json:"id"`
FullName string `json:"fullName"`
EmailAddress mail.Addr `json:"emailAddress"`
AdditionalEmailAddresses []mail.Addr `json:"additionalEmailAddresses"`
Kind coredata.MembershipProfileKind `json:"kind"`
Position *string `json:"position,omitempty"`
ContractStartDate *time.Time `json:"contractStartDate,omitempty"`
ContractEndDate *time.Time `json:"contractEndDate,omitempty"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Permission bool `json:"permission"`
}
func (Profile) IsNode() {}
func (this Profile) GetID() gid.GID { return this.ID }
type ProfileConnection struct {
Edges []*ProfileEdge `json:"edges"`
PageInfo *PageInfo `json:"pageInfo"`
}
type ProfileEdge struct {
Cursor page.CursorKey `json:"cursor"`
Node *Profile `json:"node"`
@@ -1714,7 +1663,7 @@ type Risk struct {
ResidualImpact int `json:"residualImpact"`
ResidualRiskScore int `json:"residualRiskScore"`
Note string `json:"note"`
Owner *People `json:"owner,omitempty"`
Owner *Profile `json:"owner,omitempty"`
Organization *Organization `json:"organization"`
Measures *MeasureConnection `json:"measures"`
Documents *DocumentConnection `json:"documents"`
@@ -1797,7 +1746,7 @@ type StateOfApplicability struct {
SourceID *gid.GID `json:"sourceId,omitempty"`
SnapshotID *gid.GID `json:"snapshotId,omitempty"`
Organization *Organization `json:"organization,omitempty"`
Owner *People `json:"owner"`
Owner *Profile `json:"owner"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
ApplicabilityStatements *ApplicabilityStatementConnection `json:"applicabilityStatements"`
@@ -1823,7 +1772,7 @@ type Task struct {
State coredata.TaskState `json:"state"`
TimeEstimate *time.Duration `json:"timeEstimate,omitempty"`
Deadline *time.Time `json:"deadline,omitempty"`
AssignedTo *People `json:"assignedTo,omitempty"`
AssignedTo *Profile `json:"assignedTo,omitempty"`
Organization *Organization `json:"organization"`
Measure *Measure `json:"measure,omitempty"`
Evidences *EvidenceConnection `json:"evidences"`
@@ -2165,21 +2114,6 @@ type UpdateOrganizationContextPayload struct {
Context *OrganizationContext `json:"context"`
}
type UpdatePeopleInput struct {
ID gid.GID `json:"id"`
FullName *string `json:"fullName,omitempty"`
PrimaryEmailAddress *mail.Addr `json:"primaryEmailAddress,omitempty"`
AdditionalEmailAddresses graphql.Omittable[[]mail.Addr] `json:"additionalEmailAddresses,omitempty"`
Kind *coredata.PeopleKind `json:"kind,omitempty"`
Position graphql.Omittable[*string] `json:"position,omitempty"`
ContractStartDate graphql.Omittable[*time.Time] `json:"contractStartDate,omitempty"`
ContractEndDate graphql.Omittable[*time.Time] `json:"contractEndDate,omitempty"`
}
type UpdatePeoplePayload struct {
People *People `json:"people"`
}
type UpdateProcessingActivityInput struct {
ID gid.GID `json:"id"`
Name *string `json:"name,omitempty"`
@@ -2484,8 +2418,8 @@ type Vendor struct {
Contacts *VendorContactConnection `json:"contacts"`
Services *VendorServiceConnection `json:"services"`
RiskAssessments *VendorRiskAssessmentConnection `json:"riskAssessments"`
BusinessOwner *People `json:"businessOwner,omitempty"`
SecurityOwner *People `json:"securityOwner,omitempty"`
BusinessOwner *Profile `json:"businessOwner,omitempty"`
SecurityOwner *Profile `json:"securityOwner,omitempty"`
StatusPageURL *string `json:"statusPageUrl,omitempty"`
TermsOfServiceURL *string `json:"termsOfServiceUrl,omitempty"`
PrivacyPolicyURL *string `json:"privacyPolicyUrl,omitempty"`

View File

@@ -90,13 +90,13 @@ func NewVendor(v *coredata.Vendor) *Vendor {
}
if v.BusinessOwnerID != nil {
object.BusinessOwner = &People{
object.BusinessOwner = &Profile{
ID: *v.BusinessOwnerID,
}
}
if v.SecurityOwnerID != nil {
object.SecurityOwner = &People{
object.SecurityOwner = &Profile{
ID: *v.SecurityOwnerID,
}
}

View File

@@ -84,14 +84,12 @@ func (r *applicabilityStatementConnectionResolver) TotalCount(ctx context.Contex
}
// Owner is the resolver for the owner field.
func (r *assetResolver) Owner(ctx context.Context, obj *types.Asset) (*types.People, error) {
func (r *assetResolver) Owner(ctx context.Context, obj *types.Asset) (*types.Profile, error) {
if err := r.authorize(ctx, obj.ID, probo.ActionPeopleGet); err != nil {
return nil, err
}
prb := r.ProboService(ctx, obj.ID.TenantID())
owner, err := prb.Peoples.Get(ctx, obj.Owner.ID)
owner, err := r.iam.OrganizationService.GetProfile(ctx, obj.Owner.ID)
if err != nil {
if errors.Is(err, coredata.ErrResourceNotFound) {
return nil, gqlutils.NotFound(ctx, err)
@@ -100,7 +98,7 @@ func (r *assetResolver) Owner(ctx context.Context, obj *types.Asset) (*types.Peo
panic(fmt.Errorf("cannot get owner: %w", err))
}
return types.NewPeople(owner), nil
return types.NewProfile(owner), nil
}
// Vendors is the resolver for the vendors field.
@@ -346,14 +344,12 @@ func (r *continualImprovementResolver) Organization(ctx context.Context, obj *ty
}
// Owner is the resolver for the owner field.
func (r *continualImprovementResolver) Owner(ctx context.Context, obj *types.ContinualImprovement) (*types.People, error) {
func (r *continualImprovementResolver) Owner(ctx context.Context, obj *types.ContinualImprovement) (*types.Profile, error) {
if err := r.authorize(ctx, obj.ID, probo.ActionPeopleGet); err != nil {
return nil, err
}
prb := r.ProboService(ctx, obj.ID.TenantID())
people, err := prb.Peoples.Get(ctx, obj.Owner.ID)
owner, err := r.iam.OrganizationService.GetProfile(ctx, obj.Owner.ID)
if err != nil {
if errors.Is(err, coredata.ErrResourceNotFound) {
return nil, gqlutils.NotFound(ctx, err)
@@ -362,7 +358,7 @@ func (r *continualImprovementResolver) Owner(ctx context.Context, obj *types.Con
panic(fmt.Errorf("cannot get continual improvement owner: %w", err))
}
return types.NewPeople(people), nil
return types.NewProfile(owner), nil
}
// Permission is the resolver for the permission field.
@@ -766,14 +762,12 @@ func (r *dataProtectionImpactAssessmentConnectionResolver) TotalCount(ctx contex
}
// Owner is the resolver for the owner field.
func (r *datumResolver) Owner(ctx context.Context, obj *types.Datum) (*types.People, error) {
func (r *datumResolver) Owner(ctx context.Context, obj *types.Datum) (*types.Profile, error) {
if err := r.authorize(ctx, obj.ID, probo.ActionPeopleGet); err != nil {
return nil, err
}
prb := r.ProboService(ctx, obj.ID.TenantID())
people, err := prb.Peoples.Get(ctx, obj.Owner.ID)
owner, err := r.iam.OrganizationService.GetProfile(ctx, obj.Owner.ID)
if err != nil {
if errors.Is(err, coredata.ErrResourceNotFound) {
return nil, gqlutils.NotFound(ctx, err)
@@ -782,7 +776,7 @@ func (r *datumResolver) Owner(ctx context.Context, obj *types.Datum) (*types.Peo
return nil, fmt.Errorf("cannot get owner: %w", err)
}
return types.NewPeople(people), nil
return types.NewProfile(owner), nil
}
// Vendors is the resolver for the vendors field.
@@ -868,15 +862,12 @@ func (r *datumConnectionResolver) TotalCount(ctx context.Context, obj *types.Dat
}
// Owner is the resolver for the owner field.
func (r *documentResolver) Owner(ctx context.Context, obj *types.Document) (*types.People, error) {
func (r *documentResolver) Owner(ctx context.Context, obj *types.Document) (*types.Profile, error) {
if err := r.authorize(ctx, obj.ID, probo.ActionPeopleGet); err != nil {
return nil, err
}
prb := r.ProboService(ctx, obj.ID.TenantID())
// Get the owner
owner, err := prb.Peoples.Get(ctx, obj.Owner.ID)
owner, err := r.iam.OrganizationService.GetProfile(ctx, obj.Owner.ID)
if err != nil {
if errors.Is(err, coredata.ErrResourceNotFound) {
return nil, gqlutils.NotFound(ctx, err)
@@ -886,7 +877,7 @@ func (r *documentResolver) Owner(ctx context.Context, obj *types.Document) (*typ
panic(fmt.Errorf("cannot get owner: %w", err))
}
return types.NewPeople(owner), nil
return types.NewProfile(owner), nil
}
// Organization is the resolver for the organization field.
@@ -1040,14 +1031,12 @@ func (r *documentVersionResolver) Document(ctx context.Context, obj *types.Docum
}
// Owner is the resolver for the owner field.
func (r *documentVersionResolver) Owner(ctx context.Context, obj *types.DocumentVersion) (*types.People, error) {
func (r *documentVersionResolver) Owner(ctx context.Context, obj *types.DocumentVersion) (*types.Profile, error) {
if err := r.authorize(ctx, obj.ID, probo.ActionPeopleGet); err != nil {
return nil, err
}
prb := r.ProboService(ctx, obj.ID.TenantID())
owner, err := prb.Peoples.Get(ctx, obj.Owner.ID)
owner, err := r.iam.OrganizationService.GetProfile(ctx, obj.Owner.ID)
if err != nil {
if errors.Is(err, coredata.ErrResourceNotFound) {
return nil, gqlutils.NotFound(ctx, err)
@@ -1057,7 +1046,7 @@ func (r *documentVersionResolver) Owner(ctx context.Context, obj *types.Document
panic(fmt.Errorf("cannot get owner: %w", err))
}
return types.NewPeople(owner), nil
return types.NewProfile(owner), nil
}
// Signatures is the resolver for the signatures field.
@@ -1170,14 +1159,12 @@ func (r *documentVersionSignatureResolver) DocumentVersion(ctx context.Context,
}
// SignedBy is the resolver for the signedBy field.
func (r *documentVersionSignatureResolver) SignedBy(ctx context.Context, obj *types.DocumentVersionSignature) (*types.People, error) {
func (r *documentVersionSignatureResolver) SignedBy(ctx context.Context, obj *types.DocumentVersionSignature) (*types.Profile, error) {
if err := r.authorize(ctx, obj.ID, probo.ActionPeopleGet); err != nil {
return nil, err
}
prb := r.ProboService(ctx, obj.ID.TenantID())
people, err := prb.Peoples.Get(ctx, obj.SignedBy.ID)
signatory, err := r.iam.OrganizationService.GetProfile(ctx, obj.SignedBy.ID)
if err != nil {
if errors.Is(err, coredata.ErrResourceNotFound) {
return nil, gqlutils.NotFound(ctx, err)
@@ -1187,7 +1174,7 @@ func (r *documentVersionSignatureResolver) SignedBy(ctx context.Context, obj *ty
panic(fmt.Errorf("cannot get people: %w", err))
}
return types.NewPeople(people), nil
return types.NewProfile(signatory), nil
}
// Permission is the resolver for the permission field.
@@ -2142,96 +2129,6 @@ func (r *mutationResolver) DeleteTrustCenterFile(ctx context.Context, input type
}, nil
}
// CreatePeople is the resolver for the createPeople field.
func (r *mutationResolver) CreatePeople(ctx context.Context, input types.CreatePeopleInput) (*types.CreatePeoplePayload, error) {
if err := r.authorize(ctx, input.OrganizationID, probo.ActionPeopleCreate); err != nil {
return nil, err
}
prb := r.ProboService(ctx, input.OrganizationID.TenantID())
people, err := prb.Peoples.Create(
ctx,
probo.CreatePeopleRequest{
OrganizationID: input.OrganizationID,
FullName: input.FullName,
PrimaryEmailAddress: input.PrimaryEmailAddress,
AdditionalEmailAddresses: input.AdditionalEmailAddresses,
Kind: input.Kind,
Position: input.Position,
ContractStartDate: input.ContractStartDate,
ContractEndDate: input.ContractEndDate,
},
)
if err != nil {
if errors.Is(err, coredata.ErrResourceAlreadyExists) {
return nil, gqlutils.Conflict(ctx, err)
}
// TODO no panic use gqlutils.InternalError
panic(fmt.Errorf("cannot create people: %w", err))
}
return &types.CreatePeoplePayload{
PeopleEdge: types.NewPeopleEdge(people, coredata.PeopleOrderFieldFullName),
}, nil
}
// UpdatePeople is the resolver for the updatePeople field.
func (r *mutationResolver) UpdatePeople(ctx context.Context, input types.UpdatePeopleInput) (*types.UpdatePeoplePayload, error) {
if err := r.authorize(ctx, input.ID, probo.ActionPeopleUpdate); err != nil {
return nil, err
}
prb := r.ProboService(ctx, input.ID.TenantID())
people, err := prb.Peoples.Update(
ctx,
probo.UpdatePeopleRequest{
ID: input.ID,
FullName: input.FullName,
PrimaryEmailAddress: input.PrimaryEmailAddress,
AdditionalEmailAddresses: gqlutils.UnwrapOmittable(input.AdditionalEmailAddresses),
Kind: input.Kind,
Position: gqlutils.UnwrapOmittable(input.Position),
ContractStartDate: gqlutils.UnwrapOmittable(input.ContractStartDate),
ContractEndDate: gqlutils.UnwrapOmittable(input.ContractEndDate),
},
)
if err != nil {
// TODO no panic use gqlutils.InternalError
panic(fmt.Errorf("cannot update people: %w", err))
}
return &types.UpdatePeoplePayload{
People: types.NewPeople(people),
}, nil
}
// DeletePeople is the resolver for the deletePeople field.
func (r *mutationResolver) DeletePeople(ctx context.Context, input types.DeletePeopleInput) (*types.DeletePeoplePayload, error) {
if err := r.authorize(ctx, input.PeopleID, probo.ActionPeopleDelete); err != nil {
return nil, err
}
prb := r.ProboService(ctx, input.PeopleID.TenantID())
err := prb.Peoples.Delete(ctx, input.PeopleID)
if err != nil {
if errors.Is(err, coredata.ErrResourceInUse) {
return nil, gqlutils.Conflict(ctx, err)
}
// TODO no panic use gqlutils.InternalError
panic(fmt.Errorf("cannot delete people: %w", err))
}
return &types.DeletePeoplePayload{
DeletedPeopleID: input.PeopleID,
}, nil
}
// CreateVendor is the resolver for the createVendor field.
func (r *mutationResolver) CreateVendor(ctx context.Context, input types.CreateVendorInput) (*types.CreateVendorPayload, error) {
if err := r.authorize(ctx, input.OrganizationID, probo.ActionVendorCreate); err != nil {
@@ -5425,14 +5322,12 @@ func (r *nonconformityResolver) Audit(ctx context.Context, obj *types.Nonconform
}
// Owner is the resolver for the owner field.
func (r *nonconformityResolver) Owner(ctx context.Context, obj *types.Nonconformity) (*types.People, error) {
func (r *nonconformityResolver) Owner(ctx context.Context, obj *types.Nonconformity) (*types.Profile, error) {
if err := r.authorize(ctx, obj.ID, probo.ActionPeopleGet); err != nil {
return nil, err
}
prb := r.ProboService(ctx, obj.ID.TenantID())
people, err := prb.Peoples.Get(ctx, obj.Owner.ID)
owner, err := r.iam.OrganizationService.GetProfile(ctx, obj.Owner.ID)
if err != nil {
if errors.Is(err, coredata.ErrResourceNotFound) {
return nil, gqlutils.NotFound(ctx, err)
@@ -5442,7 +5337,7 @@ func (r *nonconformityResolver) Owner(ctx context.Context, obj *types.Nonconform
panic(fmt.Errorf("cannot get nonconformity owner: %w", err))
}
return types.NewPeople(people), nil
return types.NewProfile(owner), nil
}
// Permission is the resolver for the permission field.
@@ -5498,14 +5393,12 @@ func (r *obligationResolver) Organization(ctx context.Context, obj *types.Obliga
}
// Owner is the resolver for the owner field.
func (r *obligationResolver) Owner(ctx context.Context, obj *types.Obligation) (*types.People, error) {
func (r *obligationResolver) Owner(ctx context.Context, obj *types.Obligation) (*types.Profile, error) {
if err := r.authorize(ctx, obj.ID, probo.ActionPeopleGet); err != nil {
return nil, err
}
prb := r.ProboService(ctx, obj.ID.TenantID())
people, err := prb.Peoples.Get(ctx, obj.Owner.ID)
owner, err := r.iam.OrganizationService.GetProfile(ctx, obj.Owner.ID)
if err != nil {
if errors.Is(err, coredata.ErrResourceNotFound) {
return nil, gqlutils.NotFound(ctx, err)
@@ -5515,7 +5408,7 @@ func (r *obligationResolver) Owner(ctx context.Context, obj *types.Obligation) (
panic(fmt.Errorf("cannot get obligation owner: %w", err))
}
return types.NewPeople(people), nil
return types.NewProfile(owner), nil
}
// Permission is the resolver for the permission field.
@@ -5740,41 +5633,6 @@ func (r *organizationResolver) Vendors(ctx context.Context, obj *types.Organizat
return types.NewVendorConnection(page, r, obj.ID), nil
}
// Peoples is the resolver for the peoples field.
func (r *organizationResolver) Peoples(ctx context.Context, obj *types.Organization, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.PeopleOrderBy, filter *types.PeopleFilter) (*types.PeopleConnection, error) {
if err := r.authorize(ctx, obj.ID, probo.ActionPeopleList); err != nil {
return nil, err
}
prb := r.ProboService(ctx, obj.ID.TenantID())
pageOrderBy := page.OrderBy[coredata.PeopleOrderField]{
Field: coredata.PeopleOrderFieldCreatedAt,
Direction: page.OrderDirectionDesc,
}
if orderBy != nil {
pageOrderBy = page.OrderBy[coredata.PeopleOrderField]{
Field: orderBy.Field,
Direction: orderBy.Direction,
}
}
cursor := types.NewCursor(first, after, last, before, pageOrderBy)
var peopleFilter = coredata.NewPeopleFilter(nil)
if filter != nil {
peopleFilter = coredata.NewPeopleFilter(filter.ExcludeContractEnded)
}
page, err := prb.Peoples.ListForOrganizationID(ctx, obj.ID, cursor, peopleFilter)
if err != nil {
// TODO no panic use gqlutils.InternalError
panic(fmt.Errorf("cannot list organization peoples: %w", err))
}
return types.NewPeopleConnection(page, r, obj.ID, peopleFilter), nil
}
// Documents is the resolver for the documents field.
func (r *organizationResolver) Documents(ctx context.Context, obj *types.Organization, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.DocumentOrderBy, filter *types.DocumentFilter) (*types.DocumentConnection, error) {
if err := r.authorize(ctx, obj.ID, probo.ActionDocumentList); err != nil {
@@ -6421,34 +6279,6 @@ func (r *organizationResolver) Permission(ctx context.Context, obj *types.Organi
return r.Resolver.Permission(ctx, obj, action)
}
// Permission is the resolver for the permission field.
func (r *peopleResolver) Permission(ctx context.Context, obj *types.People, action string) (bool, error) {
return r.Resolver.Permission(ctx, obj, action)
}
// TotalCount is the resolver for the totalCount field.
func (r *peopleConnectionResolver) TotalCount(ctx context.Context, obj *types.PeopleConnection) (int, error) {
if err := r.authorize(ctx, obj.ParentID, probo.ActionPeopleList); err != nil {
return 0, err
}
prb := r.ProboService(ctx, obj.ParentID.TenantID())
switch obj.Resolver.(type) {
case *organizationResolver:
count, err := prb.Peoples.CountForOrganizationID(ctx, obj.ParentID, obj.Filters)
if err != nil {
// TODO no panic use gqlutils.InternalError
panic(fmt.Errorf("cannot count peoples: %w", err))
}
return count, nil
}
// TODO no panic use gqlutils.InternalError
panic(fmt.Errorf("unsupported resolver: %T", obj.Resolver))
}
// Organization is the resolver for the organization field.
func (r *processingActivityResolver) Organization(ctx context.Context, obj *types.ProcessingActivity) (*types.Organization, error) {
if err := r.authorize(ctx, obj.ID, probo.ActionOrganizationGet); err != nil {
@@ -6471,28 +6301,21 @@ func (r *processingActivityResolver) Organization(ctx context.Context, obj *type
}
// DataProtectionOfficer is the resolver for the dataProtectionOfficer field.
func (r *processingActivityResolver) DataProtectionOfficer(ctx context.Context, obj *types.ProcessingActivity) (*types.People, error) {
func (r *processingActivityResolver) DataProtectionOfficer(ctx context.Context, obj *types.ProcessingActivity) (*types.Profile, error) {
if err := r.authorize(ctx, obj.ID, probo.ActionPeopleGet); err != nil {
return nil, err
}
prb := r.ProboService(ctx, obj.ID.TenantID())
processingActivity, err := prb.ProcessingActivities.Get(ctx, obj.ID)
if err != nil {
panic(fmt.Errorf("cannot get processing activity: %w", err))
}
if processingActivity.DataProtectionOfficerID == nil {
if obj.DataProtectionOfficer == nil {
return nil, nil
}
people, err := prb.Peoples.Get(ctx, *processingActivity.DataProtectionOfficerID)
dpo, err := r.iam.OrganizationService.GetProfile(ctx, obj.DataProtectionOfficer.ID)
if err != nil {
panic(fmt.Errorf("cannot get data protection officer: %w", err))
}
return types.NewPeople(people), nil
return types.NewProfile(dpo), nil
}
// Vendors is the resolver for the vendors field.
@@ -6600,6 +6423,11 @@ func (r *profileResolver) Permission(ctx context.Context, obj *types.Profile, ac
panic(fmt.Errorf("not implemented: Permission - permission"))
}
// TotalCount is the resolver for the totalCount field.
func (r *profileConnectionResolver) TotalCount(ctx context.Context, obj *types.ProfileConnection) (int, error) {
panic(fmt.Errorf("not implemented: TotalCount - totalCount"))
}
// Node is the resolver for the node field.
func (r *queryResolver) Node(ctx context.Context, id gid.GID) (types.Node, error) {
var (
@@ -7009,18 +6837,16 @@ func (r *rightsRequestConnectionResolver) TotalCount(ctx context.Context, obj *t
}
// Owner is the resolver for the owner field.
func (r *riskResolver) Owner(ctx context.Context, obj *types.Risk) (*types.People, error) {
func (r *riskResolver) Owner(ctx context.Context, obj *types.Risk) (*types.Profile, error) {
if err := r.authorize(ctx, obj.ID, probo.ActionPeopleGet); err != nil {
return nil, err
}
prb := r.ProboService(ctx, obj.ID.TenantID())
if obj.Owner == nil {
return nil, nil
}
owner, err := prb.Peoples.Get(ctx, obj.Owner.ID)
owner, err := r.iam.OrganizationService.GetProfile(ctx, obj.Owner.ID)
if err != nil {
if errors.Is(err, coredata.ErrResourceNotFound) {
return nil, gqlutils.NotFound(ctx, err)
@@ -7030,7 +6856,7 @@ func (r *riskResolver) Owner(ctx context.Context, obj *types.Risk) (*types.Peopl
panic(fmt.Errorf("cannot get owner: %w", err))
}
return types.NewPeople(owner), nil
return types.NewProfile(owner), nil
}
// Organization is the resolver for the organization field.
@@ -7382,14 +7208,12 @@ func (r *stateOfApplicabilityResolver) Organization(ctx context.Context, obj *ty
}
// Owner is the resolver for the owner field.
func (r *stateOfApplicabilityResolver) Owner(ctx context.Context, obj *types.StateOfApplicability) (*types.People, error) {
func (r *stateOfApplicabilityResolver) Owner(ctx context.Context, obj *types.StateOfApplicability) (*types.Profile, error) {
if err := r.authorize(ctx, obj.ID, probo.ActionPeopleGet); err != nil {
return nil, err
}
prb := r.ProboService(ctx, obj.ID.TenantID())
people, err := prb.Peoples.Get(ctx, obj.Owner.ID)
owner, err := r.iam.OrganizationService.GetProfile(ctx, obj.Owner.ID)
if err != nil {
if errors.Is(err, coredata.ErrResourceNotFound) {
return nil, gqlutils.NotFound(ctx, err)
@@ -7397,7 +7221,7 @@ func (r *stateOfApplicabilityResolver) Owner(ctx context.Context, obj *types.Sta
panic(fmt.Errorf("cannot load owner: %w", err))
}
return types.NewPeople(people), nil
return types.NewProfile(owner), nil
}
// ApplicabilityStatements is the resolver for the applicabilityStatements field.
@@ -7451,18 +7275,16 @@ func (r *stateOfApplicabilityConnectionResolver) TotalCount(ctx context.Context,
}
// AssignedTo is the resolver for the assignedTo field.
func (r *taskResolver) AssignedTo(ctx context.Context, obj *types.Task) (*types.People, error) {
func (r *taskResolver) AssignedTo(ctx context.Context, obj *types.Task) (*types.Profile, error) {
if err := r.authorize(ctx, obj.ID, probo.ActionPeopleGet); err != nil {
return nil, err
}
prb := r.ProboService(ctx, obj.ID.TenantID())
if obj.AssignedTo == nil {
return nil, nil
}
people, err := prb.Peoples.Get(ctx, obj.AssignedTo.ID)
assignee, err := r.iam.OrganizationService.GetProfile(ctx, obj.AssignedTo.ID)
if err != nil {
if errors.Is(err, coredata.ErrResourceNotFound) {
return nil, gqlutils.NotFound(ctx, err)
@@ -7471,7 +7293,7 @@ func (r *taskResolver) AssignedTo(ctx context.Context, obj *types.Task) (*types.
panic(fmt.Errorf("cannot get assigned to: %w", err))
}
return types.NewPeople(people), nil
return types.NewProfile(assignee), nil
}
// Organization is the resolver for the organization field.
@@ -8201,27 +8023,16 @@ func (r *vendorResolver) RiskAssessments(ctx context.Context, obj *types.Vendor,
}
// BusinessOwner is the resolver for the businessOwner field.
func (r *vendorResolver) BusinessOwner(ctx context.Context, obj *types.Vendor) (*types.People, error) {
func (r *vendorResolver) BusinessOwner(ctx context.Context, obj *types.Vendor) (*types.Profile, error) {
if err := r.authorize(ctx, obj.ID, probo.ActionPeopleGet); err != nil {
return nil, err
}
prb := r.ProboService(ctx, obj.ID.TenantID())
vendor, err := prb.Vendors.Get(ctx, obj.ID)
if err != nil {
if errors.Is(err, coredata.ErrResourceNotFound) {
return nil, gqlutils.NotFound(ctx, err)
}
panic(fmt.Errorf("cannot get vendor: %w", err))
}
if vendor.BusinessOwnerID == nil {
if obj.BusinessOwner == nil {
return nil, nil
}
people, err := prb.Peoples.Get(ctx, *vendor.BusinessOwnerID)
businessOwner, err := r.iam.OrganizationService.GetProfile(ctx, obj.BusinessOwner.ID)
if err != nil {
if errors.Is(err, coredata.ErrResourceNotFound) {
return nil, gqlutils.NotFound(ctx, err)
@@ -8230,31 +8041,20 @@ func (r *vendorResolver) BusinessOwner(ctx context.Context, obj *types.Vendor) (
panic(fmt.Errorf("cannot get business owner: %w", err))
}
return types.NewPeople(people), nil
return types.NewProfile(businessOwner), nil
}
// SecurityOwner is the resolver for the securityOwner field.
func (r *vendorResolver) SecurityOwner(ctx context.Context, obj *types.Vendor) (*types.People, error) {
func (r *vendorResolver) SecurityOwner(ctx context.Context, obj *types.Vendor) (*types.Profile, error) {
if err := r.authorize(ctx, obj.ID, probo.ActionPeopleGet); err != nil {
return nil, err
}
prb := r.ProboService(ctx, obj.ID.TenantID())
vendor, err := prb.Vendors.Get(ctx, obj.ID)
if err != nil {
if errors.Is(err, coredata.ErrResourceNotFound) {
return nil, gqlutils.NotFound(ctx, err)
}
panic(fmt.Errorf("cannot get vendor: %w", err))
}
if vendor.SecurityOwnerID == nil {
if obj.SecurityOwner == nil {
return nil, nil
}
people, err := prb.Peoples.Get(ctx, *vendor.SecurityOwnerID)
securityOwner, err := r.iam.OrganizationService.GetProfile(ctx, obj.SecurityOwner.ID)
if err != nil {
if errors.Is(err, coredata.ErrResourceNotFound) {
return nil, gqlutils.NotFound(ctx, err)
@@ -8263,7 +8063,7 @@ func (r *vendorResolver) SecurityOwner(ctx context.Context, obj *types.Vendor) (
panic(fmt.Errorf("cannot get security owner: %w", err))
}
return types.NewPeople(people), nil
return types.NewProfile(securityOwner), nil
}
// Permission is the resolver for the permission field.
@@ -8747,14 +8547,6 @@ func (r *Resolver) ObligationConnection() schema.ObligationConnectionResolver {
// Organization returns schema.OrganizationResolver implementation.
func (r *Resolver) Organization() schema.OrganizationResolver { return &organizationResolver{r} }
// People returns schema.PeopleResolver implementation.
func (r *Resolver) People() schema.PeopleResolver { return &peopleResolver{r} }
// PeopleConnection returns schema.PeopleConnectionResolver implementation.
func (r *Resolver) PeopleConnection() schema.PeopleConnectionResolver {
return &peopleConnectionResolver{r}
}
// ProcessingActivity returns schema.ProcessingActivityResolver implementation.
func (r *Resolver) ProcessingActivity() schema.ProcessingActivityResolver {
return &processingActivityResolver{r}
@@ -8768,6 +8560,11 @@ func (r *Resolver) ProcessingActivityConnection() schema.ProcessingActivityConne
// Profile returns schema.ProfileResolver implementation.
func (r *Resolver) Profile() schema.ProfileResolver { return &profileResolver{r} }
// ProfileConnection returns schema.ProfileConnectionResolver implementation.
func (r *Resolver) ProfileConnection() schema.ProfileConnectionResolver {
return &profileConnectionResolver{r}
}
// Query returns schema.QueryResolver implementation.
func (r *Resolver) Query() schema.QueryResolver { return &queryResolver{r} }
@@ -8938,11 +8735,10 @@ type nonconformityConnectionResolver struct{ *Resolver }
type obligationResolver struct{ *Resolver }
type obligationConnectionResolver struct{ *Resolver }
type organizationResolver struct{ *Resolver }
type peopleResolver struct{ *Resolver }
type peopleConnectionResolver struct{ *Resolver }
type processingActivityResolver struct{ *Resolver }
type processingActivityConnectionResolver struct{ *Resolver }
type profileResolver struct{ *Resolver }
type profileConnectionResolver struct{ *Resolver }
type queryResolver struct{ *Resolver }
type reportResolver struct{ *Resolver }
type rightsRequestResolver struct{ *Resolver }