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";
|
|
|
|
|
|
|
|
const addFriendImageController: RequestHandler = async (req, res) => {
|
2024-05-28 13:45:06 +02:00
|
|
|
const accountId = await getAccountIdForRequest(req);
|
2025-01-24 14:27:10 +01:00
|
|
|
const json = getJSONfromString<IUpdateGlyphRequest>(String(req.body));
|
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 };
|