SpaceNinjaServer/src/controllers/custom/popArchonCrystalUpgradeController.ts
Sainan 8c1147998d
All checks were successful
Build / build (push) Successful in 45s
Build Docker image / docker (push) Successful in 15s
fix(webui): respond with 200 for successful shard operations (#2175)
Reviewed-on: #2175
Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com>
Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
2025-06-16 14:55:56 -07: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();
};