1
0
Fork 0
mirror of https://github.com/pawelmalak/flame.git synced 2025-07-25 22:09:36 +02:00

fixes after latest rebase

This commit is contained in:
François Darveau 2021-08-03 08:11:29 -04:00
parent 32bfe33a75
commit 14fbc7e221
2 changed files with 10 additions and 20 deletions

View file

@ -16,24 +16,20 @@ exports.createApp = asyncWrapper(async (req, res, next) => {
const pinApps = await Config.findOne({ const pinApps = await Config.findOne({
where: { key: 'pinAppsByDefault' }, where: { key: 'pinAppsByDefault' },
}); });
let app; let app;
let _body = { ...req.body };
let _body = {
...req.body,
categoryId: parseInt(req.body.categoryId),
isPinned: (pinApps && parseInt(pinApps.value)),
};
if (req.file) { if (req.file) {
_body.icon = req.file.filename; _body.icon = req.file.filename;
} }
if (pinApps) { app = await App.create(_body);
if (parseInt(pinApps.value)) {
app = await App.create({
..._body,
isPinned: true,
});
} else {
app = await App.create(req.body);
}
}
res.status(201).json({ res.status(201).json({
success: true, success: true,

View file

@ -10,20 +10,14 @@ const { Sequelize } = require('sequelize');
exports.createBookmark = asyncWrapper(async (req, res, next) => { exports.createBookmark = asyncWrapper(async (req, res, next) => {
const pinBookmarks = await Config.findOne({ const pinBookmarks = await Config.findOne({
where: { key: 'pinBookmarksByDefault' } where: { key: 'pinBookmarksByDefault' }
}); });
let bookmark; let bookmark;
let _body = { ...req.body };
if (req.file) {
_body.icon = req.file.filename;
}
let _body = { let _body = {
...req.body, ...req.body,
categoryId: parseInt(req.body.categoryId), categoryId: parseInt(req.body.categoryId),
isPinned = (pinBookmarks && parseInt(pinBookmarks.value)), isPinned: (pinBookmarks && parseInt(pinBookmarks.value)),
}; };
if (req.file) { if (req.file) {