2023-09-05 07:37:30 -05:00
|
|
|
import { updateGeneric } from "@/src/services/inventoryService";
|
|
|
|
import { IGenericUpdate } from "@/src/types/genericUpdate";
|
2023-06-01 17:08:05 -07:00
|
|
|
import { RequestHandler } from "express";
|
|
|
|
|
2023-09-05 07:37:30 -05:00
|
|
|
// TODO: Nightwave evidence submission support is the only thing missing.
|
2023-12-14 17:34:15 +01:00
|
|
|
// TODO: this was added by someone without testing. It may not work.
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
|
|
const genericUpdateController: RequestHandler = async (_request, response) => {
|
|
|
|
// const accountId = request.query.accountId as string;
|
2023-09-05 07:37:30 -05:00
|
|
|
|
2023-12-14 17:34:15 +01:00
|
|
|
// const [body] = String(request.body).split("\n");
|
2023-09-05 07:37:30 -05:00
|
|
|
|
2023-12-14 17:34:15 +01:00
|
|
|
// let reply = {};
|
|
|
|
// try {
|
|
|
|
// const update = JSON.parse(body) as IGenericUpdate;
|
|
|
|
// if (typeof update !== "object") {
|
|
|
|
// throw new Error("Invalid data format");
|
|
|
|
// }
|
2023-09-05 07:37:30 -05:00
|
|
|
|
2023-12-14 17:34:15 +01:00
|
|
|
// reply = await updateGeneric(update, accountId);
|
|
|
|
// } catch (err) {
|
|
|
|
// console.error("Error parsing JSON data:", err);
|
|
|
|
// }
|
2023-09-05 07:37:30 -05:00
|
|
|
|
|
|
|
response.json({});
|
2023-06-01 17:08:05 -07:00
|
|
|
};
|
|
|
|
|
2023-06-02 00:20:49 -03:00
|
|
|
export { genericUpdateController };
|