forked from OpenWF/SpaceNinjaServer
chore: fix some questionable calls to model.findById
This commit is contained in:
parent
727f6837ba
commit
45c0da6ed8
@ -75,7 +75,7 @@ export const addToAllianceController: RequestHandler = async (req, res) => {
|
||||
const invitedClanOwnerMember = (await GuildMember.findOne({ guildId: guilds[0]._id, rank: 0 }))!;
|
||||
const senderInventory = await getInventory(account._id.toString(), "ActiveAvatarImageType");
|
||||
const senderGuild = (await Guild.findById(allianceMember.guildId, "Name"))!;
|
||||
const alliance = (await Alliance.findById(req.query.allianceId, "Name"))!;
|
||||
const alliance = (await Alliance.findById(req.query.allianceId as string, "Name"))!;
|
||||
await createMessage(invitedClanOwnerMember.accountId, [
|
||||
{
|
||||
sndr: getSuffixedName(account),
|
||||
|
@ -84,7 +84,10 @@ export const getProfileViewingDataGetController: RequestHandler = async (req, re
|
||||
res.status(409).send("Could not find requested account");
|
||||
}
|
||||
} else if (req.query.guildId) {
|
||||
const guild = await Guild.findById(req.query.guildId, "Name Tier XP Class Emblem TechProjects ClaimedXP");
|
||||
const guild = await Guild.findById(
|
||||
req.query.guildId as string,
|
||||
"Name Tier XP Class Emblem TechProjects ClaimedXP"
|
||||
);
|
||||
if (!guild) {
|
||||
res.status(409).send("Could not find guild");
|
||||
return;
|
||||
|
@ -74,7 +74,7 @@ export const getAccountForRequest = async (req: Request): Promise<TAccountDocume
|
||||
throw new Error("Request is missing nonce parameter");
|
||||
}
|
||||
|
||||
const account = await Account.findById(req.query.accountId);
|
||||
const account = await Account.findById(req.query.accountId as string);
|
||||
if (!account || account.Nonce != nonce) {
|
||||
throw new Error("Invalid accountId-nonce pair");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user