u
This commit is contained in:
@@ -190,12 +190,8 @@ export function register(app, basePath = '') {
|
||||
}
|
||||
|
||||
const pairingpin = String(randomInt(100000, 999999));
|
||||
const rootCategoryId = req.body.rootCategoryId !== undefined
|
||||
? req.body.rootCategoryId
|
||||
: req.body.root_category_id;
|
||||
const syncRootArticles = req.body.syncRootArticles !== undefined
|
||||
? req.body.syncRootArticles
|
||||
: req.body.sync_root_articles;
|
||||
const rootCategoryId = req.body.rootCategoryId;
|
||||
const syncRootArticles = req.body.syncRootArticles;
|
||||
const sort = req.body.sort !== undefined ? Number(req.body.sort) : undefined;
|
||||
if (sort !== undefined && !Number.isInteger(sort)) {
|
||||
return res.status(400).json({ error: 'sort must be an integer' });
|
||||
@@ -319,14 +315,12 @@ export function register(app, basePath = '') {
|
||||
payload.name = req.body.name.trim();
|
||||
}
|
||||
|
||||
if (req.body.rootCategoryId !== undefined || req.body.root_category_id !== undefined) {
|
||||
const rawCat = req.body.rootCategoryId !== undefined ? req.body.rootCategoryId : req.body.root_category_id;
|
||||
payload.rootCategoryId = rawCat != null ? Number(rawCat) : null;
|
||||
if (req.body.rootCategoryId !== undefined) {
|
||||
payload.rootCategoryId = req.body.rootCategoryId != null ? Number(req.body.rootCategoryId) : null;
|
||||
}
|
||||
|
||||
if (req.body.syncRootArticles !== undefined || req.body.sync_root_articles !== undefined) {
|
||||
const rawSync = req.body.syncRootArticles !== undefined ? req.body.syncRootArticles : req.body.sync_root_articles;
|
||||
payload.syncRootArticles = Boolean(rawSync);
|
||||
if (req.body.syncRootArticles !== undefined) {
|
||||
payload.syncRootArticles = Boolean(req.body.syncRootArticles);
|
||||
}
|
||||
|
||||
if (req.body.sort !== undefined) {
|
||||
|
||||
Reference in New Issue
Block a user