Skip to content
Snippets Groups Projects
Commit 19f5edef authored by Yogmatee Roochun's avatar Yogmatee Roochun
Browse files

email taggers - ongoing

parent 143c4dd5
No related branches found
No related tags found
2 merge requests!93Shared data model,!94Dev
...@@ -7,12 +7,18 @@ const db = require('../utils/db.js') ...@@ -7,12 +7,18 @@ const db = require('../utils/db.js')
const { execSync } = require('child_process') const { execSync } = require('child_process')
const uuidv4 = require('uuid/v4') const uuidv4 = require('uuid/v4')
const config = require('config') const config = require('config')
const manuscriptModel = require('../xpub-model/entities/manuscript/data-access')
const ftpTagger = config.get('ftp_tagger') const ftpTagger = config.get('ftp_tagger')
const { taggerEmail } = require('../email')
const parentRootPath = '/home/yogmatee/projects/PLAY/chokidar/ftp_mock'
/*
const parentRootPath = `${process.env.HOME}/${config.get('ftp_directory')}/${ const parentRootPath = `${process.env.HOME}/${config.get('ftp_directory')}/${
ftpTagger.username ftpTagger.username
}` }`
*/
const rootPath = `${parentRootPath}/Done` const rootPath = `${parentRootPath}/Done`
...@@ -90,6 +96,16 @@ async function processFile(path) { ...@@ -90,6 +96,16 @@ async function processFile(path) {
await files.renameFile(path) await files.renameFile(path)
logger.info('Uploading to Minio and the database has been completed.') logger.info('Uploading to Minio and the database has been completed.')
const manuscriptObj = await manuscriptModel.getManuscriptById(manuscriptId)
// send email to taggers
/* taggerEmail(
'yroochun@ebi.ac.uk', //ftpTagger.email,
manuscriptId,
manuscriptObj[0]['meta,title'],
`${path} has been processed.`,
)*/
} catch (err) { } catch (err) {
logger.error('Error', err.message) logger.error('Error', err.message)
} }
......
...@@ -383,6 +383,11 @@ class Manuscript extends EpmcBaseModel { ...@@ -383,6 +383,11 @@ class Manuscript extends EpmcBaseModel {
return manuscripts && manuscripts.length > 0 ? manuscripts[0] : null return manuscripts && manuscripts.length > 0 ? manuscripts[0] : null
} }
static async getManuscriptById(id) {
const manuscript = Manuscript.query().where('manuscript.id', id)
return manuscript
}
static async selectByPdfDepositStatesNull() { static async selectByPdfDepositStatesNull() {
const manuscripts = Manuscript.query() const manuscripts = Manuscript.query()
.whereNull('pdf_deposit_state') .whereNull('pdf_deposit_state')
......
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