SpaceNinjaServer/src/controllers/custom/popArchonCrystalUpgradeController.ts
Sainan dd0574dabc
All checks were successful
Build / build (push) Successful in 53s
Build / build (pull_request) Successful in 1m31s
fix(webui): respond with 200 for successful shard operations
2025-06-16 17:29:05 +02:00

19 lines
729 B
TypeScript

import { RequestHandler } from "express";
import { getAccountIdForRequest } from "@/src/services/loginService";
import { getInventory } from "@/src/services/inventoryService";
export const popArchonCrystalUpgradeController: RequestHandler = async (req, res) => {
const accountId = await getAccountIdForRequest(req);
const inventory = await getInventory(accountId);
const suit = inventory.Suits.id(req.query.oid as string);
if (suit && suit.ArchonCrystalUpgrades) {
suit.ArchonCrystalUpgrades = suit.ArchonCrystalUpgrades.filter(
x => x.UpgradeType != (req.query.type as string)
);
await inventory.save();
res.end();
return;
}
res.status(400).end();
};