Skip to content

Commit

Permalink
added ui to response of POST bot
Browse files Browse the repository at this point in the history
  • Loading branch information
kriscfoster committed Aug 14, 2017
1 parent d932894 commit 744d53a
Show file tree
Hide file tree
Showing 2 changed files with 14 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 @@ -86,12 +86,15 @@ module.exports = {
const resultObj = { reqStartTime: new Date() };
const reqObj = req.swagger.params;
const seqObj = {};
const uiObj = {};
try {
for (const param in reqObj) {
if (reqObj[param].value) {
if (typeof (reqObj[param].value) === 'object' &&
param === 'ui') {
seqObj[param] = reqObj[param].value.buffer;
uiObj.name = reqObj[param].value.originalname;
uiObj.size = reqObj[param].value.size;
} else {
seqObj[param] = reqObj[param].value;
}
Expand All @@ -101,7 +104,7 @@ module.exports = {
helper.model.create(seqObj)
.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
10 changes: 10 additions & 0 deletions api/v1/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10881,6 +10881,16 @@ definitions:
url:
type: string
description: The URL of the bot server
ui:
type: object
description: The UI of the bot
properties:
name:
type: string
description: The name of the UI file.
size:
type: integer
description: The size of the UI file (bytes)
active:
type: boolean
description: Flag for if a bot is active with communication
Expand Down

0 comments on commit 744d53a

Please sign in to comment.