mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
优化csrf_token检查
This commit is contained in:
1 parent
fb5c29226b
commit
c9b6412527
10 files changed
+77
-185
No files matched your search
@@ -73,13 +73,13 @@ function getMulti(domainId, query) {
|
||||
|
||||
async function update(domainId, rid, $set, $push, $unset) {
|
||||
const _id = new ObjectID(rid);
|
||||
const upd = {};
|
||||
if ($set && Object.keys($set).length) upd.$set = $set;
|
||||
if ($push && Object.keys($push).length) upd.$push = $push;
|
||||
if ($unset && Object.keys($unset).length) upd.$unset = $unset;
|
||||
const rdoc = await coll.findOneAndUpdate({ domainId, _id }, upd, { returnOriginal: false });
|
||||
if (!rdoc) throw new RecordNotFoundError(rid);
|
||||
return rdoc;
|
||||
const $update = {};
|
||||
if ($set && Object.keys($set).length) $update.$set = $set;
|
||||
if ($push && Object.keys($push).length) $update.$push = $push;
|
||||
if ($unset && Object.keys($unset).length) $update.$unset = $unset;
|
||||
const res = await coll.findOneAndUpdate({ domainId, _id }, $update, { returnOriginal: false });
|
||||
if (!res.value) throw new RecordNotFoundError(rid);
|
||||
return res.value;
|
||||
}
|
||||
|
||||
function reset(domainId, rid) {
|
||||
|
||||
Reference in new issue
Block a user