WiP updates
This commit is contained in:
parent
6706d93bc1
commit
4fce4b6f81
27 changed files with 763 additions and 85 deletions
36
routes/rest/send-configurations.js
Normal file
36
routes/rest/send-configurations.js
Normal file
|
@ -0,0 +1,36 @@
|
|||
'use strict';
|
||||
|
||||
const passport = require('../../lib/passport');
|
||||
const sendConfigurations = require('../../models/send-configuration');
|
||||
|
||||
const router = require('../../lib/router-async').create();
|
||||
|
||||
|
||||
router.getAsync('/send-configurations/:sendConfigurationId', passport.loggedIn, async (req, res) => {
|
||||
const sendConfiguration = await sendConfigurations.getById(req.context, req.params.sendConfigurationId);
|
||||
sendConfiguration.hash = sendConfigurations.hash(sendConfiguration);
|
||||
return res.json(sendConfiguration);
|
||||
});
|
||||
|
||||
router.postAsync('/send-configurations', passport.loggedIn, passport.csrfProtection, async (req, res) => {
|
||||
return res.json(await sendConfigurations.create(req.context, req.body));
|
||||
});
|
||||
|
||||
router.putAsync('/send-configurations/:sendConfigurationId', passport.loggedIn, passport.csrfProtection, async (req, res) => {
|
||||
const sendConfiguration = req.body;
|
||||
sendConfiguration.id = parseInt(req.params.sendConfigurationId);
|
||||
|
||||
await sendConfigurations.updateWithConsistencyCheck(req.context, sendConfiguration);
|
||||
return res.json();
|
||||
});
|
||||
|
||||
router.deleteAsync('/send-configurations/:sendConfigurationId', passport.loggedIn, passport.csrfProtection, async (req, res) => {
|
||||
await sendConfigurations.remove(req.context, req.params.sendConfigurationId);
|
||||
return res.json();
|
||||
});
|
||||
|
||||
router.postAsync('/send-configurations-table', passport.loggedIn, async (req, res) => {
|
||||
return res.json(await sendConfigurations.listDTAjax(req.context, req.body));
|
||||
});
|
||||
|
||||
module.exports = router;
|
Loading…
Add table
Add a link
Reference in a new issue