明树Git Lab

Commit 33f8984c authored by zfp1's avatar zfp1

update

parent 0dc6afe3
......@@ -261,12 +261,12 @@ async function addMat(req, res, next) {
...req.body,
creator,
}
// if (req.body.name) {
// let check = await DB.AgrMat.findOne({ name: req.body.name });
// if (check) {
// return res.sendError(errorMessage.nameDuplicated);
// }
// }
if (req.body.name) {
let check = await DB.AgrMat.findOne({ name: req.body.name });
if (check) {
return res.sendError(errorMessage.nameDuplicated);
}
}
let ret = await DB.AgrMat.findOneAndUpdate({ name: info.name }, info, { upsert: true, returnOriginal: false });
res.sendData(ret);
} catch (error) {
......
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