feat: changing equipped shawzin/instrument

This commit is contained in:
Sainan 2025-01-11 08:09:48 +01:00
parent fb8e19403e
commit f9bc1eb22f
3 changed files with 20 additions and 1 deletions

View File

@ -0,0 +1,17 @@
import { RequestHandler } from "express";
import { getAccountIdForRequest } from "@/src/services/loginService";
import { getInventory } from "@/src/services/inventoryService";
import { getJSONfromString } from "@/src/helpers/stringHelpers";
export const setEquippedInstrumentController: RequestHandler = async (req, res) => {
const accountId = await getAccountIdForRequest(req);
const inventory = await getInventory(accountId);
const body = getJSONfromString(String(req.body)) as ISetEquippedInstrumentRequest;
inventory.EquippedInstrument = body.Instrument;
await inventory.save();
res.end();
};
interface ISetEquippedInstrumentRequest {
Instrument: string;
}

View File

@ -56,6 +56,7 @@ import { sellController } from "@/src/controllers/api/sellController";
import { setActiveQuestController } from "@/src/controllers/api/setActiveQuestController";
import { setActiveShipController } from "@/src/controllers/api/setActiveShipController";
import { setBootLocationController } from "@/src/controllers/api/setBootLocationController";
import { setEquippedInstrumentController } from "@/src/controllers/api/setEquippedInstrumentController";
import { setPlacedDecoInfoController } from "@/src/controllers/api/setPlacedDecoInfoController";
import { setShipCustomizationsController } from "@/src/controllers/api/setShipCustomizationsController";
import { setShipFavouriteLoadoutController } from "@/src/controllers/api/setShipFavouriteLoadoutController";
@ -141,6 +142,7 @@ apiRouter.post("/purchase.php", purchaseController);
apiRouter.post("/rerollRandomMod.php", rerollRandomModController);
apiRouter.post("/saveLoadout.php", saveLoadoutController);
apiRouter.post("/sell.php", sellController);
apiRouter.post("/setEquippedInstrument.php", setEquippedInstrumentController);
apiRouter.post("/setPlacedDecoInfo.php", setPlacedDecoInfoController);
apiRouter.post("/setShipCustomizations.php", setShipCustomizationsController);
apiRouter.post("/setShipFavouriteLoadout.php", setShipFavouriteLoadoutController);

View File

@ -250,7 +250,7 @@ export interface IInventoryResponse {
CompletedJobChains: ICompletedJobChain[];
SeasonChallengeHistory: ISeasonChallenge[];
MoaPets: IEquipmentDatabase[];
EquippedInstrument: string;
EquippedInstrument?: string;
InvasionChainProgress: IInvasionChainProgress[];
DataKnives: IEquipmentDatabase[];
Motorcycles: IEquipmentDatabase[];