Add third-party self-referential relations

Introduce a self-referential many-to-many relation table so a
third party can have child third parties. Each relation is
directional (parent to child); both directions can coexist as
independent rows.

Add a first_level boolean on third_parties (default true) with
a filter on the list page that defaults to showing only
first-level third parties.

Frontend adds a "Third Parties" tab on the detail page where
users can link existing third parties or create new ones from
the common third party catalog (created as non-first-level).
The list page gets a First Level/All toggle filter.

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
Sacha Al Himdani
2026-05-19 19:13:16 +02:00
parent 8ff68798fb
commit b6b1e801b1
37 changed files with 2399 additions and 45 deletions

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2025 Probo Inc <hello@getprobo.com>.
// Copyright (c) 2025-2026 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
@@ -73,6 +73,13 @@ export const description: INodeProperties[] = [
},
},
options: [
{
displayName: 'Filter by Root',
name: 'filterFirstLevel',
type: 'boolean',
default: false,
description: 'Whether to filter by first-level third parties only',
},
{
displayName: 'Include Organization',
name: 'includeOrganization',
@@ -106,6 +113,7 @@ export async function execute(
const returnAll = this.getNodeParameter('returnAll', itemIndex) as boolean;
const limit = this.getNodeParameter('limit', itemIndex, 50) as number;
const options = this.getNodeParameter('options', itemIndex, {}) as {
filterFirstLevel?: boolean;
includeOrganization?: boolean;
includeBusinessOwner?: boolean;
includeSecurityOwner?: boolean;
@@ -134,11 +142,14 @@ export async function execute(
}`
: '';
const filterVariable = options.filterFirstLevel !== undefined ? ', $filter: ThirdPartyFilter' : '';
const filterArgument = options.filterFirstLevel !== undefined ? ', filter: $filter' : '';
const query = `
query GetThirdParties($organizationId: ID!, $first: Int, $after: CursorKey) {
query GetThirdParties($organizationId: ID!, $first: Int, $after: CursorKey${filterVariable}) {
node(id: $organizationId) {
... on Organization {
thirdParties(first: $first, after: $after) {
thirdParties(first: $first, after: $after${filterArgument}) {
edges {
node {
id
@@ -160,6 +171,7 @@ export async function execute(
certifications
countries
showOnTrustCenter
firstLevel
${organizationFragment}
${businessOwnerFragment}
${securityOwnerFragment}
@@ -177,10 +189,15 @@ export async function execute(
}
`;
const variables: IDataObject = { organizationId };
if (options.filterFirstLevel) {
variables.filter = { firstLevel: true };
}
const thirdParties = await proboApiRequestAllItems.call(
this,
query,
{ organizationId },
variables,
(response) => {
const data = response?.data as IDataObject | undefined;
const node = data?.node as IDataObject | undefined;