diff --git a/src/models/item.js b/src/models/item.js index cde7b67..c718e94 100644 --- a/src/models/item.js +++ b/src/models/item.js @@ -7,12 +7,16 @@ const S3ImageUtils = require('../utils/S3ImageUtils'); module.exports = { insertItem: async function (req) { const userId = Number(req.decoded); - const folderId = !req.body.folder_id ? null : Number(req.body.folder_id); + let folderId = !req.body.folder_id ? null : Number(req.body.folder_id); const itemName = trimToString(req.body.item_name); const itemPrice = !req.body.item_price ? 0 : req.body.item_price; const itemUrl = !req.body.item_url ? null : trimToString(req.body.item_url); const itemMemo = trimToString(req.body.item_memo); + if (isNaN(folderId)) { + folderId = null; + } + const params = [userId, folderId, itemName, itemPrice, itemUrl, itemMemo]; let sqlInsert;