fix: setting active quest (#921)
fixes #920 Reviewed-on: OpenWF/SpaceNinjaServer#921 Co-authored-by: Ordis <134585663+OrdisPrime@users.noreply.github.com> Co-committed-by: Ordis <134585663+OrdisPrime@users.noreply.github.com>
This commit is contained in:
		
							parent
							
								
									9bff05a635
								
							
						
					
					
						commit
						9539bcf8ee
					
				@ -1,7 +1,21 @@
 | 
			
		||||
import { getInventory } from "@/src/services/inventoryService";
 | 
			
		||||
import { getAccountIdForRequest } from "@/src/services/loginService";
 | 
			
		||||
import { RequestHandler } from "express";
 | 
			
		||||
 | 
			
		||||
const setActiveQuestController: RequestHandler = (_req, res) => {
 | 
			
		||||
    res.sendStatus(200);
 | 
			
		||||
};
 | 
			
		||||
export const setActiveQuestController: RequestHandler<
 | 
			
		||||
    Record<string, never>,
 | 
			
		||||
    undefined,
 | 
			
		||||
    undefined,
 | 
			
		||||
    { quest: string | undefined }
 | 
			
		||||
> = async (req, res) => {
 | 
			
		||||
    console.log("req params", JSON.stringify(req.params, null, 2));
 | 
			
		||||
    console.log("req query", JSON.stringify(req.query, null, 2));
 | 
			
		||||
    console.log("req body", JSON.stringify(req.body, null, 2));
 | 
			
		||||
    const accountId = await getAccountIdForRequest(req);
 | 
			
		||||
    const quest = req.query.quest;
 | 
			
		||||
 | 
			
		||||
export { setActiveQuestController };
 | 
			
		||||
    const inventory = await getInventory(accountId, "ActiveQuest");
 | 
			
		||||
    inventory.ActiveQuest = quest ?? "";
 | 
			
		||||
    await inventory.save();
 | 
			
		||||
    res.status(200).end();
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user