1
This commit is contained in:
parent
2d312a97a3
commit
dd8438cf26
@ -13,13 +13,14 @@ const inventoryController: RequestHandler = async (request: Request, response: R
|
|||||||
console.log(accountId);
|
console.log(accountId);
|
||||||
|
|
||||||
const inventory = await Inventory.findOne({ accountOwnerId: accountId }); // has the accountOwnerId field to find a corresponding inventory
|
const inventory = await Inventory.findOne({ accountOwnerId: accountId }); // has the accountOwnerId field to find a corresponding inventory
|
||||||
const inventoryJSON = inventory?.toJSON();
|
|
||||||
|
|
||||||
if (!inventoryJSON) {
|
if (!inventory) {
|
||||||
response.status(400).json({ error: "inventory was undefined" });
|
response.status(400).json({ error: "inventory was undefined" });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const inventoryJSON = inventory.toJSON();
|
||||||
|
|
||||||
const inventoreResponse = toInventoryResponse(inventoryJSON); // remove the accountOwnerId for the response
|
const inventoreResponse = toInventoryResponse(inventoryJSON); // remove the accountOwnerId for the response
|
||||||
|
|
||||||
response.json(inventoreResponse);
|
response.json(inventoreResponse);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user