JS003-expandMongo
This commit is contained in:
parent
1513ea5010
commit
2872f92d67
File diff suppressed because one or more lines are too long
@ -5,7 +5,10 @@ const wordsAdditional = require('../lib/wordlistAdditional.json');
|
|||||||
|
|
||||||
const bigList = new Map([]);
|
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'];
|
const badWords = ['react', 'redux', 'graphql', 'java', 'reactjs', 'shopify'];
|
||||||
let unrated = [];
|
let unrated = [];
|
||||||
|
|
||||||
@ -63,7 +66,7 @@ Corpus.process = function(intext) {
|
|||||||
return ((badWords.indexOf(v) === -1) && (goodWords.indexOf(v) === -1));
|
return ((badWords.indexOf(v) === -1) && (goodWords.indexOf(v) === -1));
|
||||||
});
|
});
|
||||||
|
|
||||||
cleanedArray.map((item)=> {
|
cleanedArray.map((item) => {
|
||||||
incItem(item);
|
incItem(item);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -82,8 +85,6 @@ Corpus.exportUnused = function() {
|
|||||||
console.log([...bigList]);
|
console.log([...bigList]);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (typeof module !== 'undefined')
|
if (typeof module !== 'undefined')
|
||||||
module.exports = {
|
module.exports = {
|
||||||
'Corpus': Corpus
|
'Corpus': Corpus
|
||||||
|
@ -22,7 +22,7 @@ const mongoConnect = process.env.MONGOCONNECT;
|
|||||||
|
|
||||||
// logger.debug(`mongodb://martin:1V3D4m526i@${ process.env.DBHOST }/${ process.env.DBNAME}`);
|
// 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);
|
logger.debug(mongoConnect);
|
||||||
|
|
||||||
|
81
server/controllers/apply.v2.controller.js
Normal file
81
server/controllers/apply.v2.controller.js
Normal 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.'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
*/
|
||||||
|
};
|
6
server/dist/build/bundle.css
vendored
6
server/dist/build/bundle.css
vendored
File diff suppressed because one or more lines are too long
8
server/dist/build/bundle.css.map
vendored
8
server/dist/build/bundle.css.map
vendored
File diff suppressed because one or more lines are too long
2
server/dist/build/bundle.js
vendored
2
server/dist/build/bundle.js
vendored
File diff suppressed because one or more lines are too long
2
server/dist/build/bundle.js.map
vendored
2
server/dist/build/bundle.js.map
vendored
File diff suppressed because one or more lines are too long
24
server/routes/apply.v2.route.js
Normal file
24
server/routes/apply.v2.route.js
Normal 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);
|
||||||
|
};
|
@ -59,7 +59,7 @@ app.post('/auth', auth.auth);
|
|||||||
|
|
||||||
require('./routes/jobs.route')(app);
|
require('./routes/jobs.route')(app);
|
||||||
require('./routes/jobs.v2.route')(app);
|
require('./routes/jobs.v2.route')(app);
|
||||||
require('./routes/apply.route')(app);
|
require('./routes/apply.v2.route')(app);
|
||||||
require('./routes/vote.route')(app);
|
require('./routes/vote.route')(app);
|
||||||
|
|
||||||
app.listen(serverPort, () => {
|
app.listen(serverPort, () => {
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user