Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
X
xpub-epmc
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package Registry
Container Registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Literature-services
public-projects
xpub-epmc
Commits
fc5b0d9e
Commit
fc5b0d9e
authored
6 years ago
by
MoSelim
Browse files
Options
Downloads
Patches
Plain Diff
daily job to check privacy notice (works on node cron only)
parent
2c3d32b7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!114
Shared data model
,
!115
Dev
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
crontab
+3
-1
3 additions, 1 deletion
crontab
server/cron/jobs.js
+5
-0
5 additions, 0 deletions
server/cron/jobs.js
server/privacyNotice/privacyNoticeCheck.js
+50
-0
50 additions, 0 deletions
server/privacyNotice/privacyNoticeCheck.js
with
58 additions
and
1 deletion
crontab
+
3
−
1
View file @
fc5b0d9e
...
...
@@ -11,6 +11,9 @@
# fromNcbi
*/30 * * * * node server/ncbi-integration/fromNcbi
# privacy notice check
30 2 * * * node server/privacyNotice/privacyNoticeCheck
# check for published manuscripts
*/30 * * * * node server/ncbi-integration/publishedCheck
...
...
@@ -22,4 +25,3 @@
# always leave an empty line at the end of the file
This diff is collapsed.
Click to expand it.
server/cron/jobs.js
+
5
−
0
View file @
fc5b0d9e
...
...
@@ -2,6 +2,8 @@
// const toNcbi = require('../ncbi-integration/toNcbi')
// const fromNcbi = require('../ncbi-integration/fromNcbi')
// const privacyNoticeCheck = require('../privacyNotice/privacyNoticeCheck')
module
.
exports
=
jobs
=>
{
// cron.schedule('*/1 * * * *', () => {
// toNcbi()
...
...
@@ -9,4 +11,7 @@ module.exports = jobs => {
// cron.schedule('*/1 * * * *', () => {
// fromNcbi()
// })
// cron.schedule('*/1 * * * *', () => {
// privacyNoticeCheck()
// })
}
This diff is collapsed.
Click to expand it.
server/privacyNotice/privacyNoticeCheck.js
0 → 100644
+
50
−
0
View file @
fc5b0d9e
const
https
=
require
(
'
https
'
)
const
PrivacyNoticeManager
=
require
(
'
../xpub-model/entities/privacyNotice
'
)
const
privacyNoticeCheck
=
()
=>
{
PrivacyNoticeManager
.
findLastVersion
().
then
(
privacyNotice
=>
{
getLatestVersion
().
then
(
data
=>
{
const
privacyNotesData
=
data
.
nodes
[
0
].
node
if
(
privacyNotesData
[
'
version Count
'
]
!==
privacyNotice
.
version
)
{
const
latestPrivacyNotice
=
{
version
:
privacyNotesData
[
'
version Count
'
],
effectiveDate
:
new
Date
(
privacyNotesData
.
changed
.
split
(
'
-
'
)[
0
].
trim
(),
),
}
PrivacyNoticeManager
.
save
(
latestPrivacyNotice
)
}
})
})
}
function
getLatestVersion
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
https
.
get
(
'
https://www.ebi.ac.uk/data-protection/privacy-notice/json/5d182831-5e99-4072-816b-380cda5f58df
'
,
res
=>
{
res
.
setEncoding
(
'
utf8
'
)
let
data
=
''
res
.
on
(
'
data
'
,
chunk
=>
{
data
+=
chunk
})
res
.
on
(
'
end
'
,
()
=>
{
resolve
(
JSON
.
parse
(
data
))
res
=
null
})
},
)
.
on
(
'
error
'
,
err
=>
{
// Handle errors
reject
(
err
)
})
})
}
;(()
=>
{
privacyNoticeCheck
()
})()
module
.
export
=
privacyNoticeCheck
This diff is collapsed.
Click to expand it.
Preview
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