work in progress on segments
some cleanup of models - handling dependencies in delete
This commit is contained in:
parent
b23529a75b
commit
0bfb30817b
29 changed files with 553 additions and 990 deletions
|
@ -2,8 +2,6 @@
|
|||
|
||||
const passport = require('../../lib/passport');
|
||||
const lists = require('../../models/lists');
|
||||
const subscriptions = require('../../models/subscriptions');
|
||||
const segments = require('../../models/segments');
|
||||
|
||||
const router = require('../../lib/router-async').create();
|
||||
|
||||
|
@ -24,10 +22,10 @@ router.postAsync('/lists', passport.loggedIn, passport.csrfProtection, async (re
|
|||
});
|
||||
|
||||
router.putAsync('/lists/:listId', passport.loggedIn, passport.csrfProtection, async (req, res) => {
|
||||
const list = req.body;
|
||||
list.id = parseInt(req.params.listId);
|
||||
const entity = req.body;
|
||||
entity.id = parseInt(req.params.listId);
|
||||
|
||||
await lists.updateWithConsistencyCheck(req.context, list);
|
||||
await lists.updateWithConsistencyCheck(req.context, entity);
|
||||
return res.json();
|
||||
});
|
||||
|
||||
|
@ -36,17 +34,5 @@ router.deleteAsync('/lists/:listId', passport.loggedIn, passport.csrfProtection,
|
|||
return res.json();
|
||||
});
|
||||
|
||||
router.postAsync('/subscriptions-table/:listId', passport.loggedIn, async (req, res) => {
|
||||
return res.json(await subscriptions.listDTAjax(req.context, req.params.listId, req.body));
|
||||
});
|
||||
|
||||
router.getAsync('/segments/:listId', passport.loggedIn, async (req, res) => {
|
||||
return res.json(await segments.list(req.context, req.params.listId));
|
||||
});
|
||||
|
||||
router.postAsync('/segments-table/:listId', passport.loggedIn, async (req, res) => {
|
||||
return res.json(await segments.listDTAjax(req.context, req.params.listId, req.body));
|
||||
});
|
||||
|
||||
|
||||
module.exports = router;
|
Loading…
Add table
Add a link
Reference in a new issue