Updated tester

parent 213340cb
"use strict";
const mongoose = require('mongoose');
const logger = require('../libs/log');
const CustomTesterSchema = new mongoose.Schema({
name: {
......@@ -19,31 +18,18 @@ module.exports.schema = CustomTesterSchema;
const CustomTester = mongoose.connection.model('CustomTester', CustomTesterSchema);
module.exports.model = CustomTester;
module.exports.getCustomTesters = () => {
return CustomTester.find({})
.catch(err => {
logger.error(err);
});
module.exports.getAll = () => {
return CustomTester.find({});
};
module.exports.getTester = (testerId) => {
return CustomTester.findOne({_id: testerId})
.catch(err => {
logger.error(err);
});
module.exports.get = id => {
return CustomTester.findOne({_id: id});
};
module.exports.addTester = (name, fileId) => {
return (new CustomTester({name: name, sourceFile: fileId}))
.save()
.catch(err => {
logger.error(err);
});
module.exports.add = (name, sourceFile) => {
return (new CustomTester({name, sourceFile})).save();
};
module.exports.updateTester = (testerId, name, fileId) => {
return CustomTester.findOneAndUpdate({_id: testerId}, {name: name, sourceFile: fileId})
.catch(err => {
logger.error(err);
});
module.exports.update = (id, name, sourceFile) => {
return CustomTester.findOneAndUpdate({_id: id}, {name: name, sourceFile: sourceFile});
};
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment