XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

SpaceNinjaServer

A simple server for a small space ninja game

公开
关注 0 Fork 1 Star 0
返回提交历史

XFEstudio/SpaceNinjaServer

chore: optimise library (simaris) endpoints (#4060)

Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/4060 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>

abc42fc6
Sainan <63328889+Sainan@users.noreply.github.com>
提交于

代码差异

3 个文件 +5 -9
Modified src/controllers/api/abandonLibraryDailyTaskController.ts +2 -4
@@ -1,11 +1,9 @@
1 import { getInventory } from "../../services/inventoryService.ts";
1 import { Inventory } from "../../models/inventoryModels/inventoryModel.ts";
2 2 import { getAccountIdForRequest } from "../../services/loginService.ts";
3 3 import type { RequestHandler } from "express";
4 4
5 5 export const abandonLibraryDailyTaskController: RequestHandler = async (req, res) => {
6 6 const accountId = await getAccountIdForRequest(req);
7 const inventory = await getInventory(accountId);
8 inventory.LibraryActiveDailyTaskInfo = undefined;
9 await inventory.save();
7 await Inventory.updateOne({ accountOwnerId: accountId }, { $unset: { LibraryActiveDailyTaskInfo: 1 } });
10 8 res.status(200).end();
11 9 };
Modified src/controllers/api/startLibraryDailyTaskController.ts +1 -1
@@ -4,7 +4,7 @@ import type { RequestHandler } from "express";
4 4
5 5 export const startLibraryDailyTaskController: RequestHandler = async (req, res) => {
6 6 const accountId = await getAccountIdForRequest(req);
7 const inventory = await getInventory(accountId);
7 const inventory = await getInventory(accountId, "LibraryAvailableDailyTaskInfo LibraryActiveDailyTaskInfo");
8 8 inventory.LibraryActiveDailyTaskInfo = inventory.LibraryAvailableDailyTaskInfo;
9 9 await inventory.save();
10 10 res.json(inventory.LibraryAvailableDailyTaskInfo);
Modified src/controllers/api/startLibraryPersonalTargetController.ts +2 -4
@@ -1,12 +1,10 @@
1 import { getInventory } from "../../services/inventoryService.ts";
1 import { Inventory } from "../../models/inventoryModels/inventoryModel.ts";
2 2 import { getAccountIdForRequest } from "../../services/loginService.ts";
3 3 import type { RequestHandler } from "express";
4 4
5 5 export const startLibraryPersonalTargetController: RequestHandler = async (req, res) => {
6 6 const accountId = await getAccountIdForRequest(req);
7 const inventory = await getInventory(accountId);
8 inventory.LibraryPersonalTarget = req.query.target as string;
9 await inventory.save();
7 await Inventory.updateOne({ accountOwnerId: accountId }, { LibraryPersonalTarget: req.query.target as string });
10 8 res.json({
11 9 IsQuest: req.query.target == "/Lotus/Types/Game/Library/Targets/DragonframeQuestTarget",
12 10 Target: req.query.target