forked from OpenWF/SpaceNinjaServer
feat: persist user's choice of glyph (#152)
This commit is contained in:
parent
f019d36209
commit
675e6c4583
15
src/controllers/api/addFriendImageController.ts
Normal file
15
src/controllers/api/addFriendImageController.ts
Normal file
@ -0,0 +1,15 @@
|
||||
import { RequestHandler } from "express";
|
||||
import { getJSONfromString } from "@/src/helpers/stringHelpers";
|
||||
import { IUpdateGlyphRequest } from "@/src/types/requestTypes";
|
||||
import { getInventory } from "@/src/services/inventoryService";
|
||||
|
||||
const addFriendImageController: RequestHandler = async (req, res) => {
|
||||
const accountId = req.query.accountId as string;
|
||||
const json = getJSONfromString(req.body.toString()) as IUpdateGlyphRequest;
|
||||
let inventory = await getInventory(accountId);
|
||||
inventory.ActiveAvatarImageType = json.AvatarImageType;
|
||||
await inventory.save();
|
||||
res.json({});
|
||||
};
|
||||
|
||||
export { addFriendImageController };
|
@ -42,6 +42,7 @@ import { setShipCustomizationsController } from "@/src/controllers/api/setShipCu
|
||||
import { setActiveShipController } from "@/src/controllers/api/setActiveShipController";
|
||||
import { updateThemeController } from "../controllers/api/updateThemeController";
|
||||
import { getGuildController } from "@/src/controllers/api/getGuildController";
|
||||
import { addFriendImageController } from "@/src/controllers/api/addFriendImageController";
|
||||
|
||||
const apiRouter = express.Router();
|
||||
|
||||
@ -94,5 +95,6 @@ apiRouter.post("/joinSession.php", joinSessionController);
|
||||
apiRouter.post("/saveLoadout.php", saveLoadoutController);
|
||||
apiRouter.post("/trainingResult.php", trainingResultController);
|
||||
apiRouter.post("/updateTheme.php", updateThemeController);
|
||||
apiRouter.post("/addFriendImage.php", addFriendImageController);
|
||||
|
||||
export { apiRouter };
|
||||
|
@ -59,3 +59,8 @@ export interface IMissionInventoryUpdateRequestRewardInfo {
|
||||
export interface IInventorySlotsRequest {
|
||||
Bin: "PveBonusLoadoutBin";
|
||||
}
|
||||
|
||||
export interface IUpdateGlyphRequest {
|
||||
AvatarImageType: string;
|
||||
AvatarImage: string;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user