From 11595ad786b92ccad283a54aaf10d18e485ecf51 Mon Sep 17 00:00:00 2001 From: AnthonyFuller <24512050+AnthonyFuller@users.noreply.github.com> Date: Thu, 15 Aug 2024 19:51:27 +0100 Subject: [PATCH] feat: implement GetMasteryCompletionDataForLocation Closes #509 --- components/menuData.ts | 2 ++ components/profileHandler.ts | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/components/menuData.ts b/components/menuData.ts index 076f482e5..dac3f063f 100644 --- a/components/menuData.ts +++ b/components/menuData.ts @@ -320,6 +320,8 @@ menuDataRouter.get( true, ) + // TODO: Enqueue events to unlock PRO1 + res.json({ template: getConfig("MissionRewardsTemplate", false), data: { diff --git a/components/profileHandler.ts b/components/profileHandler.ts index 39e252e34..07d61f3c2 100644 --- a/components/profileHandler.ts +++ b/components/profileHandler.ts @@ -64,6 +64,7 @@ import { ResolveGamerTagsBody, } from "./types/gameSchemas" import assert from "assert" +import { generateCompletionData } from "./contracts/dataGen" const profileRouter = Router() @@ -657,6 +658,23 @@ profileRouter.post( }, ) +profileRouter.post( + "/HubPagesService/GetMasteryCompletionDataForLocation", + jsonMiddleware(), + // @ts-expect-error Has jwt props. + (req: RequestWithJwt<{ locationId: string; difficulty: string }>, res) => { + res.json({ + CompletionData: generateCompletionData( + req.body.locationId, + req.jwt.unique_name, + req.gameVersion, + undefined, + req.body.difficulty, + ), + }) + }, +) + profileRouter.post( "/DefaultLoadoutService/Set", jsonMiddleware(),