chore: remove needless query when sending clan invite #1434
@ -35,21 +35,16 @@ export const addToGuildController: RequestHandler = async (req, res) => {
 | 
			
		||||
            res.status(400).json("Invalid permission");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (
 | 
			
		||||
            await GuildMember.exists({
 | 
			
		||||
                accountId: account._id,
 | 
			
		||||
                guildId: payload.GuildId.$oid
 | 
			
		||||
            })
 | 
			
		||||
        ) {
 | 
			
		||||
            res.status(400).json("User already invited to clan");
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        try {
 | 
			
		||||
            await GuildMember.insertOne({
 | 
			
		||||
                accountId: account._id,
 | 
			
		||||
                guildId: payload.GuildId.$oid,
 | 
			
		||||
                status: 2 // outgoing invite
 | 
			
		||||
            });
 | 
			
		||||
        } catch (e) {
 | 
			
		||||
            res.status(400).json("User already invited to clan");
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        const senderInventory = await getInventory(senderAccount._id.toString(), "ActiveAvatarImageType");
 | 
			
		||||
        await createMessage(account._id, [
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user