From 88aab63a474a0bc7a90e297e5f0d135fd34a9b60 Mon Sep 17 00:00:00 2001 From: Sathishkumar Krishnan Date: Fri, 7 Jan 2022 09:04:39 +0530 Subject: [PATCH] fix: model incorrect usage --- src/controller/item.controller.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/controller/item.controller.js b/src/controller/item.controller.js index 8ea9ddb..950239d 100644 --- a/src/controller/item.controller.js +++ b/src/controller/item.controller.js @@ -9,7 +9,7 @@ const { CheckInItemTransaction, CheckOutItemTransaction, ReportItemTransaction, - // AdjustItemTransaction, + AdjustItemTransaction, } = require("../models/ItemTransaction"); const ItemAssociation = require("../models/ItemAssociation"); @@ -232,8 +232,8 @@ module.exports = { itemAssociation.availableQuantity = itemAssociation.availableQuantity + putQuantity; await itemAssociation.save(); - await PickItemTransaction.create({ - type: "PICK", + await PutItemTransaction.create({ + type: "PUT", performedOn: item, performedBy: res.locals.user, putQuantity: putQuantity, @@ -270,8 +270,8 @@ module.exports = { itemAssociation.availableQuantity = itemAssociation.availableQuantity - pickupQuantity; await itemAssociation.save(); - await PutItemTransaction.create({ - type: "PUT", + await PickItemTransaction.create({ + type: "PICK", performedOn: item, performedBy: res.locals.user, pickupQuantity: pickupQuantity, @@ -407,7 +407,7 @@ module.exports = { } await ReportItemTransaction.create({ - type: "PUT", + type: "REPORT", performedOn: item, performedBy: res.locals.user, reportingFor: reportingFor, @@ -447,8 +447,8 @@ module.exports = { itemAssociation.availableQuantity = itemAssociation.availableQuantity - totalAdjustment; await itemAssociation.save(); - await PutItemTransaction.create({ - type: "PUT", + await AdjustItemTransaction.create({ + type: "ADJUST", performedOn: item, performedBy: res.locals.user, lastRecordedQuantity,