XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFESpaceNinjaServer

A simple server for a small space ninja game

公开
关注 0 Fork 0 Star 0
返回提交历史

XFEstudio/XFESpaceNinjaServer

feat: Process generic updates (#148)

0abd531b
Sainan <sainan@calamity.gg>
提交于

代码差异

1 个文件 +5 -21
Modified src/controllers/api/genericUpdateController.ts +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 };