You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.2 KiB
52 lines
1.2 KiB
const GuildM = require('../models/guilds');
|
|
|
|
|
|
exports.hasRem = (io)=>
|
|
{
|
|
return(req,res)=>
|
|
{
|
|
GuildM.find({gID:req.body.guildID})
|
|
.then(
|
|
(guild,err)=>
|
|
{
|
|
if(err || guild.length==0) return res.json({hasRem:false})
|
|
return res.json({hasRem:true})
|
|
}
|
|
)
|
|
}
|
|
};
|
|
|
|
exports.guildData = (io)=>
|
|
{
|
|
return (req, res)=>
|
|
{
|
|
GuildM.find({gID:req.body.guildID})
|
|
.then(
|
|
(guild,err)=>
|
|
{
|
|
if(err || guild.length==0) return res.json(null)
|
|
return res.json(guild[0])
|
|
}
|
|
)
|
|
}
|
|
}
|
|
|
|
exports.updateGuild = (io)=>
|
|
{
|
|
return (req, res)=>
|
|
{
|
|
|
|
GuildM.findOne({gID:req.body.guildID})
|
|
.then(
|
|
(guild, err)=>
|
|
{
|
|
if(err || guild.length) return res.json({Error:'No guild'});
|
|
|
|
guild[`${req.body.property}`] =! guild[`${req.body.property}`];
|
|
GuildM.updateOne({gID:req.body.guildID}, guild).then(()=>
|
|
{
|
|
return res.json(guild);
|
|
})
|
|
})
|
|
}
|
|
} |