chore: remove needless query when sending clan invite #1434

Merged
Sainan merged 2 commits from clan-invite-try into main 2025-04-03 06:17:38 -07:00
Showing only changes of commit 83cd6652ba - Show all commits

View File

@ -35,22 +35,17 @@ export const addToGuildController: RequestHandler = async (req, res) => {
res.status(400).json("Invalid permission"); res.status(400).json("Invalid permission");
} }
if ( try {
await GuildMember.exists({ await GuildMember.insertOne({
accountId: account._id, accountId: account._id,
guildId: payload.GuildId.$oid guildId: payload.GuildId.$oid,
}) status: 2 // outgoing invite
) { });
} catch (e) {
res.status(400).json("User already invited to clan"); res.status(400).json("User already invited to clan");
return; return;
} }
await GuildMember.insertOne({
accountId: account._id,
guildId: payload.GuildId.$oid,
status: 2 // outgoing invite
});
const senderInventory = await getInventory(senderAccount._id.toString(), "ActiveAvatarImageType"); const senderInventory = await getInventory(senderAccount._id.toString(), "ActiveAvatarImageType");
await createMessage(account._id, [ await createMessage(account._id, [
{ {