SpaceNinjaServer/src/controllers/api/purchaseController.ts

12 lines
537 B
TypeScript
Raw Normal View History

import { parseString } from "@/src/helpers/general";
import { toPurchaseRequest } from "@/src/helpers/purchaseHelpers";
import { handlePurchase } from "@/src/services/purchaseService";
2023-05-19 15:22:48 -03:00
import { Request, Response } from "express";
export 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);
2023-05-19 15:22:48 -03:00
};