2025-02-07 04:44:45 -08:00
|
|
|
import { getInventory } from "@/src/services/inventoryService";
|
|
|
|
import { getAccountIdForRequest } from "@/src/services/loginService";
|
2023-05-19 15:22:48 -03:00
|
|
|
import { RequestHandler } from "express";
|
|
|
|
|
2025-02-07 04:44:45 -08:00
|
|
|
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;
|
2023-05-19 15:22:48 -03:00
|
|
|
|
2025-02-07 04:44:45 -08:00
|
|
|
const inventory = await getInventory(accountId, "ActiveQuest");
|
|
|
|
inventory.ActiveQuest = quest ?? "";
|
|
|
|
await inventory.save();
|
|
|
|
res.status(200).end();
|
|
|
|
};
|