Inventory Infrastructure and Example for Suits #10

Merged
OrdisPrime merged 16 commits from inventory_basic into main 2023-06-03 18:06:22 -07:00
Showing only changes of commit dd8438cf26 - Show all commits

View File

@ -13,13 +13,14 @@ const inventoryController: RequestHandler = async (request: Request, response: R
AngeloTadeucci commented 2023-06-03 17:26:15 -07:00 (Migrated from github.com)
Review

i dont think the comment is necessary

    const inventory = await Inventory.findOne({ accountOwnerId: accountId });
i dont think the comment is necessary ```suggestion const inventory = await Inventory.findOne({ accountOwnerId: accountId }); ```
AngeloTadeucci commented 2023-06-03 17:26:15 -07:00 (Migrated from github.com)
Review

i dont think the comment is necessary

    const inventory = await Inventory.findOne({ accountOwnerId: accountId });
i dont think the comment is necessary ```suggestion const inventory = await Inventory.findOne({ accountOwnerId: accountId }); ```
AngeloTadeucci commented 2023-06-03 17:26:58 -07:00 (Migrated from github.com)
Review

check if inventory is undefined before trying toJson()

check if inventory is undefined before trying `toJson()`
AngeloTadeucci commented 2023-06-03 17:26:58 -07:00 (Migrated from github.com)
Review

check if inventory is undefined before trying toJson()

check if inventory is undefined before trying `toJson()`
OrdisPrime commented 2023-06-03 17:39:50 -07:00 (Migrated from github.com)
Review

it is important, because it is not present in the original response.

it is important, because it is not present in the original response.
OrdisPrime commented 2023-06-03 17:39:50 -07:00 (Migrated from github.com)
Review

it is important, because it is not present in the original response.

it is important, because it is not present in the original response.
OrdisPrime commented 2023-06-03 17:40:09 -07:00 (Migrated from github.com)
Review

?. checks for undefined!

?. checks for undefined!
OrdisPrime commented 2023-06-03 17:40:09 -07:00 (Migrated from github.com)
Review

?. checks for undefined!

?. checks for undefined!
AngeloTadeucci commented 2023-06-03 17:43:01 -07:00 (Migrated from github.com)
Review

this comment doesn't explain nothing, it says its using accountOwnerId to find an inventory which is obvious.

this comment doesn't explain nothing, it says its using accountOwnerId to find an inventory which is obvious.
AngeloTadeucci commented 2023-06-03 17:43:01 -07:00 (Migrated from github.com)
Review

this comment doesn't explain nothing, it says its using accountOwnerId to find an inventory which is obvious.

this comment doesn't explain nothing, it says its using accountOwnerId to find an inventory which is obvious.
AngeloTadeucci commented 2023-06-03 17:43:49 -07:00 (Migrated from github.com)
Review

that's why you check before so you dont two undefined checks

that's why you check before so you dont two undefined checks
AngeloTadeucci commented 2023-06-03 17:43:49 -07:00 (Migrated from github.com)
Review

that's why you check before so you dont two undefined checks

that's why you check before so you dont two undefined checks
OrdisPrime commented 2023-06-03 17:44:53 -07:00 (Migrated from github.com)
Review

it explains a lot.

I added the field accountOwnerId and everyone who knows the inventory structure would know the field is not originally there.

The purpose of the field is explained: it exists to find an account's corresponding inventory.

it explains a lot. I added the field accountOwnerId and everyone who knows the inventory structure would know the field is not originally there. The purpose of the field is explained: it exists to find an account's corresponding inventory.
OrdisPrime commented 2023-06-03 17:44:53 -07:00 (Migrated from github.com)
Review

it explains a lot.

I added the field accountOwnerId and everyone who knows the inventory structure would know the field is not originally there.

The purpose of the field is explained: it exists to find an account's corresponding inventory.

it explains a lot. I added the field accountOwnerId and everyone who knows the inventory structure would know the field is not originally there. The purpose of the field is explained: it exists to find an account's corresponding inventory.
OrdisPrime commented 2023-06-03 17:46:46 -07:00 (Migrated from github.com)
Review

good suggestion!

good suggestion!
OrdisPrime commented 2023-06-03 17:46:46 -07:00 (Migrated from github.com)
Review

good suggestion!

good suggestion!
OrdisPrime commented 2023-06-03 17:46:59 -07:00 (Migrated from github.com)
Review

I understand now what you mean

I understand now what you mean
OrdisPrime commented 2023-06-03 17:46:59 -07:00 (Migrated from github.com)
Review

I understand now what you mean

I understand now what you mean
AngeloTadeucci commented 2023-06-03 17:49:04 -07:00 (Migrated from github.com)
Review

should that belong then inside inventoryModel.ts?

should that belong then inside inventoryModel.ts?
AngeloTadeucci commented 2023-06-03 17:49:04 -07:00 (Migrated from github.com)
Review

should that belong then inside inventoryModel.ts?

should that belong then inside inventoryModel.ts?
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();
AngeloTadeucci commented 2023-06-03 17:26:15 -07:00 (Migrated from github.com)
Review

i dont think the comment is necessary

    const inventory = await Inventory.findOne({ accountOwnerId: accountId });
i dont think the comment is necessary ```suggestion const inventory = await Inventory.findOne({ accountOwnerId: accountId }); ```
AngeloTadeucci commented 2023-06-03 17:26:58 -07:00 (Migrated from github.com)
Review

check if inventory is undefined before trying toJson()

check if inventory is undefined before trying `toJson()`
OrdisPrime commented 2023-06-03 17:39:50 -07:00 (Migrated from github.com)
Review

it is important, because it is not present in the original response.

it is important, because it is not present in the original response.
OrdisPrime commented 2023-06-03 17:40:09 -07:00 (Migrated from github.com)
Review

?. checks for undefined!

?. checks for undefined!
AngeloTadeucci commented 2023-06-03 17:43:01 -07:00 (Migrated from github.com)
Review

this comment doesn't explain nothing, it says its using accountOwnerId to find an inventory which is obvious.

this comment doesn't explain nothing, it says its using accountOwnerId to find an inventory which is obvious.
AngeloTadeucci commented 2023-06-03 17:43:49 -07:00 (Migrated from github.com)
Review

that's why you check before so you dont two undefined checks

that's why you check before so you dont two undefined checks
OrdisPrime commented 2023-06-03 17:44:53 -07:00 (Migrated from github.com)
Review

it explains a lot.

I added the field accountOwnerId and everyone who knows the inventory structure would know the field is not originally there.

The purpose of the field is explained: it exists to find an account's corresponding inventory.

it explains a lot. I added the field accountOwnerId and everyone who knows the inventory structure would know the field is not originally there. The purpose of the field is explained: it exists to find an account's corresponding inventory.
OrdisPrime commented 2023-06-03 17:46:46 -07:00 (Migrated from github.com)
Review

good suggestion!

good suggestion!
OrdisPrime commented 2023-06-03 17:46:59 -07:00 (Migrated from github.com)
Review

I understand now what you mean

I understand now what you mean
AngeloTadeucci commented 2023-06-03 17:49:04 -07:00 (Migrated from github.com)
Review

should that belong then inside inventoryModel.ts?

should that belong then inside inventoryModel.ts?
AngeloTadeucci commented 2023-06-03 18:04:28 -07:00 (Migrated from github.com)
Review

remove log

remove log
if (!inventoryJSON) { if (!inventory) {
AngeloTadeucci commented 2023-06-03 17:26:15 -07:00 (Migrated from github.com)
Review

i dont think the comment is necessary

    const inventory = await Inventory.findOne({ accountOwnerId: accountId });
i dont think the comment is necessary ```suggestion const inventory = await Inventory.findOne({ accountOwnerId: accountId }); ```
AngeloTadeucci commented 2023-06-03 17:26:58 -07:00 (Migrated from github.com)
Review

check if inventory is undefined before trying toJson()

check if inventory is undefined before trying `toJson()`
OrdisPrime commented 2023-06-03 17:39:50 -07:00 (Migrated from github.com)
Review

it is important, because it is not present in the original response.

it is important, because it is not present in the original response.
OrdisPrime commented 2023-06-03 17:40:09 -07:00 (Migrated from github.com)
Review

?. checks for undefined!

?. checks for undefined!
AngeloTadeucci commented 2023-06-03 17:43:01 -07:00 (Migrated from github.com)
Review

this comment doesn't explain nothing, it says its using accountOwnerId to find an inventory which is obvious.

this comment doesn't explain nothing, it says its using accountOwnerId to find an inventory which is obvious.
AngeloTadeucci commented 2023-06-03 17:43:49 -07:00 (Migrated from github.com)
Review

that's why you check before so you dont two undefined checks

that's why you check before so you dont two undefined checks
OrdisPrime commented 2023-06-03 17:44:53 -07:00 (Migrated from github.com)
Review

it explains a lot.

I added the field accountOwnerId and everyone who knows the inventory structure would know the field is not originally there.

The purpose of the field is explained: it exists to find an account's corresponding inventory.

it explains a lot. I added the field accountOwnerId and everyone who knows the inventory structure would know the field is not originally there. The purpose of the field is explained: it exists to find an account's corresponding inventory.
OrdisPrime commented 2023-06-03 17:46:46 -07:00 (Migrated from github.com)
Review

good suggestion!

good suggestion!
OrdisPrime commented 2023-06-03 17:46:59 -07:00 (Migrated from github.com)
Review

I understand now what you mean

I understand now what you mean
AngeloTadeucci commented 2023-06-03 17:49:04 -07:00 (Migrated from github.com)
Review

should that belong then inside inventoryModel.ts?

should that belong then inside inventoryModel.ts?
AngeloTadeucci commented 2023-06-03 17:26:15 -07:00 (Migrated from github.com)
Review

i dont think the comment is necessary

    const inventory = await Inventory.findOne({ accountOwnerId: accountId });
i dont think the comment is necessary ```suggestion const inventory = await Inventory.findOne({ accountOwnerId: accountId }); ```
AngeloTadeucci commented 2023-06-03 17:26:58 -07:00 (Migrated from github.com)
Review

check if inventory is undefined before trying toJson()

check if inventory is undefined before trying `toJson()`
OrdisPrime commented 2023-06-03 17:39:50 -07:00 (Migrated from github.com)
Review

it is important, because it is not present in the original response.

it is important, because it is not present in the original response.
OrdisPrime commented 2023-06-03 17:40:09 -07:00 (Migrated from github.com)
Review

?. checks for undefined!

?. checks for undefined!
AngeloTadeucci commented 2023-06-03 17:43:01 -07:00 (Migrated from github.com)
Review

this comment doesn't explain nothing, it says its using accountOwnerId to find an inventory which is obvious.

this comment doesn't explain nothing, it says its using accountOwnerId to find an inventory which is obvious.
AngeloTadeucci commented 2023-06-03 17:43:49 -07:00 (Migrated from github.com)
Review

that's why you check before so you dont two undefined checks

that's why you check before so you dont two undefined checks
OrdisPrime commented 2023-06-03 17:44:53 -07:00 (Migrated from github.com)
Review

it explains a lot.

I added the field accountOwnerId and everyone who knows the inventory structure would know the field is not originally there.

The purpose of the field is explained: it exists to find an account's corresponding inventory.

it explains a lot. I added the field accountOwnerId and everyone who knows the inventory structure would know the field is not originally there. The purpose of the field is explained: it exists to find an account's corresponding inventory.
OrdisPrime commented 2023-06-03 17:46:46 -07:00 (Migrated from github.com)
Review

good suggestion!

good suggestion!
OrdisPrime commented 2023-06-03 17:46:59 -07:00 (Migrated from github.com)
Review

I understand now what you mean

I understand now what you mean
AngeloTadeucci commented 2023-06-03 17:49:04 -07:00 (Migrated from github.com)
Review

should that belong then inside inventoryModel.ts?

should that belong then inside inventoryModel.ts?
response.status(400).json({ error: "inventory was undefined" }); response.status(400).json({ error: "inventory was undefined" });
return; return;
} }
const inventoryJSON = inventory.toJSON();
AngeloTadeucci commented 2023-06-03 17:26:15 -07:00 (Migrated from github.com)
Review

i dont think the comment is necessary

    const inventory = await Inventory.findOne({ accountOwnerId: accountId });
i dont think the comment is necessary ```suggestion const inventory = await Inventory.findOne({ accountOwnerId: accountId }); ```
AngeloTadeucci commented 2023-06-03 17:26:58 -07:00 (Migrated from github.com)
Review

check if inventory is undefined before trying toJson()

check if inventory is undefined before trying `toJson()`
OrdisPrime commented 2023-06-03 17:39:50 -07:00 (Migrated from github.com)
Review

it is important, because it is not present in the original response.

it is important, because it is not present in the original response.
OrdisPrime commented 2023-06-03 17:40:09 -07:00 (Migrated from github.com)
Review

?. checks for undefined!

?. checks for undefined!
AngeloTadeucci commented 2023-06-03 17:43:01 -07:00 (Migrated from github.com)
Review

this comment doesn't explain nothing, it says its using accountOwnerId to find an inventory which is obvious.

this comment doesn't explain nothing, it says its using accountOwnerId to find an inventory which is obvious.
AngeloTadeucci commented 2023-06-03 17:43:49 -07:00 (Migrated from github.com)
Review

that's why you check before so you dont two undefined checks

that's why you check before so you dont two undefined checks
OrdisPrime commented 2023-06-03 17:44:53 -07:00 (Migrated from github.com)
Review

it explains a lot.

I added the field accountOwnerId and everyone who knows the inventory structure would know the field is not originally there.

The purpose of the field is explained: it exists to find an account's corresponding inventory.

it explains a lot. I added the field accountOwnerId and everyone who knows the inventory structure would know the field is not originally there. The purpose of the field is explained: it exists to find an account's corresponding inventory.
OrdisPrime commented 2023-06-03 17:46:46 -07:00 (Migrated from github.com)
Review

good suggestion!

good suggestion!
OrdisPrime commented 2023-06-03 17:46:59 -07:00 (Migrated from github.com)
Review

I understand now what you mean

I understand now what you mean
AngeloTadeucci commented 2023-06-03 17:49:04 -07:00 (Migrated from github.com)
Review

should that belong then inside inventoryModel.ts?

should that belong then inside inventoryModel.ts?
AngeloTadeucci commented 2023-06-03 17:26:15 -07:00 (Migrated from github.com)
Review

i dont think the comment is necessary

    const inventory = await Inventory.findOne({ accountOwnerId: accountId });
i dont think the comment is necessary ```suggestion const inventory = await Inventory.findOne({ accountOwnerId: accountId }); ```
AngeloTadeucci commented 2023-06-03 17:26:58 -07:00 (Migrated from github.com)
Review

check if inventory is undefined before trying toJson()

check if inventory is undefined before trying `toJson()`
OrdisPrime commented 2023-06-03 17:39:50 -07:00 (Migrated from github.com)
Review

it is important, because it is not present in the original response.

it is important, because it is not present in the original response.
OrdisPrime commented 2023-06-03 17:40:09 -07:00 (Migrated from github.com)
Review

?. checks for undefined!

?. checks for undefined!
AngeloTadeucci commented 2023-06-03 17:43:01 -07:00 (Migrated from github.com)
Review

this comment doesn't explain nothing, it says its using accountOwnerId to find an inventory which is obvious.

this comment doesn't explain nothing, it says its using accountOwnerId to find an inventory which is obvious.
AngeloTadeucci commented 2023-06-03 17:43:49 -07:00 (Migrated from github.com)
Review

that's why you check before so you dont two undefined checks

that's why you check before so you dont two undefined checks
OrdisPrime commented 2023-06-03 17:44:53 -07:00 (Migrated from github.com)
Review

it explains a lot.

I added the field accountOwnerId and everyone who knows the inventory structure would know the field is not originally there.

The purpose of the field is explained: it exists to find an account's corresponding inventory.

it explains a lot. I added the field accountOwnerId and everyone who knows the inventory structure would know the field is not originally there. The purpose of the field is explained: it exists to find an account's corresponding inventory.
OrdisPrime commented 2023-06-03 17:46:46 -07:00 (Migrated from github.com)
Review

good suggestion!

good suggestion!
OrdisPrime commented 2023-06-03 17:46:59 -07:00 (Migrated from github.com)
Review

I understand now what you mean

I understand now what you mean
AngeloTadeucci commented 2023-06-03 17:49:04 -07:00 (Migrated from github.com)
Review

should that belong then inside inventoryModel.ts?

should that belong then inside inventoryModel.ts?
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);

AngeloTadeucci commented 2023-06-03 17:26:15 -07:00 (Migrated from github.com)
Review

i dont think the comment is necessary

    const inventory = await Inventory.findOne({ accountOwnerId: accountId });
i dont think the comment is necessary ```suggestion const inventory = await Inventory.findOne({ accountOwnerId: accountId }); ```
AngeloTadeucci commented 2023-06-03 17:26:15 -07:00 (Migrated from github.com)
Review

i dont think the comment is necessary

    const inventory = await Inventory.findOne({ accountOwnerId: accountId });
i dont think the comment is necessary ```suggestion const inventory = await Inventory.findOne({ accountOwnerId: accountId }); ```
AngeloTadeucci commented 2023-06-03 17:26:58 -07:00 (Migrated from github.com)
Review

check if inventory is undefined before trying toJson()

check if inventory is undefined before trying `toJson()`
AngeloTadeucci commented 2023-06-03 17:26:58 -07:00 (Migrated from github.com)
Review

check if inventory is undefined before trying toJson()

check if inventory is undefined before trying `toJson()`
OrdisPrime commented 2023-06-03 17:39:50 -07:00 (Migrated from github.com)
Review

it is important, because it is not present in the original response.

it is important, because it is not present in the original response.
OrdisPrime commented 2023-06-03 17:39:50 -07:00 (Migrated from github.com)
Review

it is important, because it is not present in the original response.

it is important, because it is not present in the original response.
OrdisPrime commented 2023-06-03 17:40:09 -07:00 (Migrated from github.com)
Review

?. checks for undefined!

?. checks for undefined!
OrdisPrime commented 2023-06-03 17:40:09 -07:00 (Migrated from github.com)
Review

?. checks for undefined!

?. checks for undefined!
AngeloTadeucci commented 2023-06-03 17:43:01 -07:00 (Migrated from github.com)
Review

this comment doesn't explain nothing, it says its using accountOwnerId to find an inventory which is obvious.

this comment doesn't explain nothing, it says its using accountOwnerId to find an inventory which is obvious.
AngeloTadeucci commented 2023-06-03 17:43:01 -07:00 (Migrated from github.com)
Review

this comment doesn't explain nothing, it says its using accountOwnerId to find an inventory which is obvious.

this comment doesn't explain nothing, it says its using accountOwnerId to find an inventory which is obvious.
AngeloTadeucci commented 2023-06-03 17:43:49 -07:00 (Migrated from github.com)
Review

that's why you check before so you dont two undefined checks

that's why you check before so you dont two undefined checks
AngeloTadeucci commented 2023-06-03 17:43:49 -07:00 (Migrated from github.com)
Review

that's why you check before so you dont two undefined checks

that's why you check before so you dont two undefined checks
OrdisPrime commented 2023-06-03 17:44:53 -07:00 (Migrated from github.com)
Review

it explains a lot.

I added the field accountOwnerId and everyone who knows the inventory structure would know the field is not originally there.

The purpose of the field is explained: it exists to find an account's corresponding inventory.

it explains a lot. I added the field accountOwnerId and everyone who knows the inventory structure would know the field is not originally there. The purpose of the field is explained: it exists to find an account's corresponding inventory.
OrdisPrime commented 2023-06-03 17:44:53 -07:00 (Migrated from github.com)
Review

it explains a lot.

I added the field accountOwnerId and everyone who knows the inventory structure would know the field is not originally there.

The purpose of the field is explained: it exists to find an account's corresponding inventory.

it explains a lot. I added the field accountOwnerId and everyone who knows the inventory structure would know the field is not originally there. The purpose of the field is explained: it exists to find an account's corresponding inventory.
OrdisPrime commented 2023-06-03 17:46:46 -07:00 (Migrated from github.com)
Review

good suggestion!

good suggestion!
OrdisPrime commented 2023-06-03 17:46:46 -07:00 (Migrated from github.com)
Review

good suggestion!

good suggestion!
OrdisPrime commented 2023-06-03 17:46:59 -07:00 (Migrated from github.com)
Review

I understand now what you mean

I understand now what you mean
OrdisPrime commented 2023-06-03 17:46:59 -07:00 (Migrated from github.com)
Review

I understand now what you mean

I understand now what you mean
AngeloTadeucci commented 2023-06-03 17:49:04 -07:00 (Migrated from github.com)
Review

should that belong then inside inventoryModel.ts?

should that belong then inside inventoryModel.ts?
AngeloTadeucci commented 2023-06-03 17:49:04 -07:00 (Migrated from github.com)
Review

should that belong then inside inventoryModel.ts?

should that belong then inside inventoryModel.ts?