Skip to content
Snippets Groups Projects
Commit f471455c authored by MoSelim's avatar MoSelim
Browse files

use data-access to destroy connections

parent 48e086dc
No related branches found
No related tags found
2 merge requests!116Shared data model,!117Dev
const https = require('https')
const PrivacyNoticeManager = require('../xpub-model/entities/privacyNotice')
const PrivacyNotice = require('../xpub-model/entities/privacyNotice/data-access')
const privacyNoticeCheck = () => {
PrivacyNoticeManager.findLastVersion().then(privacyNotice => {
PrivacyNotice.selectLastVersion().then(privacyNotice => {
getLatestVersion().then(data => {
const privacyNotesData = data.nodes[0].node
if (privacyNotesData['version Count'] !== privacyNotice.version) {
......@@ -13,7 +13,11 @@ const privacyNoticeCheck = () => {
privacyNotesData.changed.split('-')[0].trim(),
),
}
PrivacyNoticeManager.save(latestPrivacyNotice)
PrivacyNotice.insert(latestPrivacyNotice).then(() =>
PrivacyNotice.knex().destroy(),
)
} else {
PrivacyNotice.knex().destroy()
}
})
})
......
......@@ -26,6 +26,7 @@ const PrivacyNoticeManager = {
return { ...privacyNotice, id }
},
findLastVersion: async () => PrivacyNotice.selectLastVersion(),
model: PrivacyNotice,
}
module.exports = PrivacyNoticeManager
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment