Skip to content

Commit 3031c44

Browse files
authored
Merge pull request #355 from Digipalvelutehdas/feature/eslint-elasticsearch
Lint elasticsearch directory
2 parents 552ba93 + 51e535f commit 3031c44

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

.eslintignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ documentation/collection/server/publications.js
6969
documentation/server/methods/files.js
7070
documentation/server/methods/swagger.js
7171
documentation/server/publications.js
72-
elasticsearch/server/methods.js
7372
feedback_votes/collection/index.js
7473
feedback/client/form/autoform.js
7574
feedback/client/item/item.js

elasticsearch/server/methods.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
1+
import { check } from 'meteor/check';
12
import { Meteor } from 'meteor/meteor';
23
import ElasticSearch from 'elasticsearch';
34

45
Meteor.methods({
56
getElasticSearchData (proxyData, filterParameters) {
7+
// Make sure proxyData is an Object TODO: is there a schema for it?
8+
check(proxyData, Object);
9+
10+
// Make sure filterParameters is an Object TODO: is there a schema for it?
11+
check(filterParameters, Object);
12+
613
let params;
714

815
// Constructs the Elastic Search query object
@@ -25,13 +32,19 @@ Meteor.methods({
2532

2633
// Makes the HTTP request
2734
// Get Elastic Search data and return
28-
return esClient.search(params).then((res) => res, (err) => {
35+
return esClient.search(params).then((res) => { return res; }, (err) => {
2936
// Throw an error
3037
throw new Meteor.Error(err.message);
3138
});
3239
},
3340
// Constructs the Elastic Search query object for apiUmbrella
3441
getElasticQueryUmbrella (frontendPrefix, filterParameters) {
42+
// Make sure frontendPrefix is a String
43+
check(frontendPrefix, String);
44+
45+
// Make sure filterParameters is an Object TODO: is there a schema for it?
46+
check(filterParameters, Object);
47+
3548
// Construct parameters for Elastic Search
3649
// TODO: For case "Proxy Admin API" with prefix /api-umbrella/
3750
// TODO: Values aggregation associated with granularity

0 commit comments

Comments
 (0)