SpaceNinjaServerOnlyGit/src/controllers/api/purchaseController.ts
OrdisPrime d091af4778
Basic purchasing + custom purchasing API (#20)
Endpoint for custom API: https://localhost:443/custom/addItem
example request:
{
"type": "Weapon",
"internalName": "/Lotus/Weapons/Grineer/Pistols/GrineerMicrowavegun/GrnMicrowavePistol",
"accountId": "6488fd2e7bec200069ca4242"
}
2023-06-14 02:26:19 +02:00

14 lines
562 B
TypeScript

import { parseString } from "@/src/helpers/general";
import { toPurchaseRequest } from "@/src/helpers/purchaseHelpers";
import { handlePurchase } from "@/src/services/purchaseService";
import { Request, Response } from "express";
const purchaseController = async (req: Request, res: Response) => {
const purchaseRequest = toPurchaseRequest(JSON.parse(String(req.body)));
const accountId = parseString(req.query.accountId);
const response = await handlePurchase(purchaseRequest, accountId);
res.json(response);
};
export { purchaseController };