core: fix getDomainUser

This commit is contained in:
undefined committed 2021-03-16 22:28:07 +08:00
1 parent 0bed88ff99
commit aa096322c3
2 files changed
+3 -3

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "hydrooj",
"version": "2.20.22",
"version": "2.20.23",
"bin": "bin/hydrooj.js",
"main": "dist/loader.js",
"typings": "dist/loader.d.ts",
+2 -2
View File
@@ -89,7 +89,7 @@ class DomainModel {
const res = await coll.findOneAndUpdate(
{ _id: domainId },
// FIXME
// @ts-ignore
// @ts-expect-error
{ $inc: { [field]: n } },
{ returnOriginal: false },
);
@@ -182,7 +182,7 @@ class DomainModel {
@ArgMethod
static async incUserInDomain(domainId: string, uid: number, field: string, n: number = 1) {
// @ts-ignore
const dudoc = await getDomainUser(domainId, { _id: uid });
const dudoc = await DomainModel.getDomainUser(domainId, { _id: uid });
dudoc[field] = dudoc[field] + n || n;
await DomainModel.setUserInDomain(domainId, uid, { [field]: dudoc[field] });
return dudoc;