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

XFESpaceNinjaServer

A simple server for a small space ninja game

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

XFEstudio/XFESpaceNinjaServer

chore: fix some questionable calls to model.findById

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

代码差异

3 个文件 +6 -3
Modified src/controllers/api/addToAllianceController.ts +1 -1
@@ -75,7 +75,7 @@ export const addToAllianceController: RequestHandler = async (req, res) => {
75 75 const invitedClanOwnerMember = (await GuildMember.findOne({ guildId: guilds[0]._id, rank: 0 }))!;
76 76 const senderInventory = await getInventory(account._id.toString(), "ActiveAvatarImageType");
77 77 const senderGuild = (await Guild.findById(allianceMember.guildId, "Name"))!;
78 const alliance = (await Alliance.findById(req.query.allianceId, "Name"))!;
78 const alliance = (await Alliance.findById(req.query.allianceId as string, "Name"))!;
79 79 await createMessage(invitedClanOwnerMember.accountId, [
80 80 {
81 81 sndr: getSuffixedName(account),
Modified src/controllers/dynamic/getProfileViewingDataController.ts +4 -1
@@ -84,7 +84,10 @@ export const getProfileViewingDataGetController: RequestHandler = async (req, re
84 84 res.status(409).send("Could not find requested account");
85 85 }
86 86 } else if (req.query.guildId) {
87 const guild = await Guild.findById(req.query.guildId, "Name Tier XP Class Emblem TechProjects ClaimedXP");
87 const guild = await Guild.findById(
88 req.query.guildId as string,
89 "Name Tier XP Class Emblem TechProjects ClaimedXP"
90 );
88 91 if (!guild) {
89 92 res.status(409).send("Could not find guild");
90 93 return;
Modified src/services/loginService.ts +1 -1
@@ -74,7 +74,7 @@ export const getAccountForRequest = async (req: Request): Promise<TAccountDocume
74 74 throw new Error("Request is missing nonce parameter");
75 75 }
76 76
77 const account = await Account.findById(req.query.accountId);
77 const account = await Account.findById(req.query.accountId as string);
78 78 if (!account || account.Nonce != nonce) {
79 79 throw new Error("Invalid accountId-nonce pair");
80 80 }