(uid: string)
| 69 | } |
| 70 | |
| 71 | export async function getLastResult(uid: string): Promise<DBResult> { |
| 72 | const lastResult = await getResultCollection().findOne( |
| 73 | { uid }, |
| 74 | { sort: { timestamp: -1 } }, |
| 75 | ); |
| 76 | |
| 77 | if (lastResult === null) throw new MonkeyError(404, "No last result found"); |
| 78 | return replaceLegacyValues(lastResult); |
| 79 | } |
| 80 | |
| 81 | export async function getLastResultTimestamp(uid: string): Promise<number> { |
| 82 | const lastResult = await getResultCollection().findOne( |
no test coverage detected