Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions backend/src/api/controllers/result.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import {
GetResultsResponse,
UpdateResultTagsRequest,
UpdateResultTagsResponse,
ReportCompletedEventMismatchRequest,
} from "@monkeytype/contracts/results";
import {
CompletedEvent,
Expand Down Expand Up @@ -184,6 +185,24 @@ export async function updateTags(
});
}

export async function reportCompletedEventMismatch(
req: MonkeyRequest<undefined, ReportCompletedEventMismatchRequest>,
): Promise<MonkeyResponse> {
const { uid } = req.ctx.decodedToken;
const { notMatching, mode, mode2, difficulty, duration } = req.body;
// Logger.warning(
// `Completed event mismatch for uid ${uid}: ${notMatching.join(", ")}`,
// );
// Logger.warning(`Old CE: ${JSON.stringify(ce)}`);
// Logger.warning(`New CE: ${JSON.stringify(ce2)}`);
void addLog(
"completed_event_mismatch",
{ notMatching, mode, mode2, difficulty, duration },
uid,
);
return new MonkeyResponse("Mismatch reported", null);
}

export async function addResult(
req: MonkeyRequest<undefined, AddResultRequest>,
): Promise<AddResultResponse> {
Expand Down
4 changes: 4 additions & 0 deletions backend/src/api/routes/results.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ export default s.router(resultsContract, {
updateTags: {
handler: async (r) => callController(ResultController.updateTags)(r),
},
reportCompletedEventMismatch: {
handler: async (r) =>
callController(ResultController.reportCompletedEventMismatch)(r),
},
deleteAll: {
handler: async (r) => callController(ResultController.deleteAll)(r),
},
Expand Down
Loading
Loading