Skip to content

Commit

Permalink
chore: npm audit fix (spaceninjaserver#579)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sainan authored Dec 19, 2024
1 parent 0dd9839 commit 259bfa1
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 35 deletions.
54 changes: 27 additions & 27 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/controllers/api/inventoryController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { config } from "@/src/services/configService";
import allDialogue from "@/static/fixed_responses/allDialogue.json";
import allMissions from "@/static/fixed_responses/allMissions.json";
import { ILoadoutDatabase } from "@/src/types/saveLoadoutTypes";
import { IInventoryDatabase, IShipInventory, equipmentKeys } from "@/src/types/inventoryTypes/inventoryTypes";
import { IShipInventory, equipmentKeys } from "@/src/types/inventoryTypes/inventoryTypes";
import { IPolarity, ArtifactPolarity } from "@/src/types/inventoryTypes/commonInventoryTypes";
import { ExportCustoms, ExportFlavour, ExportKeys, ExportResources } from "warframe-public-export-plus";

Expand All @@ -30,7 +30,7 @@ const inventoryController: RequestHandler = async (request, response) => {
}

//TODO: make a function that converts from database representation to client
const inventoryJSON: IInventoryDatabase = inventory.toJSON();
const inventoryJSON = inventory.toJSON();

const inventoryResponse = toInventoryResponse(inventoryJSON);

Expand Down
4 changes: 2 additions & 2 deletions src/helpers/inventoryHelpers.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { IOid } from "@/src/types/commonTypes";
import { IInventoryDatabase, IInventoryResponse } from "@/src/types/inventoryTypes/inventoryTypes";
import { IInventoryResponse } from "@/src/types/inventoryTypes/inventoryTypes";
import { Types } from "mongoose";

//TODO: this needs to be addressed: a schema's toJSON is responsible for changing Oid and Date to their corresponding Response versions __id to "ItemId":{"$oid":"6450f720bc562ebf030222d4"}, and a Date to "date":{"$date":{"$numberLong":"unix timestamp"})
export const toInventoryResponse = (inventoryDatabase: IInventoryDatabase): IInventoryResponse => {
export const toInventoryResponse = (inventoryDatabase: { accountOwnerId: Types.ObjectId }): IInventoryResponse => {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { accountOwnerId, ...inventoryResponse } = inventoryDatabase;
return inventoryResponse as unknown as IInventoryResponse;
Expand Down
6 changes: 3 additions & 3 deletions src/services/inventoryService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ export const addPowerSuit = async (powersuitName: string, accountId: string): Pr
const inventory = await getInventory(accountId);
const suitIndex = inventory.Suits.push({ ItemType: powersuitName, Configs: [], UpgradeVer: 101, XP: 0 });
const changedInventory = await inventory.save();
return changedInventory.Suits[suitIndex - 1].toJSON();
return changedInventory.Suits[suitIndex - 1].toJSON() as object as IEquipmentClient;
};

export const addMechSuit = async (mechsuitName: string, accountId: string) => {
Expand Down Expand Up @@ -527,7 +527,7 @@ export const addEquipment = async (
});

const changedInventory = await inventory.save();
return changedInventory[category][index - 1].toJSON();
return changedInventory[category][index - 1].toJSON() as object as IEquipmentClient;
};

export const addCustomization = async (customizatonName: string, accountId: string): Promise<IFlavourItem> => {
Expand All @@ -541,7 +541,7 @@ export const addSkin = async (typeName: string, accountId: string): Promise<IWea
const inventory = await getInventory(accountId);
const index = inventory.WeaponSkins.push({ ItemType: typeName }) - 1;
const changedInventory = await inventory.save();
return changedInventory.WeaponSkins[index].toJSON();
return changedInventory.WeaponSkins[index].toJSON() as object as IWeaponSkinClient;
};

const addGearExpByCategory = (
Expand Down
3 changes: 2 additions & 1 deletion src/types/shipTypes.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { Schema, Types } from "mongoose";
import { IOid } from "@/src/types/commonTypes";
import { IColor } from "@/src/types/inventoryTypes/commonInventoryTypes";
import { ILoadoutClient } from "./saveLoadoutTypes";

export interface IGetShipResponse {
ShipOwnerId: string;
Ship: IShip;
Apartment: IApartment;
LoadOutInventory: { LoadOutPresets: Types.ObjectId };
LoadOutInventory: { LoadOutPresets: ILoadoutClient };
}

export interface IShipAttachments {
Expand Down

0 comments on commit 259bfa1

Please sign in to comment.