返回提交历史
Modified
src/controllers/api/genericUpdateController.ts
+5
-21
XFEstudio/XFESpaceNinjaServer
feat: Process generic updates (#148)
0abd531b
代码差异
1 个文件
+5
-21
@@ -1,28 +1,12 @@
1
1
import { updateGeneric } from "@/src/services/inventoryService";
2
import { IGenericUpdate } from "@/src/types/genericUpdate";
3
2
import { RequestHandler } from "express";
3
import { getJSONfromString } from "@/src/helpers/stringHelpers";
4
4
5
// TODO: Nightwave evidence submission support is the only thing missing.
6
// TODO: this was added by someone without testing. It may not work.
7
5
// eslint-disable-next-line @typescript-eslint/no-misused-promises
8
const genericUpdateController: RequestHandler = async (_request, response) => {
9
// const accountId = request.query.accountId as string;
10
11
// const [body] = String(request.body).split("\n");
12
13
// let reply = {};
14
// try {
15
// const update = JSON.parse(body) as IGenericUpdate;
16
// if (typeof update !== "object") {
17
// throw new Error("Invalid data format");
18
// }
19
20
// reply = await updateGeneric(update, accountId);
21
// } catch (err) {
22
// console.error("Error parsing JSON data:", err);
23
// }
24
25
response.json({});
6
const genericUpdateController: RequestHandler = async (request, response) => {
7
const accountId = request.query.accountId as string;
8
const update = getJSONfromString(request.body.toString());
9
response.json(await updateGeneric(update, accountId));
26
10
};
27
11
28
12
export { genericUpdateController };