2024-05-03 22:12:51 +02:00
|
|
|
import { RequestHandler } from "express";
|
|
|
|
import { getJSONfromString } from "@/src/helpers/stringHelpers";
|
2024-05-28 13:45:06 +02:00
|
|
|
import { getAccountIdForRequest } from "@/src/services/loginService";
|
2025-03-16 08:16:27 -07:00
|
|
|
import { Inventory } from "@/src/models/inventoryModels/inventoryModel";
|
2024-05-03 22:12:51 +02:00
|
|
|
|
2025-03-16 08:16:27 -07:00
|
|
|
export 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));
|
2025-03-16 08:16:27 -07:00
|
|
|
|
|
|
|
await Inventory.updateOne(
|
|
|
|
{
|
|
|
|
accountOwnerId: accountId
|
|
|
|
},
|
|
|
|
{
|
|
|
|
ActiveAvatarImageType: json.AvatarImageType
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2024-05-03 22:12:51 +02:00
|
|
|
res.json({});
|
|
|
|
};
|
|
|
|
|
2025-03-16 08:16:27 -07:00
|
|
|
interface IUpdateGlyphRequest {
|
|
|
|
AvatarImageType: string;
|
|
|
|
AvatarImage: string;
|
|
|
|
}
|