Add options to sideload owner and vendors
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
@@ -86,6 +86,35 @@ export const description: INodeProperties[] = [
|
||||
default: '',
|
||||
description: 'Comma-separated list of vendor IDs',
|
||||
},
|
||||
{
|
||||
displayName: 'Options',
|
||||
name: 'options',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Option',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['datum'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Include Owner',
|
||||
name: 'includeOwner',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Whether to include owner details in the response',
|
||||
},
|
||||
{
|
||||
displayName: 'Include Vendors',
|
||||
name: 'includeVendors',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Whether to include vendors in the response',
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
export async function execute(
|
||||
@@ -97,6 +126,29 @@ export async function execute(
|
||||
const dataClassification = this.getNodeParameter('dataClassification', itemIndex, '') as string;
|
||||
const ownerId = this.getNodeParameter('ownerId', itemIndex, '') as string;
|
||||
const vendorIdsStr = this.getNodeParameter('vendorIds', itemIndex, '') as string;
|
||||
const options = this.getNodeParameter('options', itemIndex, {}) as {
|
||||
includeOwner?: boolean;
|
||||
includeVendors?: boolean;
|
||||
};
|
||||
|
||||
const ownerFragment = options.includeOwner
|
||||
? `owner {
|
||||
id
|
||||
fullName
|
||||
primaryEmailAddress
|
||||
}`
|
||||
: '';
|
||||
|
||||
const vendorsFragment = options.includeVendors
|
||||
? `vendors(first: 100) {
|
||||
edges {
|
||||
node {
|
||||
id
|
||||
name
|
||||
}
|
||||
}
|
||||
}`
|
||||
: '';
|
||||
|
||||
const query = `
|
||||
mutation UpdateDatum($input: UpdateDatumInput!) {
|
||||
@@ -105,6 +157,8 @@ export async function execute(
|
||||
id
|
||||
name
|
||||
dataClassification
|
||||
${ownerFragment}
|
||||
${vendorsFragment}
|
||||
createdAt
|
||||
updatedAt
|
||||
}
|
||||
@@ -128,4 +182,3 @@ export async function execute(
|
||||
pairedItem: { item: itemIndex },
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user