Skip to content

Commit b15520f

Browse files
committed
chore: add ability to log results
1 parent 5e4478c commit b15520f

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

backend/src/api/controllers/result.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import {
3232
replaceLegacyValues,
3333
} from "../../utils/result";
3434
import { Configuration } from "@monkeytype/contracts/schemas/configuration";
35-
import { addLog } from "../../dal/logs";
35+
import { addImportantLog, addLog } from "../../dal/logs";
3636
import {
3737
AddResultRequest,
3838
AddResultResponse,
@@ -214,6 +214,10 @@ export async function addResult(
214214
const completedEvent = req.body.result;
215215
completedEvent.uid = uid;
216216

217+
if (user.suspicious) {
218+
await addImportantLog("suspicious_user_result", completedEvent, uid);
219+
}
220+
217221
if (isTestTooShort(completedEvent)) {
218222
const status = MonkeyStatusCodes.TEST_TOO_SHORT;
219223
throw new MonkeyError(status.code, status.message);

backend/src/api/controllers/user.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,7 @@ type RelevantUserInfo = Omit<
507507
| "note"
508508
| "ips"
509509
| "testActivity"
510+
| "suspicious"
510511
>;
511512

512513
function getRelevantUserInfo(user: UserDAL.DBUser): RelevantUserInfo {
@@ -521,6 +522,7 @@ function getRelevantUserInfo(user: UserDAL.DBUser): RelevantUserInfo {
521522
"note",
522523
"ips",
523524
"testActivity",
525+
"suspicious",
524526
]) as RelevantUserInfo;
525527
}
526528

backend/src/dal/user.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ export type DBUser = Omit<
6262
canManageApeKeys?: boolean;
6363
bananas?: number;
6464
testActivity?: CountByYearAndDay;
65+
suspicious?: boolean;
6566
};
6667

6768
const SECONDS_PER_HOUR = 3600;

0 commit comments

Comments
 (0)