SpaceNinjaServer/src/controllers/api/updateChallengeProgressController.ts

18 lines
759 B
TypeScript
Raw Normal View History

2023-05-19 15:22:48 -03:00
import { RequestHandler } from "express";
import { getJSONfromString } from "@/src/helpers/stringHelpers";
import { getAccountIdForRequest } from "@/src/services/loginService";
import { updateChallengeProgress } from "@/src/services/inventoryService";
import { IUpdateChallengeProgressRequest } from "@/src/types/requestTypes";
// eslint-disable-next-line @typescript-eslint/no-misused-promises
const updateChallengeProgressController: RequestHandler = async (req, res) => {
const payload = getJSONfromString(String(req.body)) as IUpdateChallengeProgressRequest;
const accountId = await getAccountIdForRequest(req);
await updateChallengeProgress(payload, accountId);
res.status(200).end();
2023-05-19 15:22:48 -03:00
};
export { updateChallengeProgressController };