chore: remove needless query when sending clan invite
All checks were successful
Build / build (22) (push) Successful in 42s
Build / build (20) (pull_request) Successful in 1m14s
Build / build (20) (push) Successful in 1m15s
Build / build (18) (push) Successful in 1m13s
Build / build (18) (pull_request) Successful in 43s
Build / build (22) (pull_request) Successful in 1m14s
All checks were successful
Build / build (22) (push) Successful in 42s
Build / build (20) (pull_request) Successful in 1m14s
Build / build (20) (push) Successful in 1m15s
Build / build (18) (push) Successful in 1m13s
Build / build (18) (pull_request) Successful in 43s
Build / build (22) (pull_request) Successful in 1m14s
This commit is contained in:
parent
24ed580a97
commit
83cd6652ba
@ -35,21 +35,16 @@ export const addToGuildController: RequestHandler = async (req, res) => {
|
|||||||
res.status(400).json("Invalid permission");
|
res.status(400).json("Invalid permission");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
try {
|
||||||
await GuildMember.exists({
|
|
||||||
accountId: account._id,
|
|
||||||
guildId: payload.GuildId.$oid
|
|
||||||
})
|
|
||||||
) {
|
|
||||||
res.status(400).json("User already invited to clan");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
await GuildMember.insertOne({
|
await GuildMember.insertOne({
|
||||||
accountId: account._id,
|
accountId: account._id,
|
||||||
guildId: payload.GuildId.$oid,
|
guildId: payload.GuildId.$oid,
|
||||||
status: 2 // outgoing invite
|
status: 2 // outgoing invite
|
||||||
});
|
});
|
||||||
|
} catch (e) {
|
||||||
|
res.status(400).json("User already invited to clan");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const senderInventory = await getInventory(senderAccount._id.toString(), "ActiveAvatarImageType");
|
const senderInventory = await getInventory(senderAccount._id.toString(), "ActiveAvatarImageType");
|
||||||
await createMessage(account._id, [
|
await createMessage(account._id, [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user