Skip to content
Snippets Groups Projects
Commit 69b88067 authored by Vytor Calixto's avatar Vytor Calixto :space_invader:
Browse files

Duplicate download for users if one already exists

parent 03798812
No related branches found
No related tags found
1 merge request!116Release v1.0.0
Pipeline #
......@@ -44,6 +44,17 @@ module.exports = function download(table, mappingTable) {
Download.findOne({query: req.sql.toString()}, (err, download) => {
if(download) {
download.updatedAt = Date.now();
if(download.userId != req.user._id) {
let dl = new Download({
userId: req.user._id,
table,
mappingTable,
query: req.sql.toString()
});
dl.save((err) => {
if(err) log.error(err);
});
}
} else {
download = new Download({
userId: req.user._id,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment