MCPcopy Create free account
hub / github.com/monkeytypegame/monkeytype / addResult

Function addResult

backend/src/dal/result.ts:17–30  ·  view source on GitHub ↗
(
  uid: string,
  result: DBResult,
)

Source from the content-addressed store, hash-verified

15 db.collection<DBResult>("results");
16
17export async function addResult(
18 uid: string,
19 result: DBResult,
20): Promise<{ insertedId: ObjectId }> {
21 const { data: user } = await tryCatch(getUser(uid, "add result"));
22
23 if (!user) throw new MonkeyError(404, "User not found", "add result");
24 result.uid ??= uid;
25 // result.ir = true;
26 const res = await getResultCollection().insertOne(result);
27 return {
28 insertedId: res.insertedId,
29 };
30}
31
32export async function deleteAll(uid: string): Promise<DeleteResult> {
33 return await getResultCollection().deleteMany({ uid });

Callers

nothing calls this directly

Calls 3

tryCatchFunction · 0.90
getUserFunction · 0.90
getResultCollectionFunction · 0.85

Tested by

no test coverage detected