mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-11-08 05:03:39 +08:00
Remove uid from last result (#2998)
This commit is contained in:
parent
d7862750ce
commit
294ff4c95a
1 changed files with 5 additions and 2 deletions
|
|
@ -1,3 +1,4 @@
|
|||
import _ from "lodash";
|
||||
import { DeleteResult, ObjectId, UpdateResult } from "mongodb";
|
||||
import MonkeyError from "../utils/error";
|
||||
import * as db from "../init/db";
|
||||
|
|
@ -65,7 +66,9 @@ export async function getResult(
|
|||
return result;
|
||||
}
|
||||
|
||||
export async function getLastResult(uid: string): Promise<MonkeyTypesResult> {
|
||||
export async function getLastResult(
|
||||
uid: string
|
||||
): Promise<Partial<MonkeyTypesResult>> {
|
||||
const [lastResult] = await db
|
||||
.collection<MonkeyTypesResult>("results")
|
||||
.find({ uid })
|
||||
|
|
@ -73,7 +76,7 @@ export async function getLastResult(uid: string): Promise<MonkeyTypesResult> {
|
|||
.limit(1)
|
||||
.toArray();
|
||||
if (!lastResult) throw new MonkeyError(404, "No results found");
|
||||
return lastResult;
|
||||
return _.omit(lastResult, "uid");
|
||||
}
|
||||
|
||||
export async function getResultByTimestamp(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue