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>
45 lines
1.6 KiB
Go
45 lines
1.6 KiB
Go
// Copyright (c) 2026 Probo Inc <hello@probo.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 thirdpartymgmt
|
|
|
|
import (
|
|
"github.com/spf13/cobra"
|
|
"go.probo.inc/probo/pkg/cmd/cmdutil"
|
|
"go.probo.inc/probo/pkg/cmd/thirdpartymgmt/create"
|
|
"go.probo.inc/probo/pkg/cmd/thirdpartymgmt/delete"
|
|
"go.probo.inc/probo/pkg/cmd/thirdpartymgmt/list"
|
|
"go.probo.inc/probo/pkg/cmd/thirdpartymgmt/publish"
|
|
"go.probo.inc/probo/pkg/cmd/thirdpartymgmt/update"
|
|
"go.probo.inc/probo/pkg/cmd/thirdpartymgmt/vet"
|
|
"go.probo.inc/probo/pkg/cmd/thirdpartymgmt/view"
|
|
)
|
|
|
|
func NewCmdThirdParty(f *cmdutil.Factory) *cobra.Command {
|
|
cmd := &cobra.Command{
|
|
Use: "thirdParty <command>",
|
|
Short: "Manage thirdParties",
|
|
}
|
|
|
|
cmd.AddCommand(list.NewCmdList(f))
|
|
cmd.AddCommand(create.NewCmdCreate(f))
|
|
cmd.AddCommand(view.NewCmdView(f))
|
|
cmd.AddCommand(update.NewCmdUpdate(f))
|
|
cmd.AddCommand(delete.NewCmdDelete(f))
|
|
cmd.AddCommand(vet.NewCmdVet(f))
|
|
cmd.AddCommand(publish.NewCmdPublish(f))
|
|
|
|
return cmd
|
|
}
|