Skip to content

Commit

Permalink
Update Collection method
Browse files Browse the repository at this point in the history
  • Loading branch information
chughts committed Mar 25, 2022
1 parent 9895ed8 commit 83da9b0
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 7 deletions.
34 changes: 30 additions & 4 deletions services/discovery/v2-project-manager.html
Original file line number Diff line number Diff line change
Expand Up @@ -194,15 +194,13 @@
</ul>
</li>


<br/>

<li>
<p><b>Create new collection</b><p>
<p>For this method the node needs project id, and collection name.
Optional inputs are
description and language
....... as input.
description and language as input.
</p>
<p>The project id, collection name, description and language
can be overridden by specifying
Expand All @@ -220,6 +218,31 @@
</ul>
</li>

<br/>

<li>
<p><b>Update collection</b><p>
<p>For this method the node needs project id, collection id.
Optional inputs are collection name,
description and language as.
</p>
<p>The project id, collection id, collection name, description and language
can be overridden by specifying
the <code>msg.discoveryparams.projectId</code> ,
<code>msg.discoveryparams.collectionId</code> ,
<code>msg.discoveryparams.collectionName</code> ,
<code>msg.discoveryparams.description</code>
and <code>msg.discoveryparams.language</code>
</p>
<p>Any enrichments for the collection can be set by
specifying <code>msg.discoveryparams.enrichments</code>
</p>
<p>Node output : </p>
<ul>
<li><code>msg.discovery_response</code> : Details of the updated collection.</li>
</ul>
</li>


</ul>

Expand Down Expand Up @@ -275,13 +298,16 @@
fields.push('#node-input-projectId');
fields.push('#node-input-collectionId');
break;

case 'updateCollection':
fields.push('#node-input-collectionId');
// deliberate no break;
case 'createCollection':
fields.push('#node-input-projectId');
fields.push('#node-input-collectionName');
fields.push('#node-input-description');
fields.push('#node-input-language');
break;

}

disV2pm.showSelectedFields(fields);
Expand Down
8 changes: 5 additions & 3 deletions services/discovery/v2-project-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ module.exports = function (RED) {

'listCollections' : executeListCollections,
'getCollection' : executeDiscoveryMethod,
'createCollection' : executeDiscoveryMethod
'createCollection' : executeDiscoveryMethod,
'updateCollection' : executeDiscoveryMethod
};

function executeListProjects(fields) {
Expand Down Expand Up @@ -115,13 +116,14 @@ module.exports = function (RED) {
break;

case 'updateProject':
case 'createCollection':
response = discoveryutils.paramProjectCheck(params)
+ discoveryutils.paramNameCheck(params);
break;

case 'createCollection':
case 'updateCollection':
response = discoveryutils.paramProjectCheck(params)
+ discoveryutils.paramNameCheck(params);
+ discoveryutils.paramCollectionCheck(params);
break;

}
Expand Down

0 comments on commit 83da9b0

Please sign in to comment.