SpaceNinjaServer/src/controllers/api/missionInventoryUpdateController.ts

62 lines
1.8 KiB
TypeScript
Raw Normal View History

2023-06-01 17:08:05 -07:00
import { RequestHandler } from "express";
2023-08-31 14:29:09 +04:00
import { missionInventoryUpdate } from "@/src/services/inventoryService";
import { IMissionInventoryUpdate } from "@/src/types/missionInventoryUpdateType";
2023-08-31 14:29:09 +04:00
/*
- [ ] crossPlaySetting
- [ ] rewardsMultiplier
- [ ] ActiveBoosters
- [x] LongGuns
- [x] Pistols
- [x] Suits
- [x] Melee
- [x] RawUpgrades
- [x] MiscItems
- [x] RegularCredits
- [ ] RandomUpgradesIdentified
- [ ] MissionFailed
- [ ] MissionStatus
- [ ] CurrentLoadOutIds
- [ ] AliveTime
- [ ] MissionTime
- [ ] Missions
- [ ] CompletedAlerts
- [ ] LastRegionPlayed
- [ ] GameModeId
- [ ] hosts
- [x] ChallengeProgress
- [ ] SeasonChallengeHistory
- [ ] PS (Passive anti-cheat data which includes your username, module list, process list, and system name.)
2023-08-31 14:29:09 +04:00
- [ ] ActiveDojoColorResearch
- [ ] RewardInfo
- [ ] ReceivedCeremonyMsg
- [ ] LastCeremonyResetDate
- [ ] MissionPTS (Used to validate the mission/alive time above.)
- [ ] RepHash (A hash from the replication manager/RepMgr Unknown what it does.)
2023-08-31 14:29:09 +04:00
- [ ] EndOfMatchUpload
- [ ] ObjectiveReached
- [ ] FpsAvg
- [ ] FpsMin
- [ ] FpsMax
- [ ] FpsSamples
*/
2023-06-01 17:08:05 -07:00
2023-08-31 14:29:09 +04:00
// eslint-disable-next-line @typescript-eslint/no-misused-promises
const missionInventoryUpdateController: RequestHandler = async (req, res) => {
const id = req.query.accountId as string;
const [data] = String(req.body).split("\n");
2023-08-31 14:29:09 +04:00
try {
const parsedData = JSON.parse(data) as IMissionInventoryUpdate;
if (typeof parsedData !== "object") throw new Error("Invalid data format");
2023-08-31 14:29:09 +04:00
await missionInventoryUpdate(parsedData, id);
} catch (err) {
console.error("Error parsing JSON data:", err);
}
// TODO - Return the updated inventory the way the game does it.
2023-06-01 17:08:05 -07:00
res.json({});
};
export { missionInventoryUpdateController };