mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2026-03-01 18:14:23 +08:00
chore: add ability to log results
This commit is contained in:
parent
5e4478c97a
commit
b15520f0b3
3 changed files with 8 additions and 1 deletions
|
|
@ -32,7 +32,7 @@ import {
|
|||
replaceLegacyValues,
|
||||
} from "../../utils/result";
|
||||
import { Configuration } from "@monkeytype/contracts/schemas/configuration";
|
||||
import { addLog } from "../../dal/logs";
|
||||
import { addImportantLog, addLog } from "../../dal/logs";
|
||||
import {
|
||||
AddResultRequest,
|
||||
AddResultResponse,
|
||||
|
|
@ -214,6 +214,10 @@ export async function addResult(
|
|||
const completedEvent = req.body.result;
|
||||
completedEvent.uid = uid;
|
||||
|
||||
if (user.suspicious) {
|
||||
await addImportantLog("suspicious_user_result", completedEvent, uid);
|
||||
}
|
||||
|
||||
if (isTestTooShort(completedEvent)) {
|
||||
const status = MonkeyStatusCodes.TEST_TOO_SHORT;
|
||||
throw new MonkeyError(status.code, status.message);
|
||||
|
|
|
|||
|
|
@ -507,6 +507,7 @@ type RelevantUserInfo = Omit<
|
|||
| "note"
|
||||
| "ips"
|
||||
| "testActivity"
|
||||
| "suspicious"
|
||||
>;
|
||||
|
||||
function getRelevantUserInfo(user: UserDAL.DBUser): RelevantUserInfo {
|
||||
|
|
@ -521,6 +522,7 @@ function getRelevantUserInfo(user: UserDAL.DBUser): RelevantUserInfo {
|
|||
"note",
|
||||
"ips",
|
||||
"testActivity",
|
||||
"suspicious",
|
||||
]) as RelevantUserInfo;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ export type DBUser = Omit<
|
|||
canManageApeKeys?: boolean;
|
||||
bananas?: number;
|
||||
testActivity?: CountByYearAndDay;
|
||||
suspicious?: boolean;
|
||||
};
|
||||
|
||||
const SECONDS_PER_HOUR = 3600;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue