Scope sub-third-parties per parent

Replace the many-to-many junction table with a direct
parent_third_party_id foreign key on third_parties. Each
sub-third-party now belongs to exactly one parent, making
duplicates across parents independent entities.

Replace the firstLevel boolean with an integer level field
(1 = direct, 2+ = parent level + 1) to support arbitrary
nesting depth.

Remove the createThirdPartyThirdPartyMapping and
deleteThirdPartyThirdPartyMapping mutations, the CLI
link/unlink commands, and the corresponding MCP tools.
Creating a child third party now just requires passing
parentThirdPartyId on the existing createThirdParty mutation.

The frontend walks the parentThirdParty chain to build
display names like "Name (Ancestor1/Ancestor2)" and shows
clickable ancestor links on the detail page.

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
Sacha Al Himdani
2026-05-29 16:22:54 +02:00
parent ec858e58df
commit b6781d3de0
36 changed files with 1276 additions and 1192 deletions

View File

@@ -641,9 +641,9 @@ components:
organization_id:
$ref: "#/components/schemas/GID"
description: Organization ID
first_level:
type: boolean
description: Filter by first-level status
level:
type: integer
description: Filter by level
order_by:
$ref: "#/components/schemas/ThirdPartyOrderBy"
description: ThirdParty order by
@@ -667,38 +667,6 @@ components:
items:
$ref: "#/components/schemas/ThirdParty"
CreateThirdPartyThirdPartyMappingInput:
type: object
required:
- parent_third_party_id
- child_third_party_id
properties:
parent_third_party_id:
$ref: "#/components/schemas/GID"
description: Parent third party ID
child_third_party_id:
$ref: "#/components/schemas/GID"
description: Child third party ID
CreateThirdPartyThirdPartyMappingOutput:
type: object
DeleteThirdPartyThirdPartyMappingInput:
type: object
required:
- parent_third_party_id
- child_third_party_id
properties:
parent_third_party_id:
$ref: "#/components/schemas/GID"
description: Parent third party ID
child_third_party_id:
$ref: "#/components/schemas/GID"
description: Child third party ID
DeleteThirdPartyThirdPartyMappingOutput:
type: object
ListChildThirdPartiesInput:
type: object
required:
@@ -737,7 +705,7 @@ components:
- name
- organization_id
- category
- first_level
- level
- created_at
- updated_at
properties:
@@ -861,9 +829,9 @@ components:
- string
- "null"
description: Trust page URL
first_level:
type: boolean
description: Whether this is a first-level third party
level:
type: integer
description: Level of this third party (1 = direct, 2+ = indirect)
created_at:
type: string
format: date-time
@@ -12055,22 +12023,6 @@ tools:
$ref: "#/components/schemas/ListThirdPartiesInput"
outputSchema:
$ref: "#/components/schemas/ListThirdPartiesOutput"
- name: createThirdPartyThirdPartyMapping
description: Link a child third party to a parent third party
hints:
readonly: false
inputSchema:
$ref: "#/components/schemas/CreateThirdPartyThirdPartyMappingInput"
outputSchema:
$ref: "#/components/schemas/CreateThirdPartyThirdPartyMappingOutput"
- name: deleteThirdPartyThirdPartyMapping
description: Unlink a child third party from a parent third party
hints:
readonly: false
inputSchema:
$ref: "#/components/schemas/DeleteThirdPartyThirdPartyMappingInput"
outputSchema:
$ref: "#/components/schemas/DeleteThirdPartyThirdPartyMappingOutput"
- name: listChildThirdParties
description: List child third parties linked to a parent third party
hints: