- Fix for #890
- "Channels" feature - Shoutout config param rendered on the homepage - "Clone" feature for campaigns
This commit is contained in:
parent
82251d1cb9
commit
00432e6cfe
23 changed files with 1691 additions and 494 deletions
38
server/routes/rest/channels.js
Normal file
38
server/routes/rest/channels.js
Normal file
|
@ -0,0 +1,38 @@
|
|||
'use strict';
|
||||
|
||||
const passport = require('../../lib/passport');
|
||||
const channels = require('../../models/channels');
|
||||
|
||||
const router = require('../../lib/router-async').create();
|
||||
const {castToInteger} = require('../../lib/helpers');
|
||||
|
||||
|
||||
router.postAsync('/channels-table', passport.loggedIn, async (req, res) => {
|
||||
return res.json(await channels.listDTAjax(req.context, req.body));
|
||||
});
|
||||
|
||||
router.getAsync('/channels/:channelId', passport.loggedIn, async (req, res) => {
|
||||
const channel = await channels.getById(req.context, castToInteger(req.params.channelId), true);
|
||||
channel.hash = channels.hash(channel);
|
||||
return res.json(channel);
|
||||
});
|
||||
|
||||
router.postAsync('/channels', passport.loggedIn, passport.csrfProtection, async (req, res) => {
|
||||
return res.json(await channels.create(req.context, req.body));
|
||||
});
|
||||
|
||||
router.putAsync('/channels/:channelId', passport.loggedIn, passport.csrfProtection, async (req, res) => {
|
||||
const entity = req.body;
|
||||
entity.id = castToInteger(req.params.channelId);
|
||||
|
||||
await channels.updateWithConsistencyCheck(req.context);
|
||||
return res.json();
|
||||
});
|
||||
|
||||
router.deleteAsync('/channels/:channelId', passport.loggedIn, passport.csrfProtection, async (req, res) => {
|
||||
await channels.remove(req.context, castToInteger(req.params.channelId));
|
||||
return res.json();
|
||||
});
|
||||
|
||||
|
||||
module.exports = router;
|
Loading…
Add table
Add a link
Reference in a new issue