Add Ship #13

Merged
orzMaster merged 2 commits from main into main 2023-06-04 13:16:50 -07:00
orzMaster commented 2023-06-04 10:23:22 -07:00 (Migrated from github.com)
No description provided.
AngeloTadeucci (Migrated from github.com) requested changes 2023-06-04 13:10:39 -07:00
@ -1,6 +1,7 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { Document, Types } from "mongoose";
import { Oid } from "./commonTypes";
AngeloTadeucci (Migrated from github.com) commented 2023-06-04 13:09:09 -07:00

Please use non-relative imports everywhere

Please use non-relative imports everywhere
OrdisPrime (Migrated from github.com) reviewed 2023-06-04 13:12:40 -07:00
@ -6,0 +8,4 @@
const accountId = _req.query.accountId;
const ship = await Ship.findOne({ ShipOwnerId: accountId });
if (!ship) {
const account = await Account.findOne({ _id: accountId });
OrdisPrime (Migrated from github.com) commented 2023-06-04 10:33:23 -07:00

_variableName is only used to disable the eslint warning "unused variables".

Once you use a variable, remove the _

_variableName is only used to disable the eslint warning "unused variables". Once you use a variable, remove the _
@ -6,0 +10,4 @@
if (!ship) {
const account = await Account.findOne({ _id: accountId });
if (account) {
await createShip(account._id);
OrdisPrime (Migrated from github.com) commented 2023-06-04 10:37:28 -07:00

Oh I saw, you added the new ship at createAccount() already. very nice.

Then the logic for !getShip should not be needed. You can just remove all that is related to creating a new Ship here, because it should never happen that for an account there is no ship

Oh I saw, you added the new ship at createAccount() already. very nice. Then the logic for !getShip should not be needed. You can just remove all that is related to creating a new Ship here, because it should never happen that for an account there is no ship
@ -0,0 +8,4 @@
await ship.save();
} catch (error) {
if (error instanceof Error) {
throw new Error(`error creating inventory" ${error.message}`);
OrdisPrime (Migrated from github.com) commented 2023-06-04 10:38:47 -07:00

error creating Ship! not inventory.

error creating Ship! not inventory.
@ -0,0 +1,33 @@
{
"ShipOwnerId": "removed",
OrdisPrime (Migrated from github.com) commented 2023-06-04 10:48:12 -07:00

this field can be removed, as we add it here:
const ship = new Ship({ ...new_ship, ShipOwnerId: accountOwnerId });

this field can be removed, as we add it here: const ship = new Ship({ ...new_ship, ShipOwnerId: accountOwnerId });
Sign in to join this conversation.
No description provided.