2017-04-07 01:29:05 +02:00
|
|
|
'use strict';
|
2018-04-12 18:40:58 +02:00
|
|
|
const db = require('../models/db');
|
|
|
|
const Sequelize = require('sequelize');
|
|
|
|
const Op = Sequelize.Op;
|
2017-04-07 01:29:05 +02:00
|
|
|
|
|
|
|
var config = require('config');
|
|
|
|
|
|
|
|
module.exports = (req, res, next) => {
|
|
|
|
var artifactId = req.params.artifact_id;
|
2018-04-12 18:40:58 +02:00
|
|
|
db.Artifact.findOne({where: {
|
2017-04-07 01:29:05 +02:00
|
|
|
"_id": artifactId
|
2018-04-12 18:40:58 +02:00
|
|
|
}}).then(artifact => {
|
|
|
|
if (artifact) {
|
|
|
|
req['artifact'] = artifact;
|
|
|
|
next();
|
2017-04-07 01:29:05 +02:00
|
|
|
} else {
|
2018-04-12 18:40:58 +02:00
|
|
|
res.sendStatus(404);
|
2017-04-07 01:29:05 +02:00
|
|
|
}
|
|
|
|
});
|
2018-04-12 18:40:58 +02:00
|
|
|
};
|