MCPcopy Create free account
hub / github.com/hydro-dev/Hydro / inc

Method inc

packages/hydrooj/src/model/user.ts:310–318  ·  view source on GitHub ↗
(_id: number | number[], field: string, n: number = 1)

Source from the content-addressed store, hash-verified

308
309 @ArgMethod
310 static async inc(_id: number | number[], field: string, n: number = 1) {
311 const ids = (Array.isArray(_id) ? Array.from(new Set(_id)) : [_id]).filter((i) => i >= -999);
312 if (!ids.length) return null;
313 const udocs = await coll.find({ _id: { $in: ids } }).toArray();
314 if (udocs.length !== ids.length) throw new UserNotFoundError(_id);
315 await coll.updateMany({ _id: { $in: ids } }, { $inc: { [field]: n } });
316 for (const udoc of udocs) deleteUserCache(udoc);
317 return udocs;
318 }
319
320 @ArgMethod
321 static async create(

Callers 11

limitRateFunction · 0.45
enrollFunction · 0.45
incFunction · 0.45
delReplyFunction · 0.45
reactFunction · 0.45
sendMethod · 0.45
attendFunction · 0.45
voteMethod · 0.45
getMethod · 0.45
postMethod · 0.45
postJudgeMethod · 0.45

Calls 2

deleteUserCacheFunction · 0.85
findMethod · 0.80

Tested by

no test coverage detected