SpaceNinjaServer/src/controllers/api/genericUpdateController.ts
Sainan c97c22b434
All checks were successful
Build Docker image / docker-arm64 (push) Successful in 1m15s
Build / build (push) Successful in 1m8s
Build Docker image / docker-amd64 (push) Successful in 1m1s
chore: use relative imports with .ts (#2694)
Reviewed-on: #2694
Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com>
Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
2025-08-25 13:37:14 -07:00

17 lines
838 B
TypeScript

import { getAccountIdForRequest } from "../../services/loginService.ts";
import { updateGeneric } from "../../services/inventoryService.ts";
import type { RequestHandler } from "express";
import { getJSONfromString } from "../../helpers/stringHelpers.ts";
import type { IGenericUpdate } from "../../types/genericUpdate.ts";
// 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 };