mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: fix getDomainUser
This commit is contained in:
1 parent
0bed88ff99
commit
aa096322c3
2 files changed
+3
-3
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hydrooj",
|
"name": "hydrooj",
|
||||||
"version": "2.20.22",
|
"version": "2.20.23",
|
||||||
"bin": "bin/hydrooj.js",
|
"bin": "bin/hydrooj.js",
|
||||||
"main": "dist/loader.js",
|
"main": "dist/loader.js",
|
||||||
"typings": "dist/loader.d.ts",
|
"typings": "dist/loader.d.ts",
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ class DomainModel {
|
|||||||
const res = await coll.findOneAndUpdate(
|
const res = await coll.findOneAndUpdate(
|
||||||
{ _id: domainId },
|
{ _id: domainId },
|
||||||
// FIXME
|
// FIXME
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
{ $inc: { [field]: n } },
|
{ $inc: { [field]: n } },
|
||||||
{ returnOriginal: false },
|
{ returnOriginal: false },
|
||||||
);
|
);
|
||||||
@@ -182,7 +182,7 @@ class DomainModel {
|
|||||||
@ArgMethod
|
@ArgMethod
|
||||||
static async incUserInDomain(domainId: string, uid: number, field: string, n: number = 1) {
|
static async incUserInDomain(domainId: string, uid: number, field: string, n: number = 1) {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const dudoc = await getDomainUser(domainId, { _id: uid });
|
const dudoc = await DomainModel.getDomainUser(domainId, { _id: uid });
|
||||||
dudoc[field] = dudoc[field] + n || n;
|
dudoc[field] = dudoc[field] + n || n;
|
||||||
await DomainModel.setUserInDomain(domainId, uid, { [field]: dudoc[field] });
|
await DomainModel.setUserInDomain(domainId, uid, { [field]: dudoc[field] });
|
||||||
return dudoc;
|
return dudoc;
|
||||||
|
|||||||
Reference in new issue
Block a user