inventory projection for addModularEquipment
All checks were successful
Build / build (22) (pull_request) Successful in 39s
Build / build (20) (pull_request) Successful in 1m16s
Build / build (18) (pull_request) Successful in 1m31s

This commit is contained in:
AMelonInsideLemon 2025-03-29 20:07:16 +01:00
parent 9ea061fdb3
commit 62dd3c04b3

View File

@ -6,10 +6,11 @@ import { modularWeaponTypes } from "@/src/helpers/modularWeaponHelper";
export const addModularEquipmentController: RequestHandler = async (req, res) => {
const accountId = await getAccountIdForRequest(req);
const request = req.body as IAddModularEquipmentRequest;
const inventory = await getInventory(accountId);
const category = modularWeaponTypes[request.ItemType];
const inventoryBin = productCategoryToInventoryBin(category)!;
const inventory = await getInventory(accountId, `${category} ${inventoryBin}`);
addEquipment(inventory, category, request.ItemType, request.ModularParts);
occupySlot(inventory, productCategoryToInventoryBin(category)!, true);
occupySlot(inventory, inventoryBin, true);
await inventory.save();
res.end();
};