This commit is contained in:
mandatory
2024-10-26 14:41:45 -04:00
parent 17b0031ef9
commit e7e9c1a192
6 changed files with 233 additions and 104 deletions
+27
View File
@@ -166,6 +166,33 @@ async function get_api_server(proxy_utils) {
}).end();
});
/*
Delete a bot
*/
const DeleteBotSchema = {
type: 'object',
properties: {
bot_id: {
type: 'string',
required: true,
pattern: '[0-9a-f]{8}\-[0-9a-f]{4}\-[0-9a-f]{4}\-[0-9a-f]{4}\-[0-9a-f]{12}'
},
}
}
app.delete(API_BASE_PATH + '/bots', validate({ body: DeleteBotSchema }), async (req, res) => {
const bot = await Bots.findOne({
where: {
id: req.body.bot_id
}
});
await bot.destroy();
res.status(200).json({
"success": true,
"result": {}
}).end();
});
/*
Get list of bots
*/