I'm surprised JavaScript allows circular includes, but they still don't feel good. Reviewed-on: #1468 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
17 lines
727 B
TypeScript
17 lines
727 B
TypeScript
import { getInventory } from "@/src/services/inventoryService";
|
|
import { getAccountIdForRequest } from "@/src/services/loginService";
|
|
import { giveKeyChainMessage } from "@/src/services/questService";
|
|
import { IKeyChainRequest } from "@/src/types/requestTypes";
|
|
import { RequestHandler } from "express";
|
|
|
|
export const giveKeyChainTriggeredMessageController: RequestHandler = async (req, res) => {
|
|
const accountId = await getAccountIdForRequest(req);
|
|
const keyChainInfo = JSON.parse((req.body as Buffer).toString()) as IKeyChainRequest;
|
|
|
|
const inventory = await getInventory(accountId, "QuestKeys");
|
|
await giveKeyChainMessage(inventory, accountId, keyChainInfo);
|
|
await inventory.save();
|
|
|
|
res.send(1);
|
|
};
|