Re #2361 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Reviewed-on: #2779 Reviewed-by: Sainan <63328889+sainan@users.noreply.github.com> Co-authored-by: AMelonInsideLemon <166175391+AMelonInsideLemon@users.noreply.github.com> Co-committed-by: AMelonInsideLemon <166175391+AMelonInsideLemon@users.noreply.github.com>
		
			
				
	
	
		
			15 lines
		
	
	
		
			648 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			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);
 | 
						|
};
 |