2025-08-25 13:37:14 -07:00
|
|
|
import { getAccountIdForRequest } from "../../services/loginService.ts";
|
|
|
|
|
import { updateGeneric } from "../../services/inventoryService.ts";
|
2025-08-24 21:41:20 -07:00
|
|
|
import type { RequestHandler } from "express";
|
2025-08-25 13:37:14 -07:00
|
|
|
import { getJSONfromString } from "../../helpers/stringHelpers.ts";
|
|
|
|
|
import type { IGenericUpdate } from "../../types/genericUpdate.ts";
|
2023-06-01 17:08:05 -07:00
|
|
|
|
2024-08-14 15:14:59 +02:00
|
|
|
// 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.
|
|
|
|
|
|
2024-05-03 15:37:43 +02:00
|
|
|
const genericUpdateController: RequestHandler = async (request, response) => {
|
2024-05-28 13:45:06 +02:00
|
|
|
const accountId = await getAccountIdForRequest(request);
|
2025-01-24 14:27:10 +01:00
|
|
|
const update = getJSONfromString<IGenericUpdate>(String(request.body));
|
2025-03-23 05:07:15 -07:00
|
|
|
response.json(await updateGeneric(update, accountId));
|
2023-06-01 17:08:05 -07:00
|
|
|
};
|
|
|
|
|
|
2023-06-02 00:20:49 -03:00
|
|
|
export { genericUpdateController };
|