SpaceNinjaServer/src/controllers/api/updateChallengeProgressController.ts
Jānis 2a1a4e77b5
feat: syndicates (#269)
Co-authored-by: janisslsm <janisslsm@users.noreply.github.com>
2024-06-02 17:35:06 +02:00

17 lines
693 B
TypeScript

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";
const updateChallengeProgressController: RequestHandler = async (req, res) => {
const payload: IUpdateChallengeProgressRequest = getJSONfromString(req.body.toString());
const accountId = await getAccountIdForRequest(req);
await updateChallengeProgress(payload, accountId);
res.status(200).end();
};
export { updateChallengeProgressController };