forked from OpenWF/SpaceNinjaServer
		
	For bootstrapper v0.11.11, out now. Reviewed-on: OpenWF/SpaceNinjaServer#2735 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
		
			
				
	
	
		
			21 lines
		
	
	
		
			645 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			21 lines
		
	
	
		
			645 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
import type { RequestHandler } from "express";
 | 
						|
import { getAccountIdForRequest } from "../../services/loginService.ts";
 | 
						|
import { Inventory } from "../../models/inventoryModels/inventoryModel.ts";
 | 
						|
import { broadcastInventoryUpdate } from "../../services/wsService.ts";
 | 
						|
 | 
						|
export const setSupportedSyndicateController: RequestHandler = async (req, res) => {
 | 
						|
    const accountId = await getAccountIdForRequest(req);
 | 
						|
 | 
						|
    await Inventory.updateOne(
 | 
						|
        {
 | 
						|
            accountOwnerId: accountId
 | 
						|
        },
 | 
						|
        {
 | 
						|
            SupportedSyndicate: req.query.syndicate as string
 | 
						|
        }
 | 
						|
    );
 | 
						|
 | 
						|
    res.end();
 | 
						|
    broadcastInventoryUpdate(req);
 | 
						|
};
 |