Return cid instead of id when exists and fix documentation api

This commit is contained in:
joker-x 2020-08-22 06:09:18 +02:00
parent 5e77e3c98a
commit cc794d4e52
2 changed files with 41 additions and 14 deletions

View file

@ -110,7 +110,7 @@ router.postAsync('/unsubscribe/:listCid', passport.loggedIn, async (req, res) =>
res.status(200);
res.json({
data: {
id: subscription.id,
id: subscription.cid,
unsubscribed: true
}
});
@ -133,7 +133,7 @@ router.postAsync('/delete/:listCid', passport.loggedIn, async (req, res) => {
res.status(200);
res.json({
data: {
id: subscription.id,
id: subscription.cid,
deleted: true
}
});
@ -227,7 +227,7 @@ router.postAsync('/field/:listCid', passport.loggedIn, async (req, res) => {
input[(key || '').toString().trim().toUpperCase()] = (req.body[key] || '').toString().trim();
});
const key = (input.NAME || '').toString().trim() || slugify('merge ' + name, '_').toUpperCase();
const key = slugify('merge ' + input.NAME, '_').toUpperCase();
const visible = ['false', 'no', '0', ''].indexOf((input.VISIBLE || '').toString().toLowerCase().trim()) < 0;
const groupTemplate = (input.GROUP_TEMPLATE || '').toString().toLowerCase().trim();