forked from OpenWF/SpaceNinjaServer
e.g. changing syndicate pledge now takes ~6 ms instead of ~84 ms. Reviewed-on: OpenWF/SpaceNinjaServer#1211
26 lines
746 B
TypeScript
26 lines
746 B
TypeScript
import { RequestHandler } from "express";
|
|
import { getJSONfromString } from "@/src/helpers/stringHelpers";
|
|
import { getAccountIdForRequest } from "@/src/services/loginService";
|
|
import { Inventory } from "@/src/models/inventoryModels/inventoryModel";
|
|
|
|
export const addFriendImageController: RequestHandler = async (req, res) => {
|
|
const accountId = await getAccountIdForRequest(req);
|
|
const json = getJSONfromString<IUpdateGlyphRequest>(String(req.body));
|
|
|
|
await Inventory.updateOne(
|
|
{
|
|
accountOwnerId: accountId
|
|
},
|
|
{
|
|
ActiveAvatarImageType: json.AvatarImageType
|
|
}
|
|
);
|
|
|
|
res.json({});
|
|
};
|
|
|
|
interface IUpdateGlyphRequest {
|
|
AvatarImageType: string;
|
|
AvatarImage: string;
|
|
}
|