mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
修复在线IDE
This commit is contained in:
1 parent
b1153b641a
commit
61cba6f180
12 files changed
+94
-76
No files matched your search
@@ -1,4 +1,5 @@
|
||||
const db = require('../service/db.js');
|
||||
const { ValidationError } = require('../error');
|
||||
|
||||
const coll = db.collection('token');
|
||||
|
||||
@@ -33,8 +34,10 @@ module.exports = {
|
||||
* @param {number} tokenType type of the token.
|
||||
* @returns {object} The token document, or null.
|
||||
*/
|
||||
get(tokenId, tokenType) {
|
||||
return coll.findOne({ _id: tokenId, tokenType });
|
||||
async get(tokenId, tokenType) {
|
||||
const res = await coll.findOne({ _id: tokenId, tokenType });
|
||||
if (!res) throw new ValidationError('token');
|
||||
return res;
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user