import { getAccountIdForRequest } from "@/src/services/loginService"; import { getJSONfromString } from "@/src/helpers/stringHelpers"; import { getInventory } from "@/src/services/inventoryService"; import { RequestHandler } from "express"; import { ISettings } from "../../types/inventoryTypes/inventoryTypes"; interface ISaveSettingsRequest { Settings: ISettings; } const saveSettingsController: RequestHandler = async (req, res): Promise => { const accountId = await getAccountIdForRequest(req); const trainingResults = getJSONfromString(String(req.body)); const inventory = await getInventory(accountId); inventory.Settings = trainingResults.Settings; await inventory.save(); res.json(inventory.Settings); }; export { saveSettingsController };