2018-04-29 21:17:23 +02:00
|
|
|
const db = require('../../../models');
|
2018-04-27 19:24:40 +02:00
|
|
|
|
|
|
|
const NO_FILE = 'NO_FILE';
|
|
|
|
|
|
|
|
const getLocalFileRecord = (claimId, name) => {
|
|
|
|
return db.File.findOne({where: {claimId, name}})
|
|
|
|
.then(file => {
|
|
|
|
if (!file) {
|
|
|
|
return NO_FILE;
|
|
|
|
}
|
|
|
|
return file.dataValues;
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = getLocalFileRecord;
|