SpaceNinjaServer/src/controllers/custom/removeCustomizationController.ts
AMelonInsideLemon 463ed2db45
Some checks failed
Build / build (pull_request) Failing after 1m4s
feat(webui): flavour Items
Re #2361
2025-09-14 16:39:57 +02:00

15 lines
648 B
TypeScript

import { getAccountIdForRequest } from "../../services/loginService.ts";
import { getInventory } from "../../services/inventoryService.ts";
import type { RequestHandler } from "express";
import { broadcastInventoryUpdate } from "../../services/wsService.ts";
export const removeCustomizationController: RequestHandler = async (req, res) => {
const accountId = await getAccountIdForRequest(req);
const ItemType = req.query.itemType as string;
const inventory = await getInventory(accountId, "FlavourItems");
inventory.FlavourItems.pull({ ItemType });
await inventory.save();
res.end();
broadcastInventoryUpdate(req);
};