2025-01-11 12:54:32 +01:00
|
|
|
import { RequestHandler } from "express";
|
|
|
|
import { getAccountIdForRequest } from "@/src/services/loginService";
|
|
|
|
import { getInventory } from "@/src/services/inventoryService";
|
|
|
|
import { getJSONfromString } from "@/src/helpers/stringHelpers";
|
|
|
|
|
|
|
|
export const setEquippedInstrumentController: RequestHandler = async (req, res) => {
|
|
|
|
const accountId = await getAccountIdForRequest(req);
|
|
|
|
const inventory = await getInventory(accountId);
|
2025-01-24 14:27:10 +01:00
|
|
|
const body = getJSONfromString<ISetEquippedInstrumentRequest>(String(req.body));
|
2025-01-11 12:54:32 +01:00
|
|
|
inventory.EquippedInstrument = body.Instrument;
|
|
|
|
await inventory.save();
|
|
|
|
res.end();
|
|
|
|
};
|
|
|
|
|
|
|
|
interface ISetEquippedInstrumentRequest {
|
|
|
|
Instrument: string;
|
|
|
|
}
|