Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Register
Sign in
Toggle navigation
Menu
UPSMF
knowledge-mw-service
Commits
b12a9a57
Commit
b12a9a57
authored
6 years ago
by
revathi
Committed by
kochhar
6 years ago
Browse files
Options
Download
Patches
Plain Diff
Issue #SB-3715 fix: review fixes
parent
707ef4c3
master
dependabot/npm_and_yarn/src/async-2.6.4
dependabot/npm_and_yarn/src/decode-uri-component-0.2.2
dependabot/npm_and_yarn/src/flat-and-mocha-5.0.2
dependabot/npm_and_yarn/src/handlebars-4.7.7
dependabot/npm_and_yarn/src/jsonwebtoken-9.0.0
dependabot/npm_and_yarn/src/lodash-4.17.21
dependabot/npm_and_yarn/src/minimist-and-project-sunbird/telemetry-sdk-and-handlebars-and-mkdirp-1.2.8
release-3.6.0
release-4.3.0
release-4.8.0
release-5.2.0
release-5.3.0
release-5.6.0
release-6.0.0
v1.13.3
v1.13
v1.12
v1.11.1
v1.11
v1.10.1
v1.10
v1.9
tmp-testPR
tmp-sunbird-bootcamp
tmp-rjshrjndrn-patch-1
tmp-revert-118-testPR
tmp-revert-110-logs
tmp-revert-99-revert-98-revert-97-revert-96-rjshrjndrn-patch-1
tmp-revert-98-revert-97-revert-96-rjshrjndrn-patch-1
tmp-revert-97-revert-96-rjshrjndrn-patch-1
tmp-revert-96-rjshrjndrn-patch-1
tmp-release-sonarcloud
tmp-release-2.6.0
tmp-release-2.3.0
tmp-release-2.1.1
tmp-release-2.1.0
tmp-release-2.1.0_pluginSearch
tmp-release-2.0.0
tmp-release-1.15
tmp-release-1.14.3
tmp-release-1.14
tmp-release-1.14-sp3
tmp-refactored-dev-deploy
tmp-master
tmp-loadtest
tmp-load-testing
tmp-jenkins-test
tmp-jenkins-pipeline
tmp-final-variable-refac
tmp-dial-assemble-api
tmp-content-update-read
tmp-circleci
release-5.6.0_RC1
release-5.2.0_RC1
release-4.8.5_RC1
release-4.8.0_RC2
release-4.8.0_RC1
release-4.3.0_RC1
release-3.8.0_RC3
release-3.8.0_RC2
release-3.8.0_RC1
release-3.7.0_RC2
release-3.7.0_RC1
release-3.6.0_RC1
release-3.2.0_RC2
release-3.2.0_RC1
release-3.1.0
release-3.1.0_RC2
release-3.1.0_RC1
release-3.0.1_RC1
release-3.0.0
release-3.0.0_RC1
release-2.10.0
release-2.10.0_RC2
release-2.10.0_RC1
release-2.9.0_RC3
release-2.9.0_RC2
release-2.9.0_RC1
release-2.8.0
release-2.8.0_RC4
release-2.8.0_RC3
release-2.8.0_RC2
release-2.8.0_RC1
release-2.7.0
release-2.7.0_RC2
release-2.7.0_RC1
release-2.6.0
release-2.6.0_RC4
release-2.6.0_RC3
release-2.6.0_RC2
release-2.6.0_RC1
release-2.3.0
release-2.3.0_RC2
release-2.3.0_RC1
release-2.1.1_RC1
release-2.1.0_RC2
release-2.1.0_RC1
release-2.0.0
release-2.0.0_RC5
release-2.0.0_RC4
release-2.0.0_RC3
release-2.0.0_RC2
release-2.0.0_RC1
release-1.15.0
release-1.15_RC7
release-1.15_RC6
release-1.15_RC5
release-1.15_RC4
release-1.15_RC3
release-1.15_RC2
release-1.15_RC1
release-1.14.0
No related merge requests found
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
src/app.js
+12
-7
src/app.js
src/middlewares/filter.middleware.js
+3
-4
src/middlewares/filter.middleware.js
src/service/filterService.js
+4
-4
src/service/filterService.js
src/test/appSpec.js
+3
-1
src/test/appSpec.js
src/test/channelFilterRouteSpec.js
+0
-4
src/test/channelFilterRouteSpec.js
src/test/metaFilterRouteSpec.js
+4
-0
src/test/metaFilterRouteSpec.js
src/test/middlewares/filterMiddlewareSpec.js
+9
-0
src/test/middlewares/filterMiddlewareSpec.js
src/test/middlewares/requestMiddlewareSpec.js
+0
-7
src/test/middlewares/requestMiddlewareSpec.js
src/test/service/filterServiceSpec.js
+2
-2
src/test/service/filterServiceSpec.js
with
37 additions
and
29 deletions
+37
-29
src/app.js
+
12
−
7
View file @
b12a9a57
...
...
@@ -156,16 +156,21 @@ const telemetryConfig = {
telemetry
.
init
(
telemetryConfig
)
// function to generate the search string
// function to generate the search filter and return JSON Object
function
getMetaFilterConfig
()
{
return
setFilterJSONFromEnv
()
// Check if the Filter Config service data is defined, if yes, create Object with it
if
(
filterConfigService
!==
undefined
)
{
return
getFilterJSONfromConfigService
()
}
else
{
// Call getFilterJSONFromEnv to generate a JSON Object
return
getFilterJSONFromEnv
()
}
}
function
setFilterJSONFromEnv
()
{
function
getFilterJSONFromEnv
()
{
// Generate JSON and return
return
setFilterJSON
()
}
function
s
etFilterJSON
()
{
function
g
etFilterJSON
fromConfigService
()
{
// Generate JSON from Config Service and return
}
This diff is collapsed.
Click to expand it.
src/middlewares/filter.middleware.js
+
3
−
4
View file @
b12a9a57
...
...
@@ -3,15 +3,14 @@ var filterService = require('../service/filterService')
function
addMetaFilters
(
req
,
res
,
next
)
{
// If the request body has filter by metaFilter data, continue with the same filter, do not alter the values
// else call the getMetaSearchString() function to generate the search string for the meta filters
filterService
.
getMetaSearchString
(
function
()
{
// else call the getMetaSearchData() function to generate the JSON Object for the meta filters
filterService
.
getMetaSearchData
(
function
()
{
// Generate JSON and return
return
setFilterJSON
()
})
}
function
setFilterJSON
()
{
// Set the new filter Object for filter request body
}
module
.
exports
.
addMetaFilters
=
addMetaFilters
This diff is collapsed.
Click to expand it.
src/service/filterService.js
+
4
−
4
View file @
b12a9a57
...
...
@@ -6,9 +6,9 @@
*/
var
configUtil
=
require
(
'
sb-config-util
'
)
function
getMetaSearch
String
(
callback
)
{
var
search
String
=
configUtil
.
getConfig
(
'
META_FILTER_QUE
RY_STRING
'
)
callback
(
null
,
search
String
)
function
getMetaSearch
Data
(
callback
)
{
var
search
Data
=
configUtil
.
getConfig
(
'
META_FILTER_
RE
QUE
ST_JSON
'
)
callback
(
null
,
search
Data
)
}
module
.
exports
.
getMetaSearch
String
=
getMetaSearch
String
module
.
exports
.
getMetaSearch
Data
=
getMetaSearch
Data
This diff is collapsed.
Click to expand it.
src/test/appSpec.js
+
3
−
1
View file @
b12a9a57
...
...
@@ -53,7 +53,9 @@ describe('Check health api', function (done) {
it
(
'
test for blackList metafilter configured
'
,
function
()
{})
it
(
'
test for whitelist metafilter and blackList not configured
'
,
function
()
{})
it
(
'
test for whitelist metafilter and blackList is configured
'
,
function
()
{})
it
(
'
check if filter JSON is generated
'
,
function
()
{
})
it
(
'
Check if filterConfig service data is available
'
,
function
()
{})
it
(
'
If FilterConfig is null/undefined, generate filter Object from environment variables
'
,
function
()
{
})
it
(
'
Check if filter JSON is generated
'
,
function
()
{
})
})
// below method used to close server once all the specs are executed
...
...
This diff is collapsed.
Click to expand it.
src/test/channelFilterRouteSpec.js
+
0
−
4
View file @
b12a9a57
...
...
@@ -65,7 +65,3 @@ describe('Check for all route to be calling the AddChannelFilter', function () {
})
})
})
describe
(
'
Check for all route to be calling the AddMetaFilter
'
,
function
()
{
it
(
'
check for filter in config with route
'
,
function
()
{})
it
(
'
check for filter in config with value + route
'
,
function
()
{})
})
This diff is collapsed.
Click to expand it.
src/test/metaFilterRouteSpec.js
0 → 100644
+
4
−
0
View file @
b12a9a57
describe
(
'
Check for all required route to call the AddMetaFilter
'
,
function
()
{
it
(
'
check for filter in config with route
'
,
function
()
{})
it
(
'
check for filter in config with value + route
'
,
function
()
{})
})
This diff is collapsed.
Click to expand it.
src/test/middlewares/filterMiddlewareSpec.js
0 → 100644
+
9
−
0
View file @
b12a9a57
describe
(
'
Initialization of meta filters
'
,
function
()
{
it
(
'
check for the request and then do next
'
,
function
()
{})
it
(
'
check for no request and get config
'
,
function
()
{})
it
(
'
check for the filter object property exists in the request body
'
,
function
()
{})
it
(
'
if filter object property is equal to response body property then do not append property to the filter
'
,
function
()
{})
it
(
'
if the filter object property is not equal to response body property then append property to the filter
'
,
function
()
{})
it
(
'
check for getMetaSearchData method creates proper whitelisted search data
'
,
function
()
{})
it
(
'
check for getMetaSearchData method creates proper blacklisted search data
'
,
function
()
{})
})
This diff is collapsed.
Click to expand it.
src/test/middlewares/requestMiddlewareSpec.js
+
0
−
7
View file @
b12a9a57
...
...
@@ -51,10 +51,3 @@ describe('filter of channels', function () {
})
})
})
describe
(
'
Initialization of meta filters
'
,
function
()
{
it
(
'
check for the request and then do next
'
,
function
()
{})
it
(
'
check for no request and get config
'
,
function
()
{})
it
(
'
check for getMetaSearchString method creates proper whitelisted search string
'
,
function
()
{})
it
(
'
check for getMetaSearchString method creates proper blacklisted search string
'
,
function
()
{})
})
This diff is collapsed.
Click to expand it.
src/test/service/filterServiceSpec.js
+
2
−
2
View file @
b12a9a57
...
...
@@ -21,8 +21,8 @@ describe('filter service', function () {
})
})
describe
(
'
content meta filter service
'
,
function
()
{
it
(
'
check for getMetaSearch
String
method
'
,
function
()
{})
describe
(
'
content meta filter service
from config
'
,
function
()
{
it
(
'
check for getMetaSearch
Data
method
'
,
function
()
{})
it
(
'
check for whitelisted metafilter set in config
'
,
function
()
{})
it
(
'
check for blacklisted metafilter set in config
'
,
function
()
{})
})
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets