WiP on admin interface for subscribers.
TODO: - format data based on field info in listDTAjax - integrate with the whole subscription machinery
This commit is contained in:
parent
e6bd9cd943
commit
6f5b50e932
38 changed files with 1233 additions and 181 deletions
|
@ -25,6 +25,11 @@ router.getAsync('/fields/:listId', passport.loggedIn, async (req, res) => {
|
|||
return res.json(rows);
|
||||
});
|
||||
|
||||
router.getAsync('/fields-grouped/:listId', passport.loggedIn, async (req, res) => {
|
||||
const rows = await fields.listGrouped(req.context, req.params.listId);
|
||||
return res.json(rows);
|
||||
});
|
||||
|
||||
router.postAsync('/fields/:listId', passport.loggedIn, passport.csrfProtection, async (req, res) => {
|
||||
await fields.create(req.context, req.params.listId, req.body);
|
||||
return res.json();
|
||||
|
|
|
@ -11,7 +11,7 @@ router.postAsync('/segments-table/:listId', passport.loggedIn, async (req, res)
|
|||
});
|
||||
|
||||
router.getAsync('/segments/:listId', passport.loggedIn, async (req, res) => {
|
||||
return res.json(await segments.list(req.context, req.params.listId));
|
||||
return res.json(await segments.listIdName(req.context, req.params.listId));
|
||||
});
|
||||
|
||||
router.getAsync('/segments/:listId/:segmentId', passport.loggedIn, async (req, res) => {
|
||||
|
|
|
@ -10,5 +10,38 @@ router.postAsync('/subscriptions-table/:listId/:segmentId?', passport.loggedIn,
|
|||
return res.json(await subscriptions.listDTAjax(req.context, req.params.listId, req.params.segmentId, req.body));
|
||||
});
|
||||
|
||||
router.getAsync('/subscriptions/:listId/:subscriptionId', passport.loggedIn, async (req, res) => {
|
||||
const entity = await subscriptions.getById(req.context, req.params.listId, req.params.subscriptionId);
|
||||
entity.hash = await subscriptions.hashByList(req.params.listId, entity);
|
||||
return res.json(entity);
|
||||
});
|
||||
|
||||
router.postAsync('/subscriptions/:listId', passport.loggedIn, passport.csrfProtection, async (req, res) => {
|
||||
await subscriptions.create(req.context, req.params.listId, req.body);
|
||||
return res.json();
|
||||
});
|
||||
|
||||
router.putAsync('/subscriptions/:listId/:subscriptionId', passport.loggedIn, passport.csrfProtection, async (req, res) => {
|
||||
const entity = req.body;
|
||||
entity.id = parseInt(req.params.subscriptionId);
|
||||
|
||||
await subscriptions.updateWithConsistencyCheck(req.context, req.params.listId, entity);
|
||||
return res.json();
|
||||
});
|
||||
|
||||
router.deleteAsync('/subscriptions/:listId/:subscriptionId', passport.loggedIn, passport.csrfProtection, async (req, res) => {
|
||||
await subscriptions.remove(req.context, req.params.listId, req.params.subscriptionId);
|
||||
return res.json();
|
||||
});
|
||||
|
||||
router.postAsync('/subscriptions-validate/:listId', passport.loggedIn, async (req, res) => {
|
||||
return res.json(await subscriptions.serverValidate(req.context, req.params.listId, req.body));
|
||||
});
|
||||
|
||||
router.postAsync('/subscriptions-unsubscribe/:listId/:subscriptionId', passport.loggedIn, passport.csrfProtection, async (req, res) => {
|
||||
await subscriptions.unsubscribe(req.context, req.params.listId, req.params.subscriptionId);
|
||||
return res.json();
|
||||
});
|
||||
|
||||
|
||||
module.exports = router;
|
Loading…
Add table
Add a link
Reference in a new issue