Skip to content

Commit

Permalink
added ui to put response
Browse files Browse the repository at this point in the history
  • Loading branch information
kriscfoster committed Aug 14, 2017
1 parent 744d53a commit e757fa2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion api/v1/controllers/bots.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,15 @@ module.exports = {
putBots(req, res, next) {
const resultObj = { reqStartTime: new Date() };
const reqObj = req.swagger.params;
const uiObj = {};
u.findByKey(helper, req.swagger.params)
.then((o) => {
for (const param in reqObj) {
if (reqObj[param].value) {
if (param === 'ui') {
o.set(param, reqObj[param].value.buffer);
uiObj.name = reqObj[param].value.originalname;
uiObj.size = reqObj[param].value.size;
} else {
o.set(param, reqObj[param].value);
}
Expand All @@ -147,7 +150,7 @@ module.exports = {
})
.then((o) => {
resultObj.dbTime = new Date() - resultObj.reqStartTime;
delete o.dataValues.ui;
o.dataValues.ui = uiObj;
u.logAPI(req, resultObj, o.dataValues);
res.status(httpStatus.CREATED).json(
u.responsify(o, helper, req.method)
Expand Down

0 comments on commit e757fa2

Please sign in to comment.