1
0
Fork 0
mirror of https://github.com/pawelmalak/flame.git synced 2025-07-27 23:09:35 +02:00

Merge branch 'master' of https://github.com/pawelmalak/flame into merge_upstream_2020-12-06

This commit is contained in:
François Darveau 2021-12-06 22:29:22 -05:00
commit 021bd4e85a
266 changed files with 13470 additions and 7067 deletions

View file

@ -0,0 +1,33 @@
const asyncWrapper = require('../../middleware/asyncWrapper');
const App = require('../../models/App');
const loadConfig = require('../../utils/loadConfig');
// @desc Create new app
// @route POST /api/apps
// @access Public
const createApp = asyncWrapper(async (req, res, next) => {
const { pinAppsByDefault } = await loadConfig();
let body = { ...req.body };
if (body.icon) {
body.icon = body.icon.trim();
}
if (req.file) {
body.icon = req.file.filename;
}
const app = await App.create({
...body,
categoryId: parseInt(req.body.categoryId),
isPinned: pinAppsByDefault,
});
res.status(201).json({
success: true,
data: app,
});
});
module.exports = createApp;