SpaceNinjaServer/src/controllers/custom/popArchonCrystalUpgradeController.ts
Sainan c97c22b434 chore: use relative imports with .ts (#2694)
Reviewed-on: OpenWF/SpaceNinjaServer#2694
Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com>
Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
2025-08-25 13:37:14 -07:00

19 lines
740 B
TypeScript

import type { RequestHandler } from "express";
import { getAccountIdForRequest } from "../../services/loginService.ts";
import { getInventory } from "../../services/inventoryService.ts";
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();
};