2024-05-03 22:12:51 +02:00
|
|
|
import { RequestHandler } from "express";
|
|
|
|
import { getJSONfromString } from "@/src/helpers/stringHelpers";
|
|
|
|
import { IUpdateGlyphRequest } from "@/src/types/requestTypes";
|
2024-05-28 13:45:06 +02:00
|
|
|
import { getAccountIdForRequest } from "@/src/services/loginService";
|
2024-05-03 22:12:51 +02:00
|
|
|
import { getInventory } from "@/src/services/inventoryService";
|
|
|
|
|
2024-06-20 11:47:21 +02:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
2024-05-03 22:12:51 +02:00
|
|
|
const addFriendImageController: RequestHandler = async (req, res) => {
|
2024-05-28 13:45:06 +02:00
|
|
|
const accountId = await getAccountIdForRequest(req);
|
2024-05-03 22:12:51 +02:00
|
|
|
const json = getJSONfromString(req.body.toString()) as IUpdateGlyphRequest;
|
2024-05-06 15:19:42 +02:00
|
|
|
const inventory = await getInventory(accountId);
|
2024-05-03 22:12:51 +02:00
|
|
|
inventory.ActiveAvatarImageType = json.AvatarImageType;
|
|
|
|
await inventory.save();
|
|
|
|
res.json({});
|
|
|
|
};
|
|
|
|
|
|
|
|
export { addFriendImageController };
|