SpaceNinjaServer/src/controllers/api/genericUpdateController.ts
Sainan b5a0a2297e
All checks were successful
Build / build (20) (push) Successful in 40s
Build / build (18) (push) Successful in 1m15s
Build Docker image / docker (push) Successful in 33s
Build / build (22) (push) Successful in 1m18s
feat: acquisition of peely pix + free pack for first visit (#1292)
Reviewed-on: #1292
2025-03-23 05:07:15 -07:00

17 lines
816 B
TypeScript

import { getAccountIdForRequest } from "@/src/services/loginService";
import { updateGeneric } from "@/src/services/inventoryService";
import { RequestHandler } from "express";
import { getJSONfromString } from "@/src/helpers/stringHelpers";
import { IGenericUpdate } from "@/src/types/genericUpdate";
// This endpoint used to be /api/genericUpdate.php, but sometime around the Jade Shadows update, it was changed to /api/updateNodeIntros.php.
// SpaceNinjaServer supports both endpoints right now.
const genericUpdateController: RequestHandler = async (request, response) => {
const accountId = await getAccountIdForRequest(request);
const update = getJSONfromString<IGenericUpdate>(String(request.body));
response.json(await updateGeneric(update, accountId));
};
export { genericUpdateController };