SpaceNinjaServer/src/controllers/api/missionInventoryUpdateController.ts
7f8ddd a931863249
Fix interface names, +genericUpdate (#51)
Co-authored-by: nk <nk@fbi.rocks>
Co-authored-by: Ordis <134585663+OrdisPrime@users.noreply.github.com>
2023-09-05 14:37:30 +02:00

62 lines
1.8 KiB
TypeScript

import { RequestHandler } from "express";
import { missionInventoryUpdate } from "@/src/services/inventoryService";
import { IMissionInventoryUpdate } from "@/src/types/missionInventoryUpdateType";
/*
- [ ] 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.)
- [ ] 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.)
- [ ] EndOfMatchUpload
- [ ] ObjectiveReached
- [ ] FpsAvg
- [ ] FpsMin
- [ ] FpsMax
- [ ] FpsSamples
*/
// 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");
try {
const parsedData = JSON.parse(data) as IMissionInventoryUpdate;
if (typeof parsedData !== "object") throw new Error("Invalid data format");
await missionInventoryUpdate(parsedData, id);
} catch (err) {
console.error("Error parsing JSON data:", err);
}
// TODO - Return the updated inventory the way the game does it.
res.json({});
};
export { missionInventoryUpdateController };