Update console gql schema and resolver
Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
@@ -25,27 +25,41 @@ import (
|
|||||||
"go.gearno.de/kit/pg"
|
"go.gearno.de/kit/pg"
|
||||||
"go.probo.inc/probo/pkg/gid"
|
"go.probo.inc/probo/pkg/gid"
|
||||||
"go.probo.inc/probo/pkg/mail"
|
"go.probo.inc/probo/pkg/mail"
|
||||||
|
"go.probo.inc/probo/pkg/page"
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
MembershipProfile struct {
|
MembershipProfile struct {
|
||||||
ID gid.GID `db:"id"`
|
ID gid.GID `db:"id"`
|
||||||
IdentityID gid.GID `db:"identity_id"`
|
IdentityID gid.GID `db:"identity_id"`
|
||||||
MembershipID gid.GID `db:"membership_id"`
|
MembershipID gid.GID `db:"membership_id"`
|
||||||
EmailAddress mail.Addr `db:"email_address"`
|
EmailAddress mail.Addr `db:"email_address"`
|
||||||
FullName string `db:"full_name"`
|
FullName string `db:"full_name"`
|
||||||
Kind PeopleKind `db:"kind"`
|
Kind MembershipProfileKind `db:"kind"`
|
||||||
AdditionalEmailAddresses mail.Addrs `db:"additional_email_addresses"`
|
AdditionalEmailAddresses mail.Addrs `db:"additional_email_addresses"`
|
||||||
Position *string `db:"position"`
|
Position *string `db:"position"`
|
||||||
ContractStartDate *time.Time `db:"contract_start_date"`
|
ContractStartDate *time.Time `db:"contract_start_date"`
|
||||||
ContractEndDate *time.Time `db:"contract_end_date"`
|
ContractEndDate *time.Time `db:"contract_end_date"`
|
||||||
CreatedAt time.Time `db:"created_at"`
|
CreatedAt time.Time `db:"created_at"`
|
||||||
UpdatedAt time.Time `db:"updated_at"`
|
UpdatedAt time.Time `db:"updated_at"`
|
||||||
}
|
}
|
||||||
|
|
||||||
MembershipProfiles []*MembershipProfile
|
MembershipProfiles []*MembershipProfile
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func (p MembershipProfile) CursorKey(orderBy MembershipProfileOrderField) page.CursorKey {
|
||||||
|
switch orderBy {
|
||||||
|
case MembershipProfileOrderFieldCreatedAt:
|
||||||
|
return page.NewCursorKey(p.ID, p.CreatedAt)
|
||||||
|
case MembershipProfileOrderFieldFullName:
|
||||||
|
return page.NewCursorKey(p.ID, p.FullName)
|
||||||
|
case MembershipProfileOrderFieldKind:
|
||||||
|
return page.NewCursorKey(p.ID, p.Kind)
|
||||||
|
}
|
||||||
|
|
||||||
|
panic(fmt.Sprintf("unsupported order by: %s", orderBy))
|
||||||
|
}
|
||||||
|
|
||||||
func (p *MembershipProfile) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
func (p *MembershipProfile) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||||
q := `SELECT m.organization_id FROM iam_membership_profiles mp JOIN iam_memberships m ON mp.membership_id = m.id WHERE mp.id = $1 LIMIT 1;`
|
q := `SELECT m.organization_id FROM iam_membership_profiles mp JOIN iam_memberships m ON mp.membership_id = m.id WHERE mp.id = $1 LIMIT 1;`
|
||||||
|
|
||||||
|
|||||||
53
pkg/coredata/membership_profile_filter.go
Normal file
53
pkg/coredata/membership_profile_filter.go
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
// 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 coredata
|
||||||
|
|
||||||
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/jackc/pgx/v5"
|
||||||
|
)
|
||||||
|
|
||||||
|
type (
|
||||||
|
MembershipProfileFilter struct {
|
||||||
|
excludeContractEnded *bool
|
||||||
|
currentDate time.Time
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
func NewMembershipProfileFilter(excludeContractEnded *bool) *MembershipProfileFilter {
|
||||||
|
return &MembershipProfileFilter{
|
||||||
|
excludeContractEnded: excludeContractEnded,
|
||||||
|
currentDate: time.Now(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *MembershipProfileFilter) SQLArguments() pgx.StrictNamedArgs {
|
||||||
|
return pgx.StrictNamedArgs{
|
||||||
|
"exclude_contract_ended": f.excludeContractEnded,
|
||||||
|
"current_date": f.currentDate,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *MembershipProfileFilter) SQLFragment() string {
|
||||||
|
return `
|
||||||
|
(
|
||||||
|
CASE
|
||||||
|
WHEN @exclude_contract_ended::boolean IS NOT NULL AND @exclude_contract_ended::boolean = true THEN
|
||||||
|
(contract_end_date IS NULL OR contract_end_date >= @current_date::date)
|
||||||
|
ELSE TRUE
|
||||||
|
END
|
||||||
|
)`
|
||||||
|
}
|
||||||
87
pkg/coredata/membership_profile_kind.go
Normal file
87
pkg/coredata/membership_profile_kind.go
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
// 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 coredata
|
||||||
|
|
||||||
|
import (
|
||||||
|
"database/sql/driver"
|
||||||
|
"fmt"
|
||||||
|
)
|
||||||
|
|
||||||
|
type (
|
||||||
|
MembershipProfileKind uint8
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
MembershipProfileKindEmployee MembershipProfileKind = iota
|
||||||
|
MembershipProfileKindContractor
|
||||||
|
MembershipProfileKindServiceAccount
|
||||||
|
)
|
||||||
|
|
||||||
|
func MembershipProfileKinds() []MembershipProfileKind {
|
||||||
|
return []MembershipProfileKind{
|
||||||
|
MembershipProfileKindEmployee,
|
||||||
|
MembershipProfileKindContractor,
|
||||||
|
MembershipProfileKindServiceAccount,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (mpk MembershipProfileKind) MarshalText() ([]byte, error) {
|
||||||
|
return []byte(mpk.String()), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (mpk *MembershipProfileKind) UnmarshalText(data []byte) error {
|
||||||
|
val := string(data)
|
||||||
|
|
||||||
|
switch val {
|
||||||
|
case MembershipProfileKindEmployee.String():
|
||||||
|
*mpk = MembershipProfileKindEmployee
|
||||||
|
case MembershipProfileKindContractor.String():
|
||||||
|
*mpk = MembershipProfileKindContractor
|
||||||
|
case MembershipProfileKindServiceAccount.String():
|
||||||
|
*mpk = MembershipProfileKindServiceAccount
|
||||||
|
default:
|
||||||
|
return fmt.Errorf("invalid MembershipProfileKind value: %q", val)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (mpk MembershipProfileKind) String() string {
|
||||||
|
var val string
|
||||||
|
|
||||||
|
switch mpk {
|
||||||
|
case MembershipProfileKindEmployee:
|
||||||
|
val = "EMPLOYEE"
|
||||||
|
case MembershipProfileKindContractor:
|
||||||
|
val = "CONTRACTOR"
|
||||||
|
case MembershipProfileKindServiceAccount:
|
||||||
|
val = "SERVICE_ACCOUNT"
|
||||||
|
}
|
||||||
|
|
||||||
|
return val
|
||||||
|
}
|
||||||
|
|
||||||
|
func (mpk *MembershipProfileKind) Scan(value any) error {
|
||||||
|
val, ok := value.(string)
|
||||||
|
if !ok {
|
||||||
|
return fmt.Errorf("invalid scan source for MembershipProfileKind, expected string got %T", value)
|
||||||
|
}
|
||||||
|
|
||||||
|
return mpk.UnmarshalText([]byte(val))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (mpk MembershipProfileKind) Value() (driver.Value, error) {
|
||||||
|
return mpk.String(), nil
|
||||||
|
}
|
||||||
42
pkg/coredata/membership_profile_order_field.go
Normal file
42
pkg/coredata/membership_profile_order_field.go
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
// 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 coredata
|
||||||
|
|
||||||
|
type (
|
||||||
|
MembershipProfileOrderField string
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
MembershipProfileOrderFieldCreatedAt MembershipProfileOrderField = "CREATED_AT"
|
||||||
|
MembershipProfileOrderFieldFullName MembershipProfileOrderField = "FULL_NAME"
|
||||||
|
MembershipProfileOrderFieldKind MembershipProfileOrderField = "KIND"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (p MembershipProfileOrderField) Column() string {
|
||||||
|
return string(p)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p MembershipProfileOrderField) String() string {
|
||||||
|
return string(p)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p MembershipProfileOrderField) MarshalText() ([]byte, error) {
|
||||||
|
return []byte(p.String()), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *MembershipProfileOrderField) UnmarshalText(text []byte) error {
|
||||||
|
*p = MembershipProfileOrderField(text)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
@@ -945,6 +945,23 @@ func (s *OrganizationService) ListMembers(
|
|||||||
return page.NewPage(memberships, cursor), nil
|
return page.NewPage(memberships, cursor), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *OrganizationService) GetProfile(ctx context.Context, profileID gid.GID) (*coredata.MembershipProfile, error) {
|
||||||
|
profile := &coredata.MembershipProfile{}
|
||||||
|
|
||||||
|
err := s.pg.WithConn(
|
||||||
|
ctx,
|
||||||
|
func(conn pg.Conn) error {
|
||||||
|
return profile.LoadByID(ctx, conn, coredata.NewScopeFromObjectID(profileID), profileID)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return profile, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (s *OrganizationService) GetOrganizationForMembership(ctx context.Context, membershipID gid.GID) (*coredata.Organization, error) {
|
func (s *OrganizationService) GetOrganizationForMembership(ctx context.Context, membershipID gid.GID) (*coredata.Organization, error) {
|
||||||
var (
|
var (
|
||||||
scope = coredata.NewScopeFromObjectID(membershipID)
|
scope = coredata.NewScopeFromObjectID(membershipID)
|
||||||
|
|||||||
@@ -69,14 +69,14 @@ enum EvidenceState
|
|||||||
@goEnum(value: "go.probo.inc/probo/pkg/coredata.EvidenceStateRequested")
|
@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
|
EMPLOYEE
|
||||||
@goEnum(value: "go.probo.inc/probo/pkg/coredata.PeopleKindEmployee")
|
@goEnum(value: "go.probo.inc/probo/pkg/coredata.MembershipProfileKindEmployee")
|
||||||
CONTRACTOR
|
CONTRACTOR
|
||||||
@goEnum(value: "go.probo.inc/probo/pkg/coredata.PeopleKindContractor")
|
@goEnum(value: "go.probo.inc/probo/pkg/coredata.MembershipProfileKindContractor")
|
||||||
SERVICE_ACCOUNT
|
SERVICE_ACCOUNT
|
||||||
@goEnum(
|
@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
|
# Order Field Enums
|
||||||
enum PeopleOrderField
|
enum ProfileOrderField
|
||||||
@goModel(model: "go.probo.inc/probo/pkg/coredata.PeopleOrderField") {
|
@goModel(model: "go.probo.inc/probo/pkg/coredata.MembershipProfileOrderField") {
|
||||||
FULL_NAME
|
FULL_NAME
|
||||||
@goEnum(
|
@goEnum(
|
||||||
value: "go.probo.inc/probo/pkg/coredata.PeopleOrderFieldFullName"
|
value: "go.probo.inc/probo/pkg/coredata.MembershipProfileOrderFieldFullName"
|
||||||
)
|
)
|
||||||
CREATED_AT
|
CREATED_AT
|
||||||
@goEnum(
|
@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
|
enum VendorOrderField
|
||||||
@@ -1281,12 +1281,12 @@ enum SnapshotOrderField
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Input Types
|
# Input Types
|
||||||
input PeopleOrder
|
input ProfileOrder
|
||||||
@goModel(
|
@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!
|
direction: OrderDirection!
|
||||||
field: PeopleOrderField!
|
field: ProfileOrderField!
|
||||||
}
|
}
|
||||||
|
|
||||||
input VendorOrder
|
input VendorOrder
|
||||||
@@ -1648,15 +1648,6 @@ type Organization implements Node {
|
|||||||
filter: VendorFilter = { snapshotId: null }
|
filter: VendorFilter = { snapshotId: null }
|
||||||
): VendorConnection! @goField(forceResolver: true)
|
): VendorConnection! @goField(forceResolver: true)
|
||||||
|
|
||||||
peoples(
|
|
||||||
first: Int
|
|
||||||
after: CursorKey
|
|
||||||
last: Int
|
|
||||||
before: CursorKey
|
|
||||||
orderBy: PeopleOrder
|
|
||||||
filter: PeopleFilter
|
|
||||||
): PeopleConnection! @goField(forceResolver: true)
|
|
||||||
|
|
||||||
documents(
|
documents(
|
||||||
first: Int
|
first: Int
|
||||||
after: CursorKey
|
after: CursorKey
|
||||||
@@ -1844,24 +1835,9 @@ type SlackConnectionEdge {
|
|||||||
type Profile implements Node {
|
type Profile implements Node {
|
||||||
id: ID!
|
id: ID!
|
||||||
fullName: String!
|
fullName: String!
|
||||||
email_address: EmailAddr!
|
emailAddress: EmailAddr!
|
||||||
additionalEmailAddresses: [EmailAddr!]!
|
additionalEmailAddresses: [EmailAddr!]!
|
||||||
kind: PeopleKind!
|
kind: MembershipProfileKind!
|
||||||
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!
|
|
||||||
position: String
|
position: String
|
||||||
contractStartDate: Datetime
|
contractStartDate: Datetime
|
||||||
contractEndDate: Datetime
|
contractEndDate: Datetime
|
||||||
@@ -1917,8 +1893,8 @@ type Vendor implements Node {
|
|||||||
orderBy: VendorRiskAssessmentOrder
|
orderBy: VendorRiskAssessmentOrder
|
||||||
): VendorRiskAssessmentConnection! @goField(forceResolver: true)
|
): VendorRiskAssessmentConnection! @goField(forceResolver: true)
|
||||||
|
|
||||||
businessOwner: People @goField(forceResolver: true)
|
businessOwner: Profile @goField(forceResolver: true)
|
||||||
securityOwner: People @goField(forceResolver: true)
|
securityOwner: Profile @goField(forceResolver: true)
|
||||||
|
|
||||||
statusPageUrl: String
|
statusPageUrl: String
|
||||||
termsOfServiceUrl: String
|
termsOfServiceUrl: String
|
||||||
@@ -2148,7 +2124,7 @@ type Task implements Node {
|
|||||||
state: TaskState!
|
state: TaskState!
|
||||||
timeEstimate: Duration
|
timeEstimate: Duration
|
||||||
deadline: Datetime
|
deadline: Datetime
|
||||||
assignedTo: People @goField(forceResolver: true)
|
assignedTo: Profile @goField(forceResolver: true)
|
||||||
|
|
||||||
organization: Organization! @goField(forceResolver: true)
|
organization: Organization! @goField(forceResolver: true)
|
||||||
measure: Measure @goField(forceResolver: true)
|
measure: Measure @goField(forceResolver: true)
|
||||||
@@ -2193,7 +2169,7 @@ type Document implements Node {
|
|||||||
classification: DocumentClassification!
|
classification: DocumentClassification!
|
||||||
currentPublishedVersion: Int
|
currentPublishedVersion: Int
|
||||||
trustCenterVisibility: TrustCenterVisibility!
|
trustCenterVisibility: TrustCenterVisibility!
|
||||||
owner: People! @goField(forceResolver: true)
|
owner: Profile! @goField(forceResolver: true)
|
||||||
organization: Organization! @goField(forceResolver: true)
|
organization: Organization! @goField(forceResolver: true)
|
||||||
|
|
||||||
versions(
|
versions(
|
||||||
@@ -2263,7 +2239,7 @@ type StateOfApplicability implements Node {
|
|||||||
sourceId: ID
|
sourceId: ID
|
||||||
snapshotId: ID
|
snapshotId: ID
|
||||||
organization: Organization @goField(forceResolver: true)
|
organization: Organization @goField(forceResolver: true)
|
||||||
owner: People! @goField(forceResolver: true)
|
owner: Profile! @goField(forceResolver: true)
|
||||||
createdAt: Datetime!
|
createdAt: Datetime!
|
||||||
updatedAt: Datetime!
|
updatedAt: Datetime!
|
||||||
|
|
||||||
@@ -2319,7 +2295,7 @@ type Risk implements Node {
|
|||||||
residualRiskScore: Int!
|
residualRiskScore: Int!
|
||||||
note: String!
|
note: String!
|
||||||
|
|
||||||
owner: People @goField(forceResolver: true)
|
owner: Profile @goField(forceResolver: true)
|
||||||
organization: Organization! @goField(forceResolver: true)
|
organization: Organization! @goField(forceResolver: true)
|
||||||
|
|
||||||
measures(
|
measures(
|
||||||
@@ -2401,7 +2377,7 @@ type Nonconformity implements Node {
|
|||||||
dateIdentified: Datetime
|
dateIdentified: Datetime
|
||||||
rootCause: String!
|
rootCause: String!
|
||||||
correctiveAction: String
|
correctiveAction: String
|
||||||
owner: People! @goField(forceResolver: true)
|
owner: Profile! @goField(forceResolver: true)
|
||||||
dueDate: Datetime
|
dueDate: Datetime
|
||||||
status: NonconformityStatus!
|
status: NonconformityStatus!
|
||||||
effectivenessCheck: String
|
effectivenessCheck: String
|
||||||
@@ -2421,7 +2397,7 @@ type Obligation implements Node {
|
|||||||
requirement: String
|
requirement: String
|
||||||
actionsToBeImplemented: String
|
actionsToBeImplemented: String
|
||||||
regulator: String
|
regulator: String
|
||||||
owner: People! @goField(forceResolver: true)
|
owner: Profile! @goField(forceResolver: true)
|
||||||
lastReviewDate: Datetime
|
lastReviewDate: Datetime
|
||||||
dueDate: Datetime
|
dueDate: Datetime
|
||||||
status: ObligationStatus!
|
status: ObligationStatus!
|
||||||
@@ -2440,7 +2416,7 @@ type ContinualImprovement implements Node {
|
|||||||
referenceId: String!
|
referenceId: String!
|
||||||
description: String
|
description: String
|
||||||
source: String
|
source: String
|
||||||
owner: People! @goField(forceResolver: true)
|
owner: Profile! @goField(forceResolver: true)
|
||||||
targetDate: Datetime
|
targetDate: Datetime
|
||||||
status: ContinualImprovementStatus!
|
status: ContinualImprovementStatus!
|
||||||
priority: ContinualImprovementPriority!
|
priority: ContinualImprovementPriority!
|
||||||
@@ -2489,7 +2465,7 @@ type ProcessingActivity implements Node {
|
|||||||
lastReviewDate: Datetime
|
lastReviewDate: Datetime
|
||||||
nextReviewDate: Datetime
|
nextReviewDate: Datetime
|
||||||
role: ProcessingActivityRole!
|
role: ProcessingActivityRole!
|
||||||
dataProtectionOfficer: People @goField(forceResolver: true)
|
dataProtectionOfficer: Profile @goField(forceResolver: true)
|
||||||
vendors(
|
vendors(
|
||||||
first: Int
|
first: Int
|
||||||
after: CursorKey
|
after: CursorKey
|
||||||
@@ -2710,11 +2686,10 @@ type TrustCenterFileEdge {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ProfileConnection
|
type ProfileConnection
|
||||||
# @goModel(
|
@goModel(
|
||||||
# model: "go.probo.inc/probo/pkg/server/api/console/v1/types.ProfileConnection"
|
model: "go.probo.inc/probo/pkg/server/api/console/v1/types.ProfileConnection"
|
||||||
# ) {
|
) {
|
||||||
# totalCount: Int! @goField(forceResolver: true)
|
totalCount: Int! @goField(forceResolver: true)
|
||||||
{
|
|
||||||
edges: [ProfileEdge!]!
|
edges: [ProfileEdge!]!
|
||||||
pageInfo: PageInfo!
|
pageInfo: PageInfo!
|
||||||
}
|
}
|
||||||
@@ -2724,20 +2699,6 @@ type ProfileEdge {
|
|||||||
node: Profile!
|
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
|
type VendorConnection
|
||||||
@goModel(
|
@goModel(
|
||||||
model: "go.probo.inc/probo/pkg/server/api/console/v1/types.VendorConnection"
|
model: "go.probo.inc/probo/pkg/server/api/console/v1/types.VendorConnection"
|
||||||
@@ -3152,10 +3113,6 @@ type Mutation {
|
|||||||
input: DeleteTrustCenterFileInput!
|
input: DeleteTrustCenterFileInput!
|
||||||
): DeleteTrustCenterFilePayload!
|
): DeleteTrustCenterFilePayload!
|
||||||
|
|
||||||
# People mutations
|
|
||||||
createPeople(input: CreatePeopleInput!): CreatePeoplePayload!
|
|
||||||
updatePeople(input: UpdatePeopleInput!): UpdatePeoplePayload!
|
|
||||||
deletePeople(input: DeletePeopleInput!): DeletePeoplePayload!
|
|
||||||
# Vendor mutations
|
# Vendor mutations
|
||||||
createVendor(input: CreateVendorInput!): CreateVendorPayload!
|
createVendor(input: CreateVendorInput!): CreateVendorPayload!
|
||||||
updateVendor(input: UpdateVendorInput!): UpdateVendorPayload!
|
updateVendor(input: UpdateVendorInput!): UpdateVendorPayload!
|
||||||
@@ -3657,32 +3614,6 @@ input DeleteVendorServiceInput {
|
|||||||
vendorServiceId: ID!
|
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 {
|
input CreateFrameworkInput {
|
||||||
organizationId: ID!
|
organizationId: ID!
|
||||||
name: String!
|
name: String!
|
||||||
@@ -4452,18 +4383,6 @@ type DeleteVendorServicePayload {
|
|||||||
deletedVendorServiceId: ID!
|
deletedVendorServiceId: ID!
|
||||||
}
|
}
|
||||||
|
|
||||||
type CreatePeoplePayload {
|
|
||||||
peopleEdge: PeopleEdge!
|
|
||||||
}
|
|
||||||
|
|
||||||
type UpdatePeoplePayload {
|
|
||||||
people: People!
|
|
||||||
}
|
|
||||||
|
|
||||||
type DeletePeoplePayload {
|
|
||||||
deletedPeopleId: ID!
|
|
||||||
}
|
|
||||||
|
|
||||||
type CreateFrameworkPayload {
|
type CreateFrameworkPayload {
|
||||||
frameworkEdge: FrameworkEdge!
|
frameworkEdge: FrameworkEdge!
|
||||||
}
|
}
|
||||||
@@ -4766,7 +4685,7 @@ type DocumentVersion implements Node {
|
|||||||
changelog: String!
|
changelog: String!
|
||||||
title: String!
|
title: String!
|
||||||
classification: DocumentClassification!
|
classification: DocumentClassification!
|
||||||
owner: People! @goField(forceResolver: true)
|
owner: Profile! @goField(forceResolver: true)
|
||||||
|
|
||||||
signatures(
|
signatures(
|
||||||
first: Int
|
first: Int
|
||||||
@@ -4842,7 +4761,7 @@ type DocumentVersionSignature implements Node {
|
|||||||
id: ID!
|
id: ID!
|
||||||
documentVersion: DocumentVersion! @goField(forceResolver: true)
|
documentVersion: DocumentVersion! @goField(forceResolver: true)
|
||||||
state: DocumentVersionSignatureState!
|
state: DocumentVersionSignatureState!
|
||||||
signedBy: People! @goField(forceResolver: true)
|
signedBy: Profile! @goField(forceResolver: true)
|
||||||
signedAt: Datetime
|
signedAt: Datetime
|
||||||
requestedAt: Datetime!
|
requestedAt: Datetime!
|
||||||
createdAt: Datetime!
|
createdAt: Datetime!
|
||||||
@@ -4988,7 +4907,7 @@ type Asset implements Node {
|
|||||||
snapshotId: ID
|
snapshotId: ID
|
||||||
name: String!
|
name: String!
|
||||||
amount: Int!
|
amount: Int!
|
||||||
owner: People! @goField(forceResolver: true)
|
owner: Profile! @goField(forceResolver: true)
|
||||||
vendors(
|
vendors(
|
||||||
first: Int
|
first: Int
|
||||||
after: CursorKey
|
after: CursorKey
|
||||||
@@ -5071,7 +4990,7 @@ type Datum implements Node
|
|||||||
snapshotId: ID
|
snapshotId: ID
|
||||||
name: String!
|
name: String!
|
||||||
dataClassification: DataClassification!
|
dataClassification: DataClassification!
|
||||||
owner: People! @goField(forceResolver: true)
|
owner: Profile! @goField(forceResolver: true)
|
||||||
vendors(
|
vendors(
|
||||||
first: Int
|
first: Int
|
||||||
after: CursorKey
|
after: CursorKey
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -54,7 +54,7 @@ func NewAsset(asset *coredata.Asset) *Asset {
|
|||||||
SnapshotID: asset.SnapshotID,
|
SnapshotID: asset.SnapshotID,
|
||||||
Name: asset.Name,
|
Name: asset.Name,
|
||||||
Amount: asset.Amount,
|
Amount: asset.Amount,
|
||||||
Owner: &People{
|
Owner: &Profile{
|
||||||
ID: asset.OwnerID,
|
ID: asset.OwnerID,
|
||||||
},
|
},
|
||||||
AssetType: asset.AssetType,
|
AssetType: asset.AssetType,
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ func NewContinualImprovement(ci *coredata.ContinualImprovement) *ContinualImprov
|
|||||||
Organization: &Organization{
|
Organization: &Organization{
|
||||||
ID: ci.OrganizationID,
|
ID: ci.OrganizationID,
|
||||||
},
|
},
|
||||||
Owner: &People{
|
Owner: &Profile{
|
||||||
ID: ci.OwnerID,
|
ID: ci.OwnerID,
|
||||||
},
|
},
|
||||||
SourceID: ci.SourceID,
|
SourceID: ci.SourceID,
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ type Datum struct {
|
|||||||
SnapshotID *gid.GID `json:"snapshotId,omitempty"`
|
SnapshotID *gid.GID `json:"snapshotId,omitempty"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
DataClassification coredata.DataClassification `json:"dataClassification"`
|
DataClassification coredata.DataClassification `json:"dataClassification"`
|
||||||
Owner *People `json:"owner"`
|
Owner *Profile `json:"owner"`
|
||||||
Vendors *VendorConnection `json:"vendors"`
|
Vendors *VendorConnection `json:"vendors"`
|
||||||
Organization *Organization `json:"organization"`
|
Organization *Organization `json:"organization"`
|
||||||
CreatedAt time.Time `json:"createdAt"`
|
CreatedAt time.Time `json:"createdAt"`
|
||||||
@@ -79,7 +79,7 @@ func NewDatum(d *coredata.Datum) *Datum {
|
|||||||
Organization: &Organization{
|
Organization: &Organization{
|
||||||
ID: d.OrganizationID,
|
ID: d.OrganizationID,
|
||||||
},
|
},
|
||||||
Owner: &People{
|
Owner: &Profile{
|
||||||
ID: d.OwnerID,
|
ID: d.OwnerID,
|
||||||
},
|
},
|
||||||
OrganizationID: d.OrganizationID,
|
OrganizationID: d.OrganizationID,
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ func NewDocument(document *coredata.Document) *Document {
|
|||||||
Organization: &Organization{
|
Organization: &Organization{
|
||||||
ID: document.OrganizationID,
|
ID: document.OrganizationID,
|
||||||
},
|
},
|
||||||
Owner: &People{
|
Owner: &Profile{
|
||||||
ID: document.OwnerID,
|
ID: document.OwnerID,
|
||||||
},
|
},
|
||||||
DocumentType: document.DocumentType,
|
DocumentType: document.DocumentType,
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ func NewDocumentVersion(documentVersion *coredata.DocumentVersion) *DocumentVers
|
|||||||
Document: &Document{
|
Document: &Document{
|
||||||
ID: documentVersion.DocumentID,
|
ID: documentVersion.DocumentID,
|
||||||
},
|
},
|
||||||
Owner: &People{
|
Owner: &Profile{
|
||||||
ID: documentVersion.OwnerID,
|
ID: documentVersion.OwnerID,
|
||||||
},
|
},
|
||||||
Version: documentVersion.VersionNumber,
|
Version: documentVersion.VersionNumber,
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ func NewDocumentVersionSignature(documentVersionSignature *coredata.DocumentVers
|
|||||||
DocumentVersion: &DocumentVersion{
|
DocumentVersion: &DocumentVersion{
|
||||||
ID: documentVersionSignature.DocumentVersionID,
|
ID: documentVersionSignature.DocumentVersionID,
|
||||||
},
|
},
|
||||||
SignedBy: &People{
|
SignedBy: &Profile{
|
||||||
ID: documentVersionSignature.SignedBy,
|
ID: documentVersionSignature.SignedBy,
|
||||||
},
|
},
|
||||||
ID: documentVersionSignature.ID,
|
ID: documentVersionSignature.ID,
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ func NewNonconformity(nr *coredata.Nonconformity) *Nonconformity {
|
|||||||
Organization: &Organization{
|
Organization: &Organization{
|
||||||
ID: nr.OrganizationID,
|
ID: nr.OrganizationID,
|
||||||
},
|
},
|
||||||
Owner: &People{
|
Owner: &Profile{
|
||||||
ID: nr.OwnerID,
|
ID: nr.OwnerID,
|
||||||
},
|
},
|
||||||
ReferenceID: nr.ReferenceID,
|
ReferenceID: nr.ReferenceID,
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ func NewObligation(cr *coredata.Obligation) *Obligation {
|
|||||||
Organization: &Organization{
|
Organization: &Organization{
|
||||||
ID: cr.OrganizationID,
|
ID: cr.OrganizationID,
|
||||||
},
|
},
|
||||||
Owner: &People{
|
Owner: &Profile{
|
||||||
ID: cr.OwnerID,
|
ID: cr.OwnerID,
|
||||||
},
|
},
|
||||||
Area: cr.Area,
|
Area: cr.Area,
|
||||||
|
|||||||
@@ -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,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -93,7 +93,7 @@ func NewProcessingActivity(par *coredata.ProcessingActivity) *ProcessingActivity
|
|||||||
}
|
}
|
||||||
|
|
||||||
if par.DataProtectionOfficerID != nil {
|
if par.DataProtectionOfficerID != nil {
|
||||||
object.DataProtectionOfficer = &People{
|
object.DataProtectionOfficer = &Profile{
|
||||||
ID: *par.DataProtectionOfficerID,
|
ID: *par.DataProtectionOfficerID,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,13 +14,66 @@
|
|||||||
|
|
||||||
package types
|
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 {
|
func NewProfile(profile *coredata.MembershipProfile) *Profile {
|
||||||
return &Profile{
|
return &Profile{
|
||||||
ID: profile.ID,
|
ID: profile.ID,
|
||||||
FullName: profile.FullName,
|
FullName: profile.FullName,
|
||||||
CreatedAt: profile.CreatedAt,
|
EmailAddress: profile.EmailAddress,
|
||||||
UpdatedAt: profile.UpdatedAt,
|
AdditionalEmailAddresses: profile.AdditionalEmailAddresses,
|
||||||
|
Kind: profile.Kind,
|
||||||
|
Position: profile.Position,
|
||||||
|
ContractStartDate: profile.ContractStartDate,
|
||||||
|
ContractEndDate: profile.ContractEndDate,
|
||||||
|
CreatedAt: profile.CreatedAt,
|
||||||
|
UpdatedAt: profile.UpdatedAt,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ func NewRisk(r *coredata.Risk) *Risk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if r.OwnerID != nil {
|
if r.OwnerID != nil {
|
||||||
risk.Owner = &People{
|
risk.Owner = &Profile{
|
||||||
ID: *r.OwnerID,
|
ID: *r.OwnerID,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ func NewStateOfApplicability(soa *coredata.StateOfApplicability) *StateOfApplica
|
|||||||
Organization: &Organization{
|
Organization: &Organization{
|
||||||
ID: soa.OrganizationID,
|
ID: soa.OrganizationID,
|
||||||
},
|
},
|
||||||
Owner: &People{
|
Owner: &Profile{
|
||||||
ID: soa.OwnerID,
|
ID: soa.OwnerID,
|
||||||
},
|
},
|
||||||
Name: soa.Name,
|
Name: soa.Name,
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ func NewTask(t *coredata.Task) *Task {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if t.AssignedToID != nil {
|
if t.AssignedToID != nil {
|
||||||
node.AssignedTo = &People{
|
node.AssignedTo = &Profile{
|
||||||
ID: *t.AssignedToID,
|
ID: *t.AssignedToID,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ type Asset struct {
|
|||||||
SnapshotID *gid.GID `json:"snapshotId,omitempty"`
|
SnapshotID *gid.GID `json:"snapshotId,omitempty"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Amount int `json:"amount"`
|
Amount int `json:"amount"`
|
||||||
Owner *People `json:"owner"`
|
Owner *Profile `json:"owner"`
|
||||||
Vendors *VendorConnection `json:"vendors"`
|
Vendors *VendorConnection `json:"vendors"`
|
||||||
AssetType coredata.AssetType `json:"assetType"`
|
AssetType coredata.AssetType `json:"assetType"`
|
||||||
DataTypesStored string `json:"dataTypesStored"`
|
DataTypesStored string `json:"dataTypesStored"`
|
||||||
@@ -157,7 +157,7 @@ type ContinualImprovement struct {
|
|||||||
ReferenceID string `json:"referenceId"`
|
ReferenceID string `json:"referenceId"`
|
||||||
Description *string `json:"description,omitempty"`
|
Description *string `json:"description,omitempty"`
|
||||||
Source *string `json:"source,omitempty"`
|
Source *string `json:"source,omitempty"`
|
||||||
Owner *People `json:"owner"`
|
Owner *Profile `json:"owner"`
|
||||||
TargetDate *time.Time `json:"targetDate,omitempty"`
|
TargetDate *time.Time `json:"targetDate,omitempty"`
|
||||||
Status coredata.ContinualImprovementStatus `json:"status"`
|
Status coredata.ContinualImprovementStatus `json:"status"`
|
||||||
Priority coredata.ContinualImprovementPriority `json:"priority"`
|
Priority coredata.ContinualImprovementPriority `json:"priority"`
|
||||||
@@ -457,21 +457,6 @@ type CreateObligationPayload struct {
|
|||||||
ObligationEdge *ObligationEdge `json:"obligationEdge"`
|
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 {
|
type CreateProcessingActivityInput struct {
|
||||||
OrganizationID gid.GID `json:"organizationId"`
|
OrganizationID gid.GID `json:"organizationId"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
@@ -952,14 +937,6 @@ type DeleteObligationPayload struct {
|
|||||||
DeletedObligationID gid.GID `json:"deletedObligationId"`
|
DeletedObligationID gid.GID `json:"deletedObligationId"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type DeletePeopleInput struct {
|
|
||||||
PeopleID gid.GID `json:"peopleId"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type DeletePeoplePayload struct {
|
|
||||||
DeletedPeopleID gid.GID `json:"deletedPeopleId"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type DeleteProcessingActivityInput struct {
|
type DeleteProcessingActivityInput struct {
|
||||||
ProcessingActivityID gid.GID `json:"processingActivityId"`
|
ProcessingActivityID gid.GID `json:"processingActivityId"`
|
||||||
}
|
}
|
||||||
@@ -1134,7 +1111,7 @@ type Document struct {
|
|||||||
Classification coredata.DocumentClassification `json:"classification"`
|
Classification coredata.DocumentClassification `json:"classification"`
|
||||||
CurrentPublishedVersion *int `json:"currentPublishedVersion,omitempty"`
|
CurrentPublishedVersion *int `json:"currentPublishedVersion,omitempty"`
|
||||||
TrustCenterVisibility coredata.TrustCenterVisibility `json:"trustCenterVisibility"`
|
TrustCenterVisibility coredata.TrustCenterVisibility `json:"trustCenterVisibility"`
|
||||||
Owner *People `json:"owner"`
|
Owner *Profile `json:"owner"`
|
||||||
Organization *Organization `json:"organization"`
|
Organization *Organization `json:"organization"`
|
||||||
Versions *DocumentVersionConnection `json:"versions"`
|
Versions *DocumentVersionConnection `json:"versions"`
|
||||||
Controls *ControlConnection `json:"controls"`
|
Controls *ControlConnection `json:"controls"`
|
||||||
@@ -1164,7 +1141,7 @@ type DocumentVersion struct {
|
|||||||
Changelog string `json:"changelog"`
|
Changelog string `json:"changelog"`
|
||||||
Title string `json:"title"`
|
Title string `json:"title"`
|
||||||
Classification coredata.DocumentClassification `json:"classification"`
|
Classification coredata.DocumentClassification `json:"classification"`
|
||||||
Owner *People `json:"owner"`
|
Owner *Profile `json:"owner"`
|
||||||
Signatures *DocumentVersionSignatureConnection `json:"signatures"`
|
Signatures *DocumentVersionSignatureConnection `json:"signatures"`
|
||||||
Signed bool `json:"signed"`
|
Signed bool `json:"signed"`
|
||||||
PublishedAt *time.Time `json:"publishedAt,omitempty"`
|
PublishedAt *time.Time `json:"publishedAt,omitempty"`
|
||||||
@@ -1189,7 +1166,7 @@ type DocumentVersionSignature struct {
|
|||||||
ID gid.GID `json:"id"`
|
ID gid.GID `json:"id"`
|
||||||
DocumentVersion *DocumentVersion `json:"documentVersion"`
|
DocumentVersion *DocumentVersion `json:"documentVersion"`
|
||||||
State coredata.DocumentVersionSignatureState `json:"state"`
|
State coredata.DocumentVersionSignatureState `json:"state"`
|
||||||
SignedBy *People `json:"signedBy"`
|
SignedBy *Profile `json:"signedBy"`
|
||||||
SignedAt *time.Time `json:"signedAt,omitempty"`
|
SignedAt *time.Time `json:"signedAt,omitempty"`
|
||||||
RequestedAt time.Time `json:"requestedAt"`
|
RequestedAt time.Time `json:"requestedAt"`
|
||||||
CreatedAt time.Time `json:"createdAt"`
|
CreatedAt time.Time `json:"createdAt"`
|
||||||
@@ -1434,7 +1411,7 @@ type Nonconformity struct {
|
|||||||
DateIdentified *time.Time `json:"dateIdentified,omitempty"`
|
DateIdentified *time.Time `json:"dateIdentified,omitempty"`
|
||||||
RootCause string `json:"rootCause"`
|
RootCause string `json:"rootCause"`
|
||||||
CorrectiveAction *string `json:"correctiveAction,omitempty"`
|
CorrectiveAction *string `json:"correctiveAction,omitempty"`
|
||||||
Owner *People `json:"owner"`
|
Owner *Profile `json:"owner"`
|
||||||
DueDate *time.Time `json:"dueDate,omitempty"`
|
DueDate *time.Time `json:"dueDate,omitempty"`
|
||||||
Status coredata.NonconformityStatus `json:"status"`
|
Status coredata.NonconformityStatus `json:"status"`
|
||||||
EffectivenessCheck *string `json:"effectivenessCheck,omitempty"`
|
EffectivenessCheck *string `json:"effectivenessCheck,omitempty"`
|
||||||
@@ -1465,7 +1442,7 @@ type Obligation struct {
|
|||||||
Requirement *string `json:"requirement,omitempty"`
|
Requirement *string `json:"requirement,omitempty"`
|
||||||
ActionsToBeImplemented *string `json:"actionsToBeImplemented,omitempty"`
|
ActionsToBeImplemented *string `json:"actionsToBeImplemented,omitempty"`
|
||||||
Regulator *string `json:"regulator,omitempty"`
|
Regulator *string `json:"regulator,omitempty"`
|
||||||
Owner *People `json:"owner"`
|
Owner *Profile `json:"owner"`
|
||||||
LastReviewDate *time.Time `json:"lastReviewDate,omitempty"`
|
LastReviewDate *time.Time `json:"lastReviewDate,omitempty"`
|
||||||
DueDate *time.Time `json:"dueDate,omitempty"`
|
DueDate *time.Time `json:"dueDate,omitempty"`
|
||||||
Status coredata.ObligationStatus `json:"status"`
|
Status coredata.ObligationStatus `json:"status"`
|
||||||
@@ -1501,7 +1478,6 @@ type Organization struct {
|
|||||||
Frameworks *FrameworkConnection `json:"frameworks"`
|
Frameworks *FrameworkConnection `json:"frameworks"`
|
||||||
Controls *ControlConnection `json:"controls"`
|
Controls *ControlConnection `json:"controls"`
|
||||||
Vendors *VendorConnection `json:"vendors"`
|
Vendors *VendorConnection `json:"vendors"`
|
||||||
Peoples *PeopleConnection `json:"peoples"`
|
|
||||||
Documents *DocumentConnection `json:"documents"`
|
Documents *DocumentConnection `json:"documents"`
|
||||||
Meetings *MeetingConnection `json:"meetings"`
|
Meetings *MeetingConnection `json:"meetings"`
|
||||||
StatesOfApplicability *StateOfApplicabilityConnection `json:"statesOfApplicability"`
|
StatesOfApplicability *StateOfApplicabilityConnection `json:"statesOfApplicability"`
|
||||||
@@ -1542,28 +1518,6 @@ type PageInfo struct {
|
|||||||
EndCursor *page.CursorKey `json:"endCursor,omitempty"`
|
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 {
|
type PeopleFilter struct {
|
||||||
ExcludeContractEnded *bool `json:"excludeContractEnded,omitempty"`
|
ExcludeContractEnded *bool `json:"excludeContractEnded,omitempty"`
|
||||||
}
|
}
|
||||||
@@ -1591,7 +1545,7 @@ type ProcessingActivity struct {
|
|||||||
LastReviewDate *time.Time `json:"lastReviewDate,omitempty"`
|
LastReviewDate *time.Time `json:"lastReviewDate,omitempty"`
|
||||||
NextReviewDate *time.Time `json:"nextReviewDate,omitempty"`
|
NextReviewDate *time.Time `json:"nextReviewDate,omitempty"`
|
||||||
Role coredata.ProcessingActivityRole `json:"role"`
|
Role coredata.ProcessingActivityRole `json:"role"`
|
||||||
DataProtectionOfficer *People `json:"dataProtectionOfficer,omitempty"`
|
DataProtectionOfficer *Profile `json:"dataProtectionOfficer,omitempty"`
|
||||||
Vendors *VendorConnection `json:"vendors"`
|
Vendors *VendorConnection `json:"vendors"`
|
||||||
DataProtectionImpactAssessment *DataProtectionImpactAssessment `json:"dataProtectionImpactAssessment,omitempty"`
|
DataProtectionImpactAssessment *DataProtectionImpactAssessment `json:"dataProtectionImpactAssessment,omitempty"`
|
||||||
TransferImpactAssessment *TransferImpactAssessment `json:"transferImpactAssessment,omitempty"`
|
TransferImpactAssessment *TransferImpactAssessment `json:"transferImpactAssessment,omitempty"`
|
||||||
@@ -1613,27 +1567,22 @@ type ProcessingActivityFilter struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Profile struct {
|
type Profile struct {
|
||||||
ID gid.GID `json:"id"`
|
ID gid.GID `json:"id"`
|
||||||
FullName string `json:"fullName"`
|
FullName string `json:"fullName"`
|
||||||
EmailAddress mail.Addr `json:"email_address"`
|
EmailAddress mail.Addr `json:"emailAddress"`
|
||||||
AdditionalEmailAddresses []mail.Addr `json:"additionalEmailAddresses"`
|
AdditionalEmailAddresses []mail.Addr `json:"additionalEmailAddresses"`
|
||||||
Kind coredata.PeopleKind `json:"kind"`
|
Kind coredata.MembershipProfileKind `json:"kind"`
|
||||||
Position *string `json:"position,omitempty"`
|
Position *string `json:"position,omitempty"`
|
||||||
ContractStartDate *time.Time `json:"contractStartDate,omitempty"`
|
ContractStartDate *time.Time `json:"contractStartDate,omitempty"`
|
||||||
ContractEndDate *time.Time `json:"contractEndDate,omitempty"`
|
ContractEndDate *time.Time `json:"contractEndDate,omitempty"`
|
||||||
CreatedAt time.Time `json:"createdAt"`
|
CreatedAt time.Time `json:"createdAt"`
|
||||||
UpdatedAt time.Time `json:"updatedAt"`
|
UpdatedAt time.Time `json:"updatedAt"`
|
||||||
Permission bool `json:"permission"`
|
Permission bool `json:"permission"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (Profile) IsNode() {}
|
func (Profile) IsNode() {}
|
||||||
func (this Profile) GetID() gid.GID { return this.ID }
|
func (this Profile) GetID() gid.GID { return this.ID }
|
||||||
|
|
||||||
type ProfileConnection struct {
|
|
||||||
Edges []*ProfileEdge `json:"edges"`
|
|
||||||
PageInfo *PageInfo `json:"pageInfo"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ProfileEdge struct {
|
type ProfileEdge struct {
|
||||||
Cursor page.CursorKey `json:"cursor"`
|
Cursor page.CursorKey `json:"cursor"`
|
||||||
Node *Profile `json:"node"`
|
Node *Profile `json:"node"`
|
||||||
@@ -1714,7 +1663,7 @@ type Risk struct {
|
|||||||
ResidualImpact int `json:"residualImpact"`
|
ResidualImpact int `json:"residualImpact"`
|
||||||
ResidualRiskScore int `json:"residualRiskScore"`
|
ResidualRiskScore int `json:"residualRiskScore"`
|
||||||
Note string `json:"note"`
|
Note string `json:"note"`
|
||||||
Owner *People `json:"owner,omitempty"`
|
Owner *Profile `json:"owner,omitempty"`
|
||||||
Organization *Organization `json:"organization"`
|
Organization *Organization `json:"organization"`
|
||||||
Measures *MeasureConnection `json:"measures"`
|
Measures *MeasureConnection `json:"measures"`
|
||||||
Documents *DocumentConnection `json:"documents"`
|
Documents *DocumentConnection `json:"documents"`
|
||||||
@@ -1797,7 +1746,7 @@ type StateOfApplicability struct {
|
|||||||
SourceID *gid.GID `json:"sourceId,omitempty"`
|
SourceID *gid.GID `json:"sourceId,omitempty"`
|
||||||
SnapshotID *gid.GID `json:"snapshotId,omitempty"`
|
SnapshotID *gid.GID `json:"snapshotId,omitempty"`
|
||||||
Organization *Organization `json:"organization,omitempty"`
|
Organization *Organization `json:"organization,omitempty"`
|
||||||
Owner *People `json:"owner"`
|
Owner *Profile `json:"owner"`
|
||||||
CreatedAt time.Time `json:"createdAt"`
|
CreatedAt time.Time `json:"createdAt"`
|
||||||
UpdatedAt time.Time `json:"updatedAt"`
|
UpdatedAt time.Time `json:"updatedAt"`
|
||||||
ApplicabilityStatements *ApplicabilityStatementConnection `json:"applicabilityStatements"`
|
ApplicabilityStatements *ApplicabilityStatementConnection `json:"applicabilityStatements"`
|
||||||
@@ -1823,7 +1772,7 @@ type Task struct {
|
|||||||
State coredata.TaskState `json:"state"`
|
State coredata.TaskState `json:"state"`
|
||||||
TimeEstimate *time.Duration `json:"timeEstimate,omitempty"`
|
TimeEstimate *time.Duration `json:"timeEstimate,omitempty"`
|
||||||
Deadline *time.Time `json:"deadline,omitempty"`
|
Deadline *time.Time `json:"deadline,omitempty"`
|
||||||
AssignedTo *People `json:"assignedTo,omitempty"`
|
AssignedTo *Profile `json:"assignedTo,omitempty"`
|
||||||
Organization *Organization `json:"organization"`
|
Organization *Organization `json:"organization"`
|
||||||
Measure *Measure `json:"measure,omitempty"`
|
Measure *Measure `json:"measure,omitempty"`
|
||||||
Evidences *EvidenceConnection `json:"evidences"`
|
Evidences *EvidenceConnection `json:"evidences"`
|
||||||
@@ -2165,21 +2114,6 @@ type UpdateOrganizationContextPayload struct {
|
|||||||
Context *OrganizationContext `json:"context"`
|
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 {
|
type UpdateProcessingActivityInput struct {
|
||||||
ID gid.GID `json:"id"`
|
ID gid.GID `json:"id"`
|
||||||
Name *string `json:"name,omitempty"`
|
Name *string `json:"name,omitempty"`
|
||||||
@@ -2484,8 +2418,8 @@ type Vendor struct {
|
|||||||
Contacts *VendorContactConnection `json:"contacts"`
|
Contacts *VendorContactConnection `json:"contacts"`
|
||||||
Services *VendorServiceConnection `json:"services"`
|
Services *VendorServiceConnection `json:"services"`
|
||||||
RiskAssessments *VendorRiskAssessmentConnection `json:"riskAssessments"`
|
RiskAssessments *VendorRiskAssessmentConnection `json:"riskAssessments"`
|
||||||
BusinessOwner *People `json:"businessOwner,omitempty"`
|
BusinessOwner *Profile `json:"businessOwner,omitempty"`
|
||||||
SecurityOwner *People `json:"securityOwner,omitempty"`
|
SecurityOwner *Profile `json:"securityOwner,omitempty"`
|
||||||
StatusPageURL *string `json:"statusPageUrl,omitempty"`
|
StatusPageURL *string `json:"statusPageUrl,omitempty"`
|
||||||
TermsOfServiceURL *string `json:"termsOfServiceUrl,omitempty"`
|
TermsOfServiceURL *string `json:"termsOfServiceUrl,omitempty"`
|
||||||
PrivacyPolicyURL *string `json:"privacyPolicyUrl,omitempty"`
|
PrivacyPolicyURL *string `json:"privacyPolicyUrl,omitempty"`
|
||||||
|
|||||||
@@ -90,13 +90,13 @@ func NewVendor(v *coredata.Vendor) *Vendor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if v.BusinessOwnerID != nil {
|
if v.BusinessOwnerID != nil {
|
||||||
object.BusinessOwner = &People{
|
object.BusinessOwner = &Profile{
|
||||||
ID: *v.BusinessOwnerID,
|
ID: *v.BusinessOwnerID,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if v.SecurityOwnerID != nil {
|
if v.SecurityOwnerID != nil {
|
||||||
object.SecurityOwner = &People{
|
object.SecurityOwner = &Profile{
|
||||||
ID: *v.SecurityOwnerID,
|
ID: *v.SecurityOwnerID,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,14 +84,12 @@ func (r *applicabilityStatementConnectionResolver) TotalCount(ctx context.Contex
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Owner is the resolver for the owner field.
|
// 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 {
|
if err := r.authorize(ctx, obj.ID, probo.ActionPeopleGet); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
prb := r.ProboService(ctx, obj.ID.TenantID())
|
owner, err := r.iam.OrganizationService.GetProfile(ctx, obj.Owner.ID)
|
||||||
|
|
||||||
owner, err := prb.Peoples.Get(ctx, obj.Owner.ID)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if errors.Is(err, coredata.ErrResourceNotFound) {
|
if errors.Is(err, coredata.ErrResourceNotFound) {
|
||||||
return nil, gqlutils.NotFound(ctx, err)
|
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))
|
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.
|
// 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.
|
// 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 {
|
if err := r.authorize(ctx, obj.ID, probo.ActionPeopleGet); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
prb := r.ProboService(ctx, obj.ID.TenantID())
|
owner, err := r.iam.OrganizationService.GetProfile(ctx, obj.Owner.ID)
|
||||||
|
|
||||||
people, err := prb.Peoples.Get(ctx, obj.Owner.ID)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if errors.Is(err, coredata.ErrResourceNotFound) {
|
if errors.Is(err, coredata.ErrResourceNotFound) {
|
||||||
return nil, gqlutils.NotFound(ctx, err)
|
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))
|
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.
|
// 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.
|
// 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 {
|
if err := r.authorize(ctx, obj.ID, probo.ActionPeopleGet); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
prb := r.ProboService(ctx, obj.ID.TenantID())
|
owner, err := r.iam.OrganizationService.GetProfile(ctx, obj.Owner.ID)
|
||||||
|
|
||||||
people, err := prb.Peoples.Get(ctx, obj.Owner.ID)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if errors.Is(err, coredata.ErrResourceNotFound) {
|
if errors.Is(err, coredata.ErrResourceNotFound) {
|
||||||
return nil, gqlutils.NotFound(ctx, err)
|
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 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.
|
// 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.
|
// 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 {
|
if err := r.authorize(ctx, obj.ID, probo.ActionPeopleGet); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
prb := r.ProboService(ctx, obj.ID.TenantID())
|
owner, err := r.iam.OrganizationService.GetProfile(ctx, obj.Owner.ID)
|
||||||
|
|
||||||
// Get the owner
|
|
||||||
owner, err := prb.Peoples.Get(ctx, obj.Owner.ID)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if errors.Is(err, coredata.ErrResourceNotFound) {
|
if errors.Is(err, coredata.ErrResourceNotFound) {
|
||||||
return nil, gqlutils.NotFound(ctx, err)
|
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))
|
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.
|
// 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.
|
// 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 {
|
if err := r.authorize(ctx, obj.ID, probo.ActionPeopleGet); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
prb := r.ProboService(ctx, obj.ID.TenantID())
|
owner, err := r.iam.OrganizationService.GetProfile(ctx, obj.Owner.ID)
|
||||||
|
|
||||||
owner, err := prb.Peoples.Get(ctx, obj.Owner.ID)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if errors.Is(err, coredata.ErrResourceNotFound) {
|
if errors.Is(err, coredata.ErrResourceNotFound) {
|
||||||
return nil, gqlutils.NotFound(ctx, err)
|
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))
|
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.
|
// 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.
|
// 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 {
|
if err := r.authorize(ctx, obj.ID, probo.ActionPeopleGet); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
prb := r.ProboService(ctx, obj.ID.TenantID())
|
signatory, err := r.iam.OrganizationService.GetProfile(ctx, obj.SignedBy.ID)
|
||||||
|
|
||||||
people, err := prb.Peoples.Get(ctx, obj.SignedBy.ID)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if errors.Is(err, coredata.ErrResourceNotFound) {
|
if errors.Is(err, coredata.ErrResourceNotFound) {
|
||||||
return nil, gqlutils.NotFound(ctx, err)
|
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))
|
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.
|
// Permission is the resolver for the permission field.
|
||||||
@@ -2142,96 +2129,6 @@ func (r *mutationResolver) DeleteTrustCenterFile(ctx context.Context, input type
|
|||||||
}, nil
|
}, 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.
|
// CreateVendor is the resolver for the createVendor field.
|
||||||
func (r *mutationResolver) CreateVendor(ctx context.Context, input types.CreateVendorInput) (*types.CreateVendorPayload, error) {
|
func (r *mutationResolver) CreateVendor(ctx context.Context, input types.CreateVendorInput) (*types.CreateVendorPayload, error) {
|
||||||
if err := r.authorize(ctx, input.OrganizationID, probo.ActionVendorCreate); err != nil {
|
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.
|
// 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 {
|
if err := r.authorize(ctx, obj.ID, probo.ActionPeopleGet); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
prb := r.ProboService(ctx, obj.ID.TenantID())
|
owner, err := r.iam.OrganizationService.GetProfile(ctx, obj.Owner.ID)
|
||||||
|
|
||||||
people, err := prb.Peoples.Get(ctx, obj.Owner.ID)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if errors.Is(err, coredata.ErrResourceNotFound) {
|
if errors.Is(err, coredata.ErrResourceNotFound) {
|
||||||
return nil, gqlutils.NotFound(ctx, err)
|
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))
|
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.
|
// 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.
|
// 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 {
|
if err := r.authorize(ctx, obj.ID, probo.ActionPeopleGet); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
prb := r.ProboService(ctx, obj.ID.TenantID())
|
owner, err := r.iam.OrganizationService.GetProfile(ctx, obj.Owner.ID)
|
||||||
|
|
||||||
people, err := prb.Peoples.Get(ctx, obj.Owner.ID)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if errors.Is(err, coredata.ErrResourceNotFound) {
|
if errors.Is(err, coredata.ErrResourceNotFound) {
|
||||||
return nil, gqlutils.NotFound(ctx, err)
|
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))
|
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.
|
// 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
|
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.
|
// 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) {
|
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 {
|
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)
|
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.
|
// Organization is the resolver for the organization field.
|
||||||
func (r *processingActivityResolver) Organization(ctx context.Context, obj *types.ProcessingActivity) (*types.Organization, error) {
|
func (r *processingActivityResolver) Organization(ctx context.Context, obj *types.ProcessingActivity) (*types.Organization, error) {
|
||||||
if err := r.authorize(ctx, obj.ID, probo.ActionOrganizationGet); err != nil {
|
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.
|
// 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 {
|
if err := r.authorize(ctx, obj.ID, probo.ActionPeopleGet); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
prb := r.ProboService(ctx, obj.ID.TenantID())
|
if obj.DataProtectionOfficer == nil {
|
||||||
|
|
||||||
processingActivity, err := prb.ProcessingActivities.Get(ctx, obj.ID)
|
|
||||||
if err != nil {
|
|
||||||
panic(fmt.Errorf("cannot get processing activity: %w", err))
|
|
||||||
}
|
|
||||||
|
|
||||||
if processingActivity.DataProtectionOfficerID == nil {
|
|
||||||
return nil, 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 {
|
if err != nil {
|
||||||
panic(fmt.Errorf("cannot get data protection officer: %w", err))
|
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.
|
// 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"))
|
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.
|
// Node is the resolver for the node field.
|
||||||
func (r *queryResolver) Node(ctx context.Context, id gid.GID) (types.Node, error) {
|
func (r *queryResolver) Node(ctx context.Context, id gid.GID) (types.Node, error) {
|
||||||
var (
|
var (
|
||||||
@@ -7009,18 +6837,16 @@ func (r *rightsRequestConnectionResolver) TotalCount(ctx context.Context, obj *t
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Owner is the resolver for the owner field.
|
// 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 {
|
if err := r.authorize(ctx, obj.ID, probo.ActionPeopleGet); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
prb := r.ProboService(ctx, obj.ID.TenantID())
|
|
||||||
|
|
||||||
if obj.Owner == nil {
|
if obj.Owner == nil {
|
||||||
return nil, 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 err != nil {
|
||||||
if errors.Is(err, coredata.ErrResourceNotFound) {
|
if errors.Is(err, coredata.ErrResourceNotFound) {
|
||||||
return nil, gqlutils.NotFound(ctx, err)
|
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))
|
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.
|
// 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.
|
// 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 {
|
if err := r.authorize(ctx, obj.ID, probo.ActionPeopleGet); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
prb := r.ProboService(ctx, obj.ID.TenantID())
|
owner, err := r.iam.OrganizationService.GetProfile(ctx, obj.Owner.ID)
|
||||||
|
|
||||||
people, err := prb.Peoples.Get(ctx, obj.Owner.ID)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if errors.Is(err, coredata.ErrResourceNotFound) {
|
if errors.Is(err, coredata.ErrResourceNotFound) {
|
||||||
return nil, gqlutils.NotFound(ctx, err)
|
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))
|
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.
|
// 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.
|
// 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 {
|
if err := r.authorize(ctx, obj.ID, probo.ActionPeopleGet); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
prb := r.ProboService(ctx, obj.ID.TenantID())
|
|
||||||
|
|
||||||
if obj.AssignedTo == nil {
|
if obj.AssignedTo == nil {
|
||||||
return nil, 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 err != nil {
|
||||||
if errors.Is(err, coredata.ErrResourceNotFound) {
|
if errors.Is(err, coredata.ErrResourceNotFound) {
|
||||||
return nil, gqlutils.NotFound(ctx, err)
|
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))
|
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.
|
// 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.
|
// 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 {
|
if err := r.authorize(ctx, obj.ID, probo.ActionPeopleGet); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
prb := r.ProboService(ctx, obj.ID.TenantID())
|
if obj.BusinessOwner == nil {
|
||||||
|
|
||||||
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 {
|
|
||||||
return nil, 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 err != nil {
|
||||||
if errors.Is(err, coredata.ErrResourceNotFound) {
|
if errors.Is(err, coredata.ErrResourceNotFound) {
|
||||||
return nil, gqlutils.NotFound(ctx, err)
|
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))
|
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.
|
// 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 {
|
if err := r.authorize(ctx, obj.ID, probo.ActionPeopleGet); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
prb := r.ProboService(ctx, obj.ID.TenantID())
|
if obj.SecurityOwner == nil {
|
||||||
|
|
||||||
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 {
|
|
||||||
return nil, 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 err != nil {
|
||||||
if errors.Is(err, coredata.ErrResourceNotFound) {
|
if errors.Is(err, coredata.ErrResourceNotFound) {
|
||||||
return nil, gqlutils.NotFound(ctx, err)
|
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))
|
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.
|
// Permission is the resolver for the permission field.
|
||||||
@@ -8747,14 +8547,6 @@ func (r *Resolver) ObligationConnection() schema.ObligationConnectionResolver {
|
|||||||
// Organization returns schema.OrganizationResolver implementation.
|
// Organization returns schema.OrganizationResolver implementation.
|
||||||
func (r *Resolver) Organization() schema.OrganizationResolver { return &organizationResolver{r} }
|
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.
|
// ProcessingActivity returns schema.ProcessingActivityResolver implementation.
|
||||||
func (r *Resolver) ProcessingActivity() schema.ProcessingActivityResolver {
|
func (r *Resolver) ProcessingActivity() schema.ProcessingActivityResolver {
|
||||||
return &processingActivityResolver{r}
|
return &processingActivityResolver{r}
|
||||||
@@ -8768,6 +8560,11 @@ func (r *Resolver) ProcessingActivityConnection() schema.ProcessingActivityConne
|
|||||||
// Profile returns schema.ProfileResolver implementation.
|
// Profile returns schema.ProfileResolver implementation.
|
||||||
func (r *Resolver) Profile() schema.ProfileResolver { return &profileResolver{r} }
|
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.
|
// Query returns schema.QueryResolver implementation.
|
||||||
func (r *Resolver) Query() schema.QueryResolver { return &queryResolver{r} }
|
func (r *Resolver) Query() schema.QueryResolver { return &queryResolver{r} }
|
||||||
|
|
||||||
@@ -8938,11 +8735,10 @@ type nonconformityConnectionResolver struct{ *Resolver }
|
|||||||
type obligationResolver struct{ *Resolver }
|
type obligationResolver struct{ *Resolver }
|
||||||
type obligationConnectionResolver struct{ *Resolver }
|
type obligationConnectionResolver struct{ *Resolver }
|
||||||
type organizationResolver struct{ *Resolver }
|
type organizationResolver struct{ *Resolver }
|
||||||
type peopleResolver struct{ *Resolver }
|
|
||||||
type peopleConnectionResolver struct{ *Resolver }
|
|
||||||
type processingActivityResolver struct{ *Resolver }
|
type processingActivityResolver struct{ *Resolver }
|
||||||
type processingActivityConnectionResolver struct{ *Resolver }
|
type processingActivityConnectionResolver struct{ *Resolver }
|
||||||
type profileResolver struct{ *Resolver }
|
type profileResolver struct{ *Resolver }
|
||||||
|
type profileConnectionResolver struct{ *Resolver }
|
||||||
type queryResolver struct{ *Resolver }
|
type queryResolver struct{ *Resolver }
|
||||||
type reportResolver struct{ *Resolver }
|
type reportResolver struct{ *Resolver }
|
||||||
type rightsRequestResolver struct{ *Resolver }
|
type rightsRequestResolver struct{ *Resolver }
|
||||||
|
|||||||
Reference in New Issue
Block a user