diff --git a/nodes/Plutio/Plutio.node.ts b/nodes/Plutio/Plutio.node.ts index 4d82ad6..1b0036e 100644 --- a/nodes/Plutio/Plutio.node.ts +++ b/nodes/Plutio/Plutio.node.ts @@ -826,6 +826,26 @@ export class Plutio implements INodeType { } } if ('project' === resource) { + if ('getCklph' === operation) { + const contributor = this.getNodeParameter('contributor', i) as IDataObject; + + if (contributor) { + let contributorId; + const users = await plutioApiRequest.call(this, 'GET', '/people'); + for (const user of users) { + if (user.contactEmails[0].address === contributor || contributor === user._id) { + contributorId = user._id; + } + } + qs.contributors = contributorId as string; + } + const project = await plutioApiRequest.call(this, 'GET', '/projects', {}, qs); + if (project.length === 1) { + responseData = project; + } else { + responseData = {'name': 'default'}; + } + } if ('get' === operation) { const options = this.getNodeParameter('options', i) as IDataObject; diff --git a/nodes/Plutio/descriptions/ProjectDescription.ts b/nodes/Plutio/descriptions/ProjectDescription.ts index 5852b01..8e29476 100644 --- a/nodes/Plutio/descriptions/ProjectDescription.ts +++ b/nodes/Plutio/descriptions/ProjectDescription.ts @@ -17,6 +17,12 @@ export const projectOperations: INodeProperties[] = [ }, }, options: [ + // { + // name: 'Chykalophia', + // value: 'getCklph', + // description: 'Get projects by contributor\'s email for CKLPH', + // action: 'Get a project', + // }, { name: 'Copy', value: 'copy', @@ -54,7 +60,7 @@ export const projectOperations: INodeProperties[] = [ action: 'Update a project', }, ], - default: 'get', + default: 'getCklph', }, ];