forked from OpenWF/SpaceNinjaServer
63 lines
1.6 KiB
TypeScript
63 lines
1.6 KiB
TypeScript
import { RequestHandler } from "express";
|
|
import { missionInventoryUpdate } from "@/src/services/inventoryService";
|
|
import { MissionInventoryUpdate } 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
|
|
- [ ] ActiveDojoColorResearch
|
|
- [ ] RewardInfo
|
|
- [ ] ReceivedCeremonyMsg
|
|
- [ ] LastCeremonyResetDate
|
|
- [ ] MissionPTS
|
|
- [ ] RepHash
|
|
- [ ] EndOfMatchUpload
|
|
- [ ] ObjectiveReached
|
|
- [ ] FpsAvg
|
|
- [ ] FpsMin
|
|
- [ ] FpsMax
|
|
- [ ] FpsSamples
|
|
*/
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
const missionInventoryUpdateController: RequestHandler = async (req, res) => {
|
|
const [data] = String(req.body).split("\n");
|
|
const id = req.query.accountId as string;
|
|
|
|
// TODO - salt check
|
|
|
|
try {
|
|
const parsedData = JSON.parse(data) as MissionInventoryUpdate;
|
|
if (typeof parsedData !== "object" || parsedData === null) throw new Error("Invalid data format");
|
|
await missionInventoryUpdate(parsedData, id);
|
|
} catch (err) {
|
|
console.error("Error parsing JSON data:", err);
|
|
}
|
|
|
|
// TODO - get original response
|
|
res.json({});
|
|
};
|
|
|
|
export { missionInventoryUpdateController };
|