JS003-expandMongo

This commit is contained in:
Martin Donnelly 2020-09-10 19:42:17 +01:00
parent 1513ea5010
commit 2872f92d67
11 changed files with 123 additions and 17 deletions

File diff suppressed because one or more lines are too long

View File

@ -5,7 +5,10 @@ const wordsAdditional = require('../lib/wordlistAdditional.json');
const bigList = new Map([]);
const goodWords = ['tsql', 'developer', 'contract', 'web', 'javascript', 'js', 'node', 'es', 'agile', 'nodejs', 'london', 'aws', 'sql', 'postgresql', 'mysql', 'docker', 'ecs', 'automation', 'jslint', 'jshint', 'vuejs', 'vue', 'nginx', 'remotely', 'mvc', 'remote', 'iot', 'mqtt'];
const goodWords = ['tsql', 'developer', 'contract', 'web', 'javascript', 'js', 'node', 'es',
'agile', 'nodejs', 'london', 'aws', 'sql', 'postgresql', 'mysql', 'docker', 'ecs',
'automation', 'jslint', 'jshint', 'vuejs', 'vue', 'nginx', 'remotely', 'mvc', 'remote',
'iot', 'mqtt'];
const badWords = ['react', 'redux', 'graphql', 'java', 'reactjs', 'shopify'];
let unrated = [];
@ -63,7 +66,7 @@ Corpus.process = function(intext) {
return ((badWords.indexOf(v) === -1) && (goodWords.indexOf(v) === -1));
});
cleanedArray.map((item)=> {
cleanedArray.map((item) => {
incItem(item);
});
@ -82,8 +85,6 @@ Corpus.exportUnused = function() {
console.log([...bigList]);
};
if (typeof module !== 'undefined')
module.exports = {
'Corpus': Corpus

View File

@ -22,7 +22,7 @@ const mongoConnect = process.env.MONGOCONNECT;
// logger.debug(`mongodb://martin:1V3D4m526i@${ process.env.DBHOST }/${ process.env.DBNAME}`);
// mongoose.connect(`mongodb://martin:1V3D4m526i@127.0.0.1/jobs`);
// mongoose.connect('mongodb://martin:1V3D4m526i@127.0.0.1/jobs');
logger.debug(mongoConnect);

View File

@ -0,0 +1,81 @@
/**
* Created by WebStorm.
* User: martin
* Date: 10/09/2020
* Time: 16:07
*/
const Jobs = require('../../lib/mongoManager');
const { Utils } = require('@rakh/utils');
exports.markApplied = (req, res) => {
console.log('>V2 markApplied req', req.params);
if(!req.params.id)
return res.status(500).send({
'message': 'Job id missing'
});
const aid = req.params.id;
const now = new Date().getTime();
// touchOne
console.log('aid', aid);
Jobs.updateMany({ '_id':aid }, { '$set': { 'data.applied':now } } ).then((data) => {
console.log(data);
res.status(200).end();
}).catch((err) => {
console.error(err.message);
res.status(500).send({
'message': err.message || 'Some error occurred while querying the database.'
});
});
/*
dbmanager.appliedOne({ aid, a })
.then((data) => {
console.log(data);
res.status(200).end();
})
.catch((err) => {
res.status(500).send({
'message': err.message || 'Some error occurred while querying the database.'
});
});
*/
};
exports.markAllRead = (req, res) => {
console.log('>V2 markAllRead req', req.params);
const now = new Date().getTime();
Jobs.updateMany({ 'data.read':0 }, { '$set': { 'data.read':now } } ).then((data) => {
console.log(data);
res.status(200).end();
}).catch((err) => {
console.error(err.message);
res.status(500).send({
'message': err.message || 'Some error occurred while querying the database.'
});
});
/*
dbmanager.markAllRead()
.then((data) => {
console.log(data);
res.status(200).end();
})
.catch((err) => {
res.status(500).send({
'message': err.message || 'Some error occurred while querying the database.'
});
});
*/
};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,24 @@
/**
* Created by WebStorm.
* User: martin
* Date: 10/09/2020
* Time: 16:06
*/
/**
* Created by WebStorm.
* User: martin
* Date: 25/05/2020
* Time: 13:36
*/
const apply = require('../controllers/apply.v2.controller');
module.exports = (app) => {
app.route('/v2/apply/:id')
.put(apply.markApplied);
app.route('/v2/readall')
.put(apply.markAllRead);
};

View File

@ -59,7 +59,7 @@ app.post('/auth', auth.auth);
require('./routes/jobs.route')(app);
require('./routes/jobs.v2.route')(app);
require('./routes/apply.route')(app);
require('./routes/apply.v2.route')(app);
require('./routes/vote.route')(app);
app.listen(serverPort, () => {

File diff suppressed because one or more lines are too long