Link measures to third parties
Add a many-to-many relationship between measures and third parties, surfaced as a measures tab on the third party detail page and a third parties tab on the measure detail page. Each side gets a paginated list with a link/unlink dialog. Also remove the right-hand drawer on the measure detail page and expose the state as a badge in the page header, mirroring how the compliance page surfaces its active flag. Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
@@ -19,7 +19,9 @@ import * as deleteOp from './delete.operation';
|
||||
import * as getOp from './get.operation';
|
||||
import * as getAllOp from './getAll.operation';
|
||||
import * as linkDocumentOp from './linkDocument.operation';
|
||||
import * as linkThirdPartyOp from './linkThirdParty.operation';
|
||||
import * as unlinkDocumentOp from './unlinkDocument.operation';
|
||||
import * as unlinkThirdPartyOp from './unlinkThirdParty.operation';
|
||||
|
||||
export const description: INodeProperties[] = [
|
||||
{
|
||||
@@ -63,12 +65,24 @@ export const description: INodeProperties[] = [
|
||||
description: 'Link a document to a measure',
|
||||
action: 'Link a document to a measure',
|
||||
},
|
||||
{
|
||||
name: 'Link Third Party',
|
||||
value: 'linkThirdParty',
|
||||
description: 'Link a third party to a measure',
|
||||
action: 'Link a third party to a measure',
|
||||
},
|
||||
{
|
||||
name: 'Unlink Document',
|
||||
value: 'unlinkDocument',
|
||||
description: 'Unlink a document from a measure',
|
||||
action: 'Unlink a document from a measure',
|
||||
},
|
||||
{
|
||||
name: 'Unlink Third Party',
|
||||
value: 'unlinkThirdParty',
|
||||
description: 'Unlink a third party from a measure',
|
||||
action: 'Unlink a third party from a measure',
|
||||
},
|
||||
{
|
||||
name: 'Update',
|
||||
value: 'update',
|
||||
@@ -85,6 +99,8 @@ export const description: INodeProperties[] = [
|
||||
...getAllOp.description,
|
||||
...linkDocumentOp.description,
|
||||
...unlinkDocumentOp.description,
|
||||
...linkThirdPartyOp.description,
|
||||
...unlinkThirdPartyOp.description,
|
||||
];
|
||||
|
||||
export {
|
||||
@@ -95,4 +111,6 @@ export {
|
||||
getAllOp as getAll,
|
||||
linkDocumentOp as linkDocument,
|
||||
unlinkDocumentOp as unlinkDocument,
|
||||
linkThirdPartyOp as linkThirdParty,
|
||||
unlinkThirdPartyOp as unlinkThirdParty,
|
||||
};
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
// 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
|
||||
// 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.
|
||||
|
||||
import type { INodeProperties, IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
|
||||
import { proboApiRequest } from '../../GenericFunctions';
|
||||
|
||||
export const description: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Measure ID',
|
||||
name: 'measureId',
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['measure'],
|
||||
operation: ['linkThirdParty'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'The ID of the measure',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Third Party ID',
|
||||
name: 'thirdPartyId',
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['measure'],
|
||||
operation: ['linkThirdParty'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'The ID of the third party to link',
|
||||
required: true,
|
||||
},
|
||||
];
|
||||
|
||||
export async function execute(
|
||||
this: IExecuteFunctions,
|
||||
itemIndex: number,
|
||||
): Promise<INodeExecutionData> {
|
||||
const measureId = this.getNodeParameter('measureId', itemIndex) as string;
|
||||
const thirdPartyId = this.getNodeParameter('thirdPartyId', itemIndex) as string;
|
||||
|
||||
const query = `
|
||||
mutation CreateMeasureThirdPartyMapping($input: CreateMeasureThirdPartyMappingInput!) {
|
||||
createMeasureThirdPartyMapping(input: $input) {
|
||||
measureEdge {
|
||||
node {
|
||||
id
|
||||
name
|
||||
}
|
||||
}
|
||||
thirdPartyEdge {
|
||||
node {
|
||||
id
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
const responseData = await proboApiRequest.call(this, query, { input: { measureId, thirdPartyId } });
|
||||
|
||||
return {
|
||||
json: responseData,
|
||||
pairedItem: { item: itemIndex },
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
// 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
|
||||
// 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.
|
||||
|
||||
import type { INodeProperties, IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
|
||||
import { proboApiRequest } from '../../GenericFunctions';
|
||||
|
||||
export const description: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Measure ID',
|
||||
name: 'measureId',
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['measure'],
|
||||
operation: ['unlinkThirdParty'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'The ID of the measure',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Third Party ID',
|
||||
name: 'thirdPartyId',
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['measure'],
|
||||
operation: ['unlinkThirdParty'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'The ID of the third party to unlink',
|
||||
required: true,
|
||||
},
|
||||
];
|
||||
|
||||
export async function execute(
|
||||
this: IExecuteFunctions,
|
||||
itemIndex: number,
|
||||
): Promise<INodeExecutionData> {
|
||||
const measureId = this.getNodeParameter('measureId', itemIndex) as string;
|
||||
const thirdPartyId = this.getNodeParameter('thirdPartyId', itemIndex) as string;
|
||||
|
||||
const query = `
|
||||
mutation DeleteMeasureThirdPartyMapping($input: DeleteMeasureThirdPartyMappingInput!) {
|
||||
deleteMeasureThirdPartyMapping(input: $input) {
|
||||
deletedMeasureId
|
||||
deletedThirdPartyId
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
const responseData = await proboApiRequest.call(this, query, { input: { measureId, thirdPartyId } });
|
||||
|
||||
return {
|
||||
json: responseData,
|
||||
pairedItem: { item: itemIndex },
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user