Implementation of HTMX server side

master
masterhc 1 year ago
parent e9b5da1698
commit fc415a27ac

@ -1,4 +1,5 @@
const GuildM = require('../models/guilds');
const STRIKES = require('../models/strikes');
const roleRulesM = require('../models/autoRoleRule');
const feedsM = require('../models/feeds');
const xmlparser = require('xml-js')
@ -446,3 +447,51 @@ exports.deleteFeed = (req,res) =>
{
feedsM.findOneAndDelete({_id:req.headers.feedid}).then(()=>{res.json({success:true})}).catch(error=>{res.json({error})})
}
/**
*
*! '/strikes/:id/:userid/:strikeid?'
*/
exports.strikeDashboard = (bot)=>
{
return async (req, res)=>
{
// const user = bot.users.cache.get(req.params.userid)
const guild = bot.guilds.cache.get(req.params.id);
const strikes = await STRIKES.find({guildID:req.params.id})
const moderator = req.params.userid;
res.render('strikesDashboard.ejs', {strikes, guild, moderator})
}
}
exports.getStrikes = (bot)=>
{
return async (req,res)=>
{
var strikes = await STRIKES.find({guildID:req.params.id});
const moderator = req.params.userid
res.render('strikelist.ejs', {strikes})
}
}
exports.updateStrikes = (bot)=>
{
return async (req,res)=>
{
const strike = await STRIKES.findByIdAndUpdate(req.params.strikeid, {validated:true});
const strikes = await STRIKES.find({guildID:req.params.id})
const moderator = req.params.userid;
res.render('strikelist.ejs', {strikes, moderator})
}
}
exports.deleteStrikes = (bot)=>
{
return async (req,res)=>
{
await STRIKES.findByIdAndDelete(req.params.strikeid);
const strikes = await STRIKES.find({guildID:req.params.id})
const moderator = req.params.userid;
res.render('strikelist.ejs', {strikes, moderator})
}
}
Loading…
Cancel
Save