feat: import #831
@ -44,7 +44,7 @@ export const arcaneCommonController: RequestHandler = async (req, res) => {
|
|||||||
ItemType: json.arcane.ItemType,
|
ItemType: json.arcane.ItemType,
|
||||||
UpgradeFingerprint: JSON.stringify({ lvl: json.newRank })
|
UpgradeFingerprint: JSON.stringify({ lvl: json.newRank })
|
||||||
});
|
});
|
||||||
upgradeId = inventory.Upgrades[newLength - 1]._id!.toString();
|
upgradeId = inventory.Upgrades[newLength - 1]._id.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove RawUpgrades
|
// Remove RawUpgrades
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { getJSONfromString } from "@/src/helpers/stringHelpers";
|
import { getJSONfromString } from "@/src/helpers/stringHelpers";
|
||||||
import { getAccountIdForRequest } from "@/src/services/loginService";
|
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||||
import { RequestHandler } from "express";
|
import { RequestHandler } from "express";
|
||||||
import { ICrewShipSalvagedWeaponSkin } from "@/src/types/inventoryTypes/inventoryTypes";
|
import { IInventoryClient, IUpgradeClient } from "@/src/types/inventoryTypes/inventoryTypes";
|
||||||
import { addMods, getInventory } from "@/src/services/inventoryService";
|
import { addMods, getInventory } from "@/src/services/inventoryService";
|
||||||
import { config } from "@/src/services/configService";
|
import { config } from "@/src/services/configService";
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ export const artifactsController: RequestHandler = async (req, res) => {
|
|||||||
parsedUpgradeFingerprint.lvl += LevelDiff;
|
parsedUpgradeFingerprint.lvl += LevelDiff;
|
||||||
const stringifiedUpgradeFingerprint = JSON.stringify(parsedUpgradeFingerprint);
|
const stringifiedUpgradeFingerprint = JSON.stringify(parsedUpgradeFingerprint);
|
||||||
|
|
||||||
let itemIndex = Upgrades.findIndex(upgrade => upgrade._id?.equals(ItemId!.$oid));
|
let itemIndex = Upgrades.findIndex(upgrade => upgrade._id.equals(ItemId.$oid));
|
||||||
|
|
||||||
if (itemIndex !== -1) {
|
if (itemIndex !== -1) {
|
||||||
Upgrades[itemIndex].UpgradeFingerprint = stringifiedUpgradeFingerprint;
|
Upgrades[itemIndex].UpgradeFingerprint = stringifiedUpgradeFingerprint;
|
||||||
@ -58,7 +58,7 @@ export const artifactsController: RequestHandler = async (req, res) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const changedInventory = await inventory.save();
|
const changedInventory = await inventory.save();
|
||||||
const itemId = changedInventory.toJSON().Upgrades[itemIndex]?.ItemId?.$oid;
|
const itemId = changedInventory.toJSON<IInventoryClient>().Upgrades[itemIndex].ItemId.$oid;
|
||||||
|
|
||||||
if (!itemId) {
|
if (!itemId) {
|
||||||
throw new Error("Item Id not found in upgradeMod");
|
throw new Error("Item Id not found in upgradeMod");
|
||||||
@ -68,7 +68,7 @@ export const artifactsController: RequestHandler = async (req, res) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
interface IArtifactsRequest {
|
interface IArtifactsRequest {
|
||||||
Upgrade: ICrewShipSalvagedWeaponSkin;
|
Upgrade: IUpgradeClient;
|
||||||
LevelDiff: number;
|
LevelDiff: number;
|
||||||
Cost: number;
|
Cost: number;
|
||||||
FusionPointCost: number;
|
FusionPointCost: number;
|
||||||
|
@ -4,10 +4,10 @@ import allShipFeatures from "@/static/fixed_responses/allShipFeatures.json";
|
|||||||
import { getAccountIdForRequest } from "@/src/services/loginService";
|
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||||
import { getPersonalRooms } from "@/src/services/personalRoomsService";
|
import { getPersonalRooms } from "@/src/services/personalRoomsService";
|
||||||
import { getShip } from "@/src/services/shipService";
|
import { getShip } from "@/src/services/shipService";
|
||||||
import { Loadout } from "@/src/models/inventoryModels/loadoutModel";
|
|
||||||
import { toOid } from "@/src/helpers/inventoryHelpers";
|
import { toOid } from "@/src/helpers/inventoryHelpers";
|
||||||
import { IGetShipResponse } from "@/src/types/shipTypes";
|
import { IGetShipResponse } from "@/src/types/shipTypes";
|
||||||
import { IPersonalRooms } from "@/src/types/personalRoomsTypes";
|
import { IPersonalRooms } from "@/src/types/personalRoomsTypes";
|
||||||
|
import { getLoadout } from "@/src/services/loadoutService";
|
||||||
|
|
||||||
export const getShipController: RequestHandler = async (req, res) => {
|
export const getShipController: RequestHandler = async (req, res) => {
|
||||||
const accountId = await getAccountIdForRequest(req);
|
const accountId = await getAccountIdForRequest(req);
|
||||||
@ -38,13 +38,3 @@ export const getShipController: RequestHandler = async (req, res) => {
|
|||||||
|
|
||||||
res.json(getShipResponse);
|
res.json(getShipResponse);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getLoadout = async (accountId: string) => {
|
|
||||||
const loadout = await Loadout.findOne({ loadoutOwnerId: accountId });
|
|
||||||
|
|
||||||
if (!loadout) {
|
|
||||||
throw new Error(`loadout not found for account ${accountId}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
return loadout;
|
|
||||||
};
|
|
||||||
|
@ -6,7 +6,7 @@ import { IOid } from "@/src/types/commonTypes";
|
|||||||
import {
|
import {
|
||||||
IConsumedSuit,
|
IConsumedSuit,
|
||||||
IHelminthFoodRecord,
|
IHelminthFoodRecord,
|
||||||
IInfestedFoundry,
|
IInfestedFoundryDatabase,
|
||||||
IMiscItem,
|
IMiscItem,
|
||||||
ITypeCount
|
ITypeCount
|
||||||
} from "@/src/types/inventoryTypes/inventoryTypes";
|
} from "@/src/types/inventoryTypes/inventoryTypes";
|
||||||
@ -356,7 +356,7 @@ interface IHelminthFeedRequest {
|
|||||||
}[];
|
}[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export const addInfestedFoundryXP = (infestedFoundry: IInfestedFoundry, delta: number): ITypeCount[] => {
|
export const addInfestedFoundryXP = (infestedFoundry: IInfestedFoundryDatabase, delta: number): ITypeCount[] => {
|
||||||
const recipeChanges: ITypeCount[] = [];
|
const recipeChanges: ITypeCount[] = [];
|
||||||
infestedFoundry.XP ??= 0;
|
infestedFoundry.XP ??= 0;
|
||||||
const prevXP = infestedFoundry.XP;
|
const prevXP = infestedFoundry.XP;
|
||||||
|
@ -4,7 +4,7 @@ import { Inventory } from "@/src/models/inventoryModels/inventoryModel";
|
|||||||
import { config } from "@/src/services/configService";
|
import { config } from "@/src/services/configService";
|
||||||
import allDialogue from "@/static/fixed_responses/allDialogue.json";
|
import allDialogue from "@/static/fixed_responses/allDialogue.json";
|
||||||
import { ILoadoutDatabase } from "@/src/types/saveLoadoutTypes";
|
import { ILoadoutDatabase } from "@/src/types/saveLoadoutTypes";
|
||||||
import { IInventoryResponse, IShipInventory, equipmentKeys } from "@/src/types/inventoryTypes/inventoryTypes";
|
import { IInventoryClient, IShipInventory, equipmentKeys } from "@/src/types/inventoryTypes/inventoryTypes";
|
||||||
import { IPolarity, ArtifactPolarity, EquipmentFeatures } from "@/src/types/inventoryTypes/commonInventoryTypes";
|
import { IPolarity, ArtifactPolarity, EquipmentFeatures } from "@/src/types/inventoryTypes/commonInventoryTypes";
|
||||||
import {
|
import {
|
||||||
ExportCustoms,
|
ExportCustoms,
|
||||||
@ -55,7 +55,7 @@ export const inventoryController: RequestHandler = async (request, response) =>
|
|||||||
const inventoryWithLoadOutPresetsAndShips = await inventoryWithLoadOutPresets.populate<{ Ships: IShipInventory }>(
|
const inventoryWithLoadOutPresetsAndShips = await inventoryWithLoadOutPresets.populate<{ Ships: IShipInventory }>(
|
||||||
"Ships"
|
"Ships"
|
||||||
);
|
);
|
||||||
const inventoryResponse = inventoryWithLoadOutPresetsAndShips.toJSON<IInventoryResponse>();
|
const inventoryResponse = inventoryWithLoadOutPresetsAndShips.toJSON<IInventoryClient>();
|
||||||
|
|
||||||
if (config.infiniteCredits) {
|
if (config.infiniteCredits) {
|
||||||
inventoryResponse.RegularCredits = 999999999;
|
inventoryResponse.RegularCredits = 999999999;
|
||||||
@ -147,8 +147,9 @@ export const inventoryController: RequestHandler = async (request, response) =>
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (config.unlockAllSkins) {
|
if (config.unlockAllSkins) {
|
||||||
inventoryResponse.WeaponSkins = [];
|
const missingWeaponSkins = new Set(Object.keys(ExportCustoms));
|
||||||
for (const uniqueName in ExportCustoms) {
|
inventoryResponse.WeaponSkins.forEach(x => missingWeaponSkins.delete(x.ItemType));
|
||||||
|
for (const uniqueName of missingWeaponSkins) {
|
||||||
inventoryResponse.WeaponSkins.push({
|
inventoryResponse.WeaponSkins.push({
|
||||||
ItemId: {
|
ItemId: {
|
||||||
$oid: "ca70ca70ca70ca70" + catBreadHash(uniqueName).toString(16).padStart(8, "0")
|
$oid: "ca70ca70ca70ca70" + catBreadHash(uniqueName).toString(16).padStart(8, "0")
|
||||||
|
@ -6,7 +6,7 @@ import {
|
|||||||
EquipmentFeatures,
|
EquipmentFeatures,
|
||||||
IAbilityOverride
|
IAbilityOverride
|
||||||
} from "@/src/types/inventoryTypes/commonInventoryTypes";
|
} from "@/src/types/inventoryTypes/commonInventoryTypes";
|
||||||
import { IMiscItem } from "@/src/types/inventoryTypes/inventoryTypes";
|
import { IInventoryClient, IMiscItem } from "@/src/types/inventoryTypes/inventoryTypes";
|
||||||
import { getAccountIdForRequest } from "@/src/services/loginService";
|
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||||
import { addMiscItems, addRecipes, getInventory, updateCurrency } from "@/src/services/inventoryService";
|
import { addMiscItems, addRecipes, getInventory, updateCurrency } from "@/src/services/inventoryService";
|
||||||
import { getRecipeByResult } from "@/src/services/itemDataService";
|
import { getRecipeByResult } from "@/src/services/itemDataService";
|
||||||
@ -62,7 +62,7 @@ export const upgradesController: RequestHandler = async (req, res) => {
|
|||||||
addRecipes(inventory, recipeChanges);
|
addRecipes(inventory, recipeChanges);
|
||||||
|
|
||||||
inventoryChanges.Recipes = recipeChanges;
|
inventoryChanges.Recipes = recipeChanges;
|
||||||
inventoryChanges.InfestedFoundry = inventory.toJSON().InfestedFoundry;
|
inventoryChanges.InfestedFoundry = inventory.toJSON<IInventoryClient>().InfestedFoundry;
|
||||||
} else
|
} else
|
||||||
switch (operation.UpgradeRequirement) {
|
switch (operation.UpgradeRequirement) {
|
||||||
case "/Lotus/Types/Items/MiscItems/OrokinReactor":
|
case "/Lotus/Types/Items/MiscItems/OrokinReactor":
|
||||||
|
@ -2,6 +2,7 @@ import { RequestHandler } from "express";
|
|||||||
import { getDict, getItemName, getString } from "@/src/services/itemDataService";
|
import { getDict, getItemName, getString } from "@/src/services/itemDataService";
|
||||||
import {
|
import {
|
||||||
ExportArcanes,
|
ExportArcanes,
|
||||||
|
ExportAvionics,
|
||||||
ExportGear,
|
ExportGear,
|
||||||
ExportRecipes,
|
ExportRecipes,
|
||||||
ExportResources,
|
ExportResources,
|
||||||
@ -137,6 +138,13 @@ const getItemListsController: RequestHandler = (req, response) => {
|
|||||||
badItems[uniqueName] = true;
|
badItems[uniqueName] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (const [uniqueName, upgrade] of Object.entries(ExportAvionics)) {
|
||||||
|
res.mods.push({
|
||||||
|
uniqueName,
|
||||||
|
name: getString(upgrade.name, lang),
|
||||||
|
fusionLimit: upgrade.fusionLimit
|
||||||
|
});
|
||||||
|
}
|
||||||
for (const [uniqueName, arcane] of Object.entries(ExportArcanes)) {
|
for (const [uniqueName, arcane] of Object.entries(ExportArcanes)) {
|
||||||
res.mods.push({
|
res.mods.push({
|
||||||
uniqueName,
|
uniqueName,
|
||||||
|
27
src/controllers/custom/importController.ts
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
import { importInventory, importLoadOutPresets } from "@/src/services/importService";
|
||||||
|
import { getInventory } from "@/src/services/inventoryService";
|
||||||
|
import { getLoadout } from "@/src/services/loadoutService";
|
||||||
|
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||||
|
import { IInventoryClient } from "@/src/types/inventoryTypes/inventoryTypes";
|
||||||
|
import { RequestHandler } from "express";
|
||||||
|
|
||||||
|
export const importController: RequestHandler = async (req, res) => {
|
||||||
|
const accountId = await getAccountIdForRequest(req);
|
||||||
|
const request = JSON.parse(String(req.body)) as IImportRequest;
|
||||||
|
|||||||
|
|
||||||
|
const inventory = await getInventory(accountId);
|
||||||
|
importInventory(inventory, request.inventory);
|
||||||
|
await inventory.save();
|
||||||
![]() 🛠️ Refactor suggestion Implement error handling during import Operations like Wrap the import operations in a try-catch block and handle errors appropriately:
_:hammer_and_wrench: Refactor suggestion_
**Implement error handling during import**
Operations like `importInventory` and `inventory.save()` can fail. Without error handling, any failures won't be communicated back to the client, and the server might crash due to unhandled exceptions.
Wrap the import operations in a try-catch block and handle errors appropriately:
```diff
+ try {
const inventory = await getInventory(accountId);
importInventory(inventory, request.inventory);
await inventory.save();
+ } catch (error) {
+ res.status(500).json({ error: 'Failed to import inventory' });
+ return;
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
|
||||||
|
if (request.inventory.LoadOutPresets) {
|
||||||
|
const loadout = await getLoadout(accountId);
|
||||||
|
importLoadOutPresets(loadout, request.inventory.LoadOutPresets);
|
||||||
|
await loadout.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
res.end();
|
||||||
|
};
|
||||||
|
|
||||||
|
interface IImportRequest {
|
||||||
|
inventory: Partial<IInventoryClient>;
|
||||||
|
}
|
@ -2,11 +2,10 @@ import { Document, Model, Schema, Types, model } from "mongoose";
|
|||||||
import {
|
import {
|
||||||
IFlavourItem,
|
IFlavourItem,
|
||||||
IRawUpgrade,
|
IRawUpgrade,
|
||||||
ICrewShipSalvagedWeaponSkin,
|
|
||||||
IMiscItem,
|
IMiscItem,
|
||||||
IInventoryDatabase,
|
IInventoryDatabase,
|
||||||
IBooster,
|
IBooster,
|
||||||
IInventoryResponse,
|
IInventoryClient,
|
||||||
ISlots,
|
ISlots,
|
||||||
IMailbox,
|
IMailbox,
|
||||||
IDuviriInfo,
|
IDuviriInfo,
|
||||||
@ -14,7 +13,7 @@ import {
|
|||||||
IPendingRecipeResponse,
|
IPendingRecipeResponse,
|
||||||
ITypeCount,
|
ITypeCount,
|
||||||
IFocusXP,
|
IFocusXP,
|
||||||
IFocusUpgrades,
|
IFocusUpgrade,
|
||||||
ITypeXPItem,
|
ITypeXPItem,
|
||||||
IChallengeProgress,
|
IChallengeProgress,
|
||||||
IStepSequencer,
|
IStepSequencer,
|
||||||
@ -24,7 +23,7 @@ import {
|
|||||||
ISeasonChallenge,
|
ISeasonChallenge,
|
||||||
IPlayerSkills,
|
IPlayerSkills,
|
||||||
ISettings,
|
ISettings,
|
||||||
IInfestedFoundry,
|
IInfestedFoundryDatabase,
|
||||||
IHelminthResource,
|
IHelminthResource,
|
||||||
IConsumedSuit,
|
IConsumedSuit,
|
||||||
IQuestProgress,
|
IQuestProgress,
|
||||||
@ -43,7 +42,6 @@ import {
|
|||||||
ICrewShipCustomization,
|
ICrewShipCustomization,
|
||||||
ICrewShipWeapon,
|
ICrewShipWeapon,
|
||||||
ICrewShipMembersClient,
|
ICrewShipMembersClient,
|
||||||
ICrewShip,
|
|
||||||
ICrewShipPilotWeapon,
|
ICrewShipPilotWeapon,
|
||||||
IShipExterior,
|
IShipExterior,
|
||||||
IHelminthFoodRecord,
|
IHelminthFoodRecord,
|
||||||
@ -52,7 +50,9 @@ import {
|
|||||||
IDialogueDatabase,
|
IDialogueDatabase,
|
||||||
IDialogueGift,
|
IDialogueGift,
|
||||||
ICompletedDialogue,
|
ICompletedDialogue,
|
||||||
IDialogueClient
|
IDialogueClient,
|
||||||
|
IUpgradeDatabase,
|
||||||
|
ICrewShipDatabase
|
||||||
} from "../../types/inventoryTypes/inventoryTypes";
|
} from "../../types/inventoryTypes/inventoryTypes";
|
||||||
import { IOid } from "../../types/commonTypes";
|
import { IOid } from "../../types/commonTypes";
|
||||||
import {
|
import {
|
||||||
@ -62,7 +62,6 @@ import {
|
|||||||
IOperatorConfigDatabase,
|
IOperatorConfigDatabase,
|
||||||
IPolarity,
|
IPolarity,
|
||||||
IEquipmentDatabase,
|
IEquipmentDatabase,
|
||||||
IOperatorConfigClient,
|
|
||||||
IArchonCrystalUpgrade
|
IArchonCrystalUpgrade
|
||||||
} from "@/src/types/inventoryTypes/commonInventoryTypes";
|
} from "@/src/types/inventoryTypes/commonInventoryTypes";
|
||||||
import { toMongoDate, toOid } from "@/src/helpers/inventoryHelpers";
|
import { toMongoDate, toOid } from "@/src/helpers/inventoryHelpers";
|
||||||
@ -81,7 +80,7 @@ const focusXPSchema = new Schema<IFocusXP>(
|
|||||||
{ _id: false }
|
{ _id: false }
|
||||||
);
|
);
|
||||||
|
|
||||||
const focusUpgradesSchema = new Schema<IFocusUpgrades>(
|
const focusUpgradeSchema = new Schema<IFocusUpgrade>(
|
||||||
{
|
{
|
||||||
ItemType: String,
|
ItemType: String,
|
||||||
Level: Number,
|
Level: Number,
|
||||||
@ -288,7 +287,7 @@ RawUpgrades.set("toJSON", {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const upgradesSchema = new Schema<ICrewShipSalvagedWeaponSkin>(
|
const upgradeSchema = new Schema<IUpgradeDatabase>(
|
||||||
{
|
{
|
||||||
UpgradeFingerprint: String,
|
UpgradeFingerprint: String,
|
||||||
PendingRerollFingerprint: { type: String, required: false },
|
PendingRerollFingerprint: { type: String, required: false },
|
||||||
@ -297,11 +296,11 @@ const upgradesSchema = new Schema<ICrewShipSalvagedWeaponSkin>(
|
|||||||
{ id: false }
|
{ id: false }
|
||||||
);
|
);
|
||||||
|
|
||||||
upgradesSchema.virtual("ItemId").get(function () {
|
upgradeSchema.virtual("ItemId").get(function () {
|
||||||
return toOid(this._id);
|
return toOid(this._id);
|
||||||
});
|
});
|
||||||
|
|
||||||
upgradesSchema.set("toJSON", {
|
upgradeSchema.set("toJSON", {
|
||||||
virtuals: true,
|
virtuals: true,
|
||||||
transform(_document, returnedObject) {
|
transform(_document, returnedObject) {
|
||||||
delete returnedObject._id;
|
delete returnedObject._id;
|
||||||
@ -493,7 +492,7 @@ const helminthResourceSchema = new Schema<IHelminthResource>(
|
|||||||
{ _id: false }
|
{ _id: false }
|
||||||
);
|
);
|
||||||
|
|
||||||
const infestedFoundrySchema = new Schema<IInfestedFoundry>(
|
const infestedFoundrySchema = new Schema<IInfestedFoundryDatabase>(
|
||||||
{
|
{
|
||||||
Name: String,
|
Name: String,
|
||||||
Resources: { type: [helminthResourceSchema], default: undefined },
|
Resources: { type: [helminthResourceSchema], default: undefined },
|
||||||
@ -695,7 +694,7 @@ crewShipMembersSchema.set("toJSON", {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const crewShipSchema = new Schema<ICrewShip>({
|
const crewShipSchema = new Schema<ICrewShipDatabase>({
|
||||||
ItemType: { type: String, required: true },
|
ItemType: { type: String, required: true },
|
||||||
Configs: { type: [ItemConfigSchema], default: [] },
|
Configs: { type: [ItemConfigSchema], default: [] },
|
||||||
Weapon: { type: crewShipWeaponSchema, default: undefined },
|
Weapon: { type: crewShipWeaponSchema, default: undefined },
|
||||||
@ -837,7 +836,7 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
|
|||||||
//Curent active like Active school focuses is = "Zenurik"
|
//Curent active like Active school focuses is = "Zenurik"
|
||||||
FocusAbility: String,
|
FocusAbility: String,
|
||||||
//The treeways of the Focus school.(Active and passive Ability)
|
//The treeways of the Focus school.(Active and passive Ability)
|
||||||
FocusUpgrades: [focusUpgradesSchema],
|
FocusUpgrades: [focusUpgradeSchema],
|
||||||
|
|
||||||
//Achievement
|
//Achievement
|
||||||
ChallengeProgress: [challengeProgressSchema],
|
ChallengeProgress: [challengeProgressSchema],
|
||||||
@ -848,7 +847,7 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
|
|||||||
//Non Upgrade Mods Example:I have 999 item WeaponElectricityDamageMod (only "ItemCount"+"ItemType")
|
//Non Upgrade Mods Example:I have 999 item WeaponElectricityDamageMod (only "ItemCount"+"ItemType")
|
||||||
RawUpgrades: [RawUpgrades],
|
RawUpgrades: [RawUpgrades],
|
||||||
//Upgrade Mods\Riven\Arcane Example:"UpgradeFingerprint"+"ItemType"+""
|
//Upgrade Mods\Riven\Arcane Example:"UpgradeFingerprint"+"ItemType"+""
|
||||||
Upgrades: [upgradesSchema],
|
Upgrades: [upgradeSchema],
|
||||||
|
|
||||||
//Warframe
|
//Warframe
|
||||||
Suits: [EquipmentSchema],
|
Suits: [EquipmentSchema],
|
||||||
@ -1142,7 +1141,7 @@ inventorySchema.set("toJSON", {
|
|||||||
delete returnedObject.accountOwnerId;
|
delete returnedObject.accountOwnerId;
|
||||||
|
|
||||||
const inventoryDatabase = returnedObject as IInventoryDatabase;
|
const inventoryDatabase = returnedObject as IInventoryDatabase;
|
||||||
const inventoryResponse = returnedObject as IInventoryResponse;
|
const inventoryResponse = returnedObject as IInventoryClient;
|
||||||
|
|
||||||
inventoryResponse.TrainingDate = toMongoDate(inventoryDatabase.TrainingDate);
|
inventoryResponse.TrainingDate = toMongoDate(inventoryDatabase.TrainingDate);
|
||||||
inventoryResponse.Created = toMongoDate(inventoryDatabase.Created);
|
inventoryResponse.Created = toMongoDate(inventoryDatabase.Created);
|
||||||
@ -1164,12 +1163,12 @@ type InventoryDocumentProps = {
|
|||||||
OperatorAmps: Types.DocumentArray<IEquipmentDatabase>;
|
OperatorAmps: Types.DocumentArray<IEquipmentDatabase>;
|
||||||
FlavourItems: Types.DocumentArray<IFlavourItem>;
|
FlavourItems: Types.DocumentArray<IFlavourItem>;
|
||||||
RawUpgrades: Types.DocumentArray<IRawUpgrade>;
|
RawUpgrades: Types.DocumentArray<IRawUpgrade>;
|
||||||
Upgrades: Types.DocumentArray<ICrewShipSalvagedWeaponSkin>;
|
Upgrades: Types.DocumentArray<IUpgradeDatabase>;
|
||||||
MiscItems: Types.DocumentArray<IMiscItem>;
|
MiscItems: Types.DocumentArray<IMiscItem>;
|
||||||
Boosters: Types.DocumentArray<IBooster>;
|
Boosters: Types.DocumentArray<IBooster>;
|
||||||
OperatorLoadOuts: Types.DocumentArray<IOperatorConfigClient>;
|
OperatorLoadOuts: Types.DocumentArray<IOperatorConfigDatabase>;
|
||||||
SpecialItems: Types.DocumentArray<IEquipmentDatabase>;
|
SpecialItems: Types.DocumentArray<IEquipmentDatabase>;
|
||||||
AdultOperatorLoadOuts: Types.DocumentArray<IOperatorConfigClient>; //TODO: this should still contain _id
|
AdultOperatorLoadOuts: Types.DocumentArray<IOperatorConfigDatabase>;
|
||||||
MechSuits: Types.DocumentArray<IEquipmentDatabase>;
|
MechSuits: Types.DocumentArray<IEquipmentDatabase>;
|
||||||
Scoops: Types.DocumentArray<IEquipmentDatabase>;
|
Scoops: Types.DocumentArray<IEquipmentDatabase>;
|
||||||
DataKnives: Types.DocumentArray<IEquipmentDatabase>;
|
DataKnives: Types.DocumentArray<IEquipmentDatabase>;
|
||||||
@ -1185,7 +1184,7 @@ type InventoryDocumentProps = {
|
|||||||
Hoverboards: Types.DocumentArray<IEquipmentDatabase>;
|
Hoverboards: Types.DocumentArray<IEquipmentDatabase>;
|
||||||
MoaPets: Types.DocumentArray<IEquipmentDatabase>;
|
MoaPets: Types.DocumentArray<IEquipmentDatabase>;
|
||||||
WeaponSkins: Types.DocumentArray<IWeaponSkinDatabase>;
|
WeaponSkins: Types.DocumentArray<IWeaponSkinDatabase>;
|
||||||
CrewShips: Types.DocumentArray<ICrewShip>;
|
CrewShips: Types.DocumentArray<ICrewShipDatabase>;
|
||||||
CrewShipHarnesses: Types.DocumentArray<IEquipmentDatabase>;
|
CrewShipHarnesses: Types.DocumentArray<IEquipmentDatabase>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ import { renameAccountController } from "@/src/controllers/custom/renameAccountC
|
|||||||
|
|
||||||
import { createAccountController } from "@/src/controllers/custom/createAccountController";
|
import { createAccountController } from "@/src/controllers/custom/createAccountController";
|
||||||
import { addItemsController } from "@/src/controllers/custom/addItemsController";
|
import { addItemsController } from "@/src/controllers/custom/addItemsController";
|
||||||
|
import { importController } from "@/src/controllers/custom/importController";
|
||||||
|
|
||||||
import { getConfigDataController } from "@/src/controllers/custom/getConfigDataController";
|
import { getConfigDataController } from "@/src/controllers/custom/getConfigDataController";
|
||||||
import { updateConfigDataController } from "@/src/controllers/custom/updateConfigDataController";
|
import { updateConfigDataController } from "@/src/controllers/custom/updateConfigDataController";
|
||||||
@ -24,6 +25,7 @@ customRouter.get("/renameAccount", renameAccountController);
|
|||||||
|
|
||||||
customRouter.post("/createAccount", createAccountController);
|
customRouter.post("/createAccount", createAccountController);
|
||||||
customRouter.post("/addItems", addItemsController);
|
customRouter.post("/addItems", addItemsController);
|
||||||
|
customRouter.post("/import", importController);
|
||||||
|
|
||||||
customRouter.get("/config", getConfigDataController);
|
customRouter.get("/config", getConfigDataController);
|
||||||
customRouter.post("/config", updateConfigDataController);
|
customRouter.post("/config", updateConfigDataController);
|
||||||
|
@ -34,6 +34,9 @@ webuiRouter.get("/webui/settings", (_req, res) => {
|
|||||||
webuiRouter.get("/webui/cheats", (_req, res) => {
|
webuiRouter.get("/webui/cheats", (_req, res) => {
|
||||||
res.sendFile(path.join(rootDir, "static/webui/index.html"));
|
res.sendFile(path.join(rootDir, "static/webui/index.html"));
|
||||||
});
|
});
|
||||||
|
webuiRouter.get("/webui/import", (_req, res) => {
|
||||||
|
res.sendFile(path.join(rootDir, "static/webui/index.html"));
|
||||||
|
});
|
||||||
|
|
||||||
// Serve static files
|
// Serve static files
|
||||||
webuiRouter.use("/webui", express.static(path.join(rootDir, "static/webui")));
|
webuiRouter.use("/webui", express.static(path.join(rootDir, "static/webui")));
|
||||||
|
247
src/services/importService.ts
Normal file
@ -0,0 +1,247 @@
|
|||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
import { Types } from "mongoose";
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
import {
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
IEquipmentClient,
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
IEquipmentDatabase,
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
IOperatorConfigClient,
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
IOperatorConfigDatabase
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
} from "../types/inventoryTypes/commonInventoryTypes";
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
import { IMongoDate } from "../types/commonTypes";
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
import {
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
equipmentKeys,
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
ICrewShipClient,
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
ICrewShipDatabase,
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
ICrewShipMembersClient,
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
ICrewShipMembersDatabase,
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
IDialogueClient,
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
IDialogueDatabase,
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
IDialogueHistoryClient,
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
IDialogueHistoryDatabase,
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
IInfestedFoundryClient,
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
IInfestedFoundryDatabase,
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
IInventoryClient,
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
ILoadoutConfigClient,
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
ILoadOutPresets,
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
ISlots,
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
IUpgradeClient,
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
IUpgradeDatabase,
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
IWeaponSkinClient,
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
IWeaponSkinDatabase
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
} from "../types/inventoryTypes/inventoryTypes";
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
import { TInventoryDatabaseDocument } from "../models/inventoryModels/inventoryModel";
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
import { ILoadoutConfigDatabase, ILoadoutDatabase } from "../types/saveLoadoutTypes";
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
const convertDate = (value: IMongoDate): Date => {
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
return new Date(parseInt(value.$date.$numberLong));
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
};
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
const convertOptionalDate = (value: IMongoDate | undefined): Date | undefined => {
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
return value ? convertDate(value) : undefined;
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
};
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
const convertEquipment = (client: IEquipmentClient): IEquipmentDatabase => {
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
const { ItemId, ...rest } = client;
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
return {
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
...rest,
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
_id: new Types.ObjectId(ItemId.$oid),
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
![]() ⚠️ Potential issue Add validation for In the Apply this diff to add validation:
_:warning: Potential issue_
**Add validation for `ItemId.$oid` before creating `ObjectId` in `convertEquipment`**
In the `convertEquipment` function, if `ItemId` or `ItemId.$oid` is undefined or not a valid ObjectId, creating a new `ObjectId` could result in a runtime exception. It's important to add validation to ensure `ItemId.$oid` exists and is valid before proceeding.
Apply this diff to add validation:
```diff
const convertEquipment = (client: IEquipmentClient): IEquipmentDatabase => {
const { ItemId, ...rest } = client;
+ if (!ItemId || !ItemId.$oid || !Types.ObjectId.isValid(ItemId.$oid)) {
+ throw new Error('Invalid ItemId');
+ }
return {
...rest,
_id: new Types.ObjectId(ItemId.$oid),
InfestationDate: convertOptionalDate(client.InfestationDate),
Expiry: convertOptionalDate(client.Expiry),
UpgradesExpiry: convertOptionalDate(client.UpgradesExpiry)
};
};
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
InfestationDate: convertOptionalDate(client.InfestationDate),
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
Expiry: convertOptionalDate(client.Expiry),
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
UpgradesExpiry: convertOptionalDate(client.UpgradesExpiry)
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
};
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
};
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
const convertWeaponSkin = (client: IWeaponSkinClient): IWeaponSkinDatabase => {
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
const { ItemId, ...rest } = client;
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
return {
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
...rest,
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
_id: new Types.ObjectId(ItemId.$oid)
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
![]() ⚠️ Potential issue Add validation for Similar to Apply this diff to add validation:
📝 Committable suggestion
_:warning: Potential issue_
**Add validation for `ItemId.$oid` before creating `ObjectId` in `convertWeaponSkin`**
Similar to `convertEquipment`, ensure that `ItemId.$oid` is valid in the `convertWeaponSkin` function to prevent potential runtime exceptions.
Apply this diff to add validation:
```diff
const convertWeaponSkin = (client: IWeaponSkinClient): IWeaponSkinDatabase => {
const { ItemId, ...rest } = client;
+ if (!ItemId || !ItemId.$oid || !Types.ObjectId.isValid(ItemId.$oid)) {
+ throw new Error('Invalid ItemId');
+ }
return {
...rest,
_id: new Types.ObjectId(ItemId.$oid)
};
};
```
<!-- suggestion_start -->
<details>
<summary>📝 Committable suggestion</summary>
> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
`````suggestion
const convertWeaponSkin = (client: IWeaponSkinClient): IWeaponSkinDatabase => {
const { ItemId, ...rest } = client;
if (!ItemId || !ItemId.$oid || !Types.ObjectId.isValid(ItemId.$oid)) {
throw new Error('Invalid ItemId');
}
return {
...rest,
_id: new Types.ObjectId(ItemId.$oid)
};
};
`````
</details>
<!-- suggestion_end -->
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
};
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
};
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
const convertUpgrade = (client: IUpgradeClient): IUpgradeDatabase => {
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
const { ItemId, ...rest } = client;
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
return {
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
...rest,
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
_id: new Types.ObjectId(ItemId.$oid)
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
![]() ⚠️ Potential issue Add validation for In the Apply this diff to add validation:
📝 Committable suggestion
_:warning: Potential issue_
**Add validation for `ItemId.$oid` before creating `ObjectId` in `convertUpgrade`**
In the `convertUpgrade` function, validate `ItemId.$oid` to prevent exceptions when creating a new `ObjectId`.
Apply this diff to add validation:
```diff
const convertUpgrade = (client: IUpgradeClient): IUpgradeDatabase => {
const { ItemId, ...rest } = client;
+ if (!ItemId || !ItemId.$oid || !Types.ObjectId.isValid(ItemId.$oid)) {
+ throw new Error('Invalid ItemId');
+ }
return {
...rest,
_id: new Types.ObjectId(ItemId.$oid)
};
};
```
<!-- suggestion_start -->
<details>
<summary>📝 Committable suggestion</summary>
> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
`````suggestion
const convertUpgrade = (client: IUpgradeClient): IUpgradeDatabase => {
const { ItemId, ...rest } = client;
if (!ItemId || !ItemId.$oid || !Types.ObjectId.isValid(ItemId.$oid)) {
throw new Error('Invalid ItemId');
}
return {
...rest,
_id: new Types.ObjectId(ItemId.$oid)
};
};
`````
</details>
<!-- suggestion_end -->
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
};
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
};
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
const convertOperatorConfig = (client: IOperatorConfigClient): IOperatorConfigDatabase => {
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
const { ItemId, ...rest } = client;
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
return {
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
...rest,
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
_id: new Types.ObjectId(ItemId.$oid)
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
![]() ⚠️ Potential issue Add validation for Ensure that Apply this diff to add validation:
📝 Committable suggestion
_:warning: Potential issue_
**Add validation for `ItemId.$oid` before creating `ObjectId` in `convertOperatorConfig`**
Ensure that `ItemId.$oid` is valid in the `convertOperatorConfig` function to avoid potential errors.
Apply this diff to add validation:
```diff
const convertOperatorConfig = (client: IOperatorConfigClient): IOperatorConfigDatabase => {
const { ItemId, ...rest } = client;
+ if (!ItemId || !ItemId.$oid || !Types.ObjectId.isValid(ItemId.$oid)) {
+ throw new Error('Invalid ItemId');
+ }
return {
...rest,
_id: new Types.ObjectId(ItemId.$oid)
};
};
```
<!-- suggestion_start -->
<details>
<summary>📝 Committable suggestion</summary>
> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
`````suggestion
const convertOperatorConfig = (client: IOperatorConfigClient): IOperatorConfigDatabase => {
const { ItemId, ...rest } = client;
if (!ItemId || !ItemId.$oid || !Types.ObjectId.isValid(ItemId.$oid)) {
throw new Error('Invalid ItemId');
}
return {
...rest,
_id: new Types.ObjectId(ItemId.$oid)
};
};
`````
</details>
<!-- suggestion_end -->
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
};
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
};
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
const replaceArray = <T>(arr: T[], replacement: T[]): void => {
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
arr.splice(0, arr.length);
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
replacement.forEach(x => {
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
arr.push(x);
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
});
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
};
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
const replaceSlots = (db: ISlots, client: ISlots): void => {
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
db.Extra = client.Extra;
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
db.Slots = client.Slots;
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
};
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
const convertCrewShipMembers = (client: ICrewShipMembersClient): ICrewShipMembersDatabase => {
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
return {
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
SLOT_A: client.SLOT_A ? new Types.ObjectId(client.SLOT_A.ItemId.$oid) : undefined,
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
SLOT_B: client.SLOT_B ? new Types.ObjectId(client.SLOT_B.ItemId.$oid) : undefined,
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
SLOT_C: client.SLOT_C ? new Types.ObjectId(client.SLOT_C.ItemId.$oid) : undefined
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
};
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
};
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
const convertCrewShip = (client: ICrewShipClient): ICrewShipDatabase => {
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
const { ItemId, ...rest } = client;
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
return {
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
...rest,
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
_id: new Types.ObjectId(ItemId.$oid),
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
![]() ⚠️ Potential issue Validate In the Apply this diff to add validation:
_:warning: Potential issue_
**Validate `ItemId.$oid` and `CrewMembers` in `convertCrewShip`**
In the `convertCrewShip` function, add validation for `ItemId.$oid` and ensure that `CrewMembers` are properly converted if present.
Apply this diff to add validation:
```diff
const convertCrewShip = (client: ICrewShipClient): ICrewShipDatabase => {
const { ItemId, ...rest } = client;
+ if (!ItemId || !ItemId.$oid || !Types.ObjectId.isValid(ItemId.$oid)) {
+ throw new Error('Invalid ItemId');
+ }
return {
...rest,
_id: new Types.ObjectId(ItemId.$oid),
CrewMembers: client.CrewMembers ? convertCrewShipMembers(client.CrewMembers) : undefined
};
};
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
CrewMembers: client.CrewMembers ? convertCrewShipMembers(client.CrewMembers) : undefined
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
};
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
};
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
const convertInfestedFoundry = (client: IInfestedFoundryClient): IInfestedFoundryDatabase => {
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
return {
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
...client,
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
LastConsumedSuit: client.LastConsumedSuit ? convertEquipment(client.LastConsumedSuit) : undefined,
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
AbilityOverrideUnlockCooldown: convertOptionalDate(client.AbilityOverrideUnlockCooldown)
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
};
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
};
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
const convertDialogue = (client: IDialogueClient): IDialogueDatabase => {
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
return {
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
...client,
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
AvailableDate: convertDate(client.AvailableDate),
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
AvailableGiftDate: convertDate(client.AvailableGiftDate),
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
RankUpExpiry: convertDate(client.RankUpExpiry),
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
BountyChemExpiry: convertDate(client.BountyChemExpiry)
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
};
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
};
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
const convertDialogueHistory = (client: IDialogueHistoryClient): IDialogueHistoryDatabase => {
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
return {
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
YearIteration: client.YearIteration,
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
Dialogues: client.Dialogues ? client.Dialogues.map(convertDialogue) : undefined
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
};
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
};
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
for (const key of equipmentKeys) {
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
if (client[key]) {
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
replaceArray<IEquipmentDatabase>(db[key], client[key].map(convertEquipment));
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
}
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
}
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
if (client.WeaponSkins) {
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
replaceArray<IWeaponSkinDatabase>(db.WeaponSkins, client.WeaponSkins.map(convertWeaponSkin));
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
}
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
if (client.Upgrades) {
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
replaceArray<IUpgradeDatabase>(db.Upgrades, client.Upgrades.map(convertUpgrade));
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
}
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
for (const key of ["RawUpgrades", "MiscItems"] as const) {
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
if (client[key]) {
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
db[key].splice(0, db[key].length);
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
client[key].forEach(x => {
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
db[key].push({
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
ItemType: x.ItemType,
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
ItemCount: x.ItemCount
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
});
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
});
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
}
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
}
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
for (const key of ["OperatorLoadOuts", "AdultOperatorLoadOuts"] as const) {
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
if (client[key]) {
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
replaceArray<IOperatorConfigDatabase>(db[key], client[key].map(convertOperatorConfig));
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
}
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
}
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
for (const key of [
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
"SuitBin",
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
"WeaponBin",
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
"SentinelBin",
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
"SpaceSuitBin",
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
"SpaceWeaponBin",
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
"PvpBonusLoadoutBin",
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
"PveBonusLoadoutBin",
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
"RandomModBin",
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
"MechBin",
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
"CrewMemberBin",
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
"OperatorAmpBin",
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
"CrewShipSalvageBin"
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
] as const) {
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
if (client[key]) {
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
replaceSlots(db[key], client[key]);
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
}
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
}
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
if (client.UseAdultOperatorLoadout) {
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
db.UseAdultOperatorLoadout = client.UseAdultOperatorLoadout;
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
}
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
for (const key of [
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
"PlayerLevel",
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
"RegularCredits",
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
"PremiumCredits",
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
"PremiumCreditsFree",
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
"FusionPoints",
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
"PrimeTokens"
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
] as const) {
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
if (client[key]) {
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
db[key] = client[key];
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
}
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
}
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
for (const key of ["ThemeStyle", "ThemeBackground", "ThemeSounds", "EquippedInstrument", "FocusAbility"] as const) {
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
if (client[key]) {
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
db[key] = client[key];
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
}
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
}
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
for (const key of ["EquippedGear", "EquippedEmotes", "NodeIntrosCompleted"] as const) {
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
if (client[key]) {
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
db[key] = client[key];
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
}
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
}
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
if (client.XPInfo) {
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
db.XPInfo = client.XPInfo;
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
}
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
if (client.CurrentLoadOutIds) {
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
db.CurrentLoadOutIds = client.CurrentLoadOutIds;
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
}
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
if (client.Affiliations) {
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
db.Affiliations = client.Affiliations;
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
}
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
if (client.FusionTreasures) {
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
db.FusionTreasures = client.FusionTreasures;
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
}
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
if (client.FocusUpgrades) {
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
db.FocusUpgrades = client.FocusUpgrades;
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
}
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
if (client.CrewShips) {
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
replaceArray<ICrewShipDatabase>(db.CrewShips, client.CrewShips.map(convertCrewShip));
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
}
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
if (client.InfestedFoundry) {
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
db.InfestedFoundry = convertInfestedFoundry(client.InfestedFoundry);
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
}
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
if (client.DialogueHistory) {
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
db.DialogueHistory = convertDialogueHistory(client.DialogueHistory);
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
}
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
};
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
const convertLoadOutConfig = (client: ILoadoutConfigClient): ILoadoutConfigDatabase => {
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
const { ItemId, ...rest } = client;
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
return {
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
...rest,
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
_id: new Types.ObjectId(ItemId.$oid)
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
};
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
};
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
export const importLoadOutPresets = (db: ILoadoutDatabase, client: ILoadOutPresets): void => {
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
db.NORMAL = client.NORMAL.map(convertLoadOutConfig);
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
db.SENTINEL = client.SENTINEL.map(convertLoadOutConfig);
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
db.ARCHWING = client.ARCHWING.map(convertLoadOutConfig);
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
db.NORMAL_PVP = client.NORMAL_PVP.map(convertLoadOutConfig);
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
db.LUNARO = client.LUNARO.map(convertLoadOutConfig);
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
db.OPERATOR = client.OPERATOR.map(convertLoadOutConfig);
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
db.KDRIVE = client.KDRIVE.map(convertLoadOutConfig);
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
db.DATAKNIFE = client.DATAKNIFE.map(convertLoadOutConfig);
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
db.MECH = client.MECH.map(convertLoadOutConfig);
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
db.OPERATOR_ADULT = client.OPERATOR_ADULT.map(convertLoadOutConfig);
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
db.DRIFTER = client.DRIFTER.map(convertLoadOutConfig);
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
|
};
|
||||||
![]() 🛠️ Refactor suggestion Consider using transactions for atomic operations. The Additionally, the function should validate the client object structure before processing.
_:hammer_and_wrench: Refactor suggestion_
**Consider using transactions for atomic operations.**
The `importInventory` function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.
Additionally, the function should validate the client object structure before processing.
```diff
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['WeaponSkins', 'Upgrades'];
+ for (const key of requiredKeys) {
+ if (client[key] && !Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
> Committable suggestion skipped: line range outside the PR's diff.
<!-- This is an auto-generated comment by CodeRabbit -->
![]() 🛠️ Refactor suggestion Add validation for loadout presets. The
📝 Committable suggestion
_:hammer_and_wrench: Refactor suggestion_
**Add validation for loadout presets.**
The `importLoadOutPresets` function should validate the input structure before processing.
```diff
export const importLoadOutPresets = (db: ILoadoutDatabase, client: ILoadOutPresets): void => {
+ if (!db || !client) {
+ throw new Error('Invalid arguments: db and client are required');
+ }
+
+ // Validate required client properties
+ const requiredKeys = ['NORMAL', 'SENTINEL', 'ARCHWING', 'NORMAL_PVP', 'LUNARO',
+ 'OPERATOR', 'KDRIVE', 'DATAKNIFE', 'MECH', 'OPERATOR_ADULT', 'DRIFTER'];
+ for (const key of requiredKeys) {
+ if (!Array.isArray(client[key])) {
+ throw new Error(`Invalid ${key} format: expected array`);
+ }
+ }
```
<!-- suggestion_start -->
<details>
<summary>📝 Committable suggestion</summary>
> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
`````suggestion
export const importLoadOutPresets = (db: ILoadoutDatabase, client: ILoadOutPresets): void => {
if (!db || !client) {
throw new Error('Invalid arguments: db and client are required');
}
// Validate required client properties
const requiredKeys = ['NORMAL', 'SENTINEL', 'ARCHWING', 'NORMAL_PVP', 'LUNARO',
'OPERATOR', 'KDRIVE', 'DATAKNIFE', 'MECH', 'OPERATOR_ADULT', 'DRIFTER'];
for (const key of requiredKeys) {
if (!Array.isArray(client[key])) {
throw new Error(`Invalid ${key} format: expected array`);
}
}
db.NORMAL = client.NORMAL.map(convertLoadOutConfig);
db.SENTINEL = client.SENTINEL.map(convertLoadOutConfig);
db.ARCHWING = client.ARCHWING.map(convertLoadOutConfig);
db.NORMAL_PVP = client.NORMAL_PVP.map(convertLoadOutConfig);
db.LUNARO = client.LUNARO.map(convertLoadOutConfig);
db.OPERATOR = client.OPERATOR.map(convertLoadOutConfig);
db.KDRIVE = client.KDRIVE.map(convertLoadOutConfig);
db.DATAKNIFE = client.DATAKNIFE.map(convertLoadOutConfig);
db.MECH = client.MECH.map(convertLoadOutConfig);
db.OPERATOR_ADULT = client.OPERATOR_ADULT.map(convertLoadOutConfig);
db.DRIFTER = client.DRIFTER.map(convertLoadOutConfig);
};
`````
</details>
<!-- suggestion_end -->
<!-- This is an auto-generated comment by CodeRabbit -->
|
@ -78,8 +78,11 @@ export interface IEquipmentSelection {
|
|||||||
hide?: boolean;
|
hide?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IEquipmentClient extends Omit<IEquipmentDatabase, "_id" | "UpgradesExpiry"> {
|
export interface IEquipmentClient
|
||||||
|
extends Omit<IEquipmentDatabase, "_id" | "InfestationDate" | "Expiry" | "UpgradesExpiry"> {
|
||||||
ItemId: IOid;
|
ItemId: IOid;
|
||||||
|
InfestationDate?: IMongoDate;
|
||||||
|
Expiry?: IMongoDate;
|
||||||
UpgradesExpiry?: IMongoDate;
|
UpgradesExpiry?: IMongoDate;
|
||||||
![]() 🛠️ Refactor suggestion Consider adding runtime validation for date fields. The addition of optional date fields and the change in type from Consider adding a validation utility:
_:hammer_and_wrench: Refactor suggestion_
**Consider adding runtime validation for date fields.**
The addition of optional date fields and the change in type from `IMongoDate` to `Date` suggests a need for proper validation and conversion between client and database representations.
Consider adding a validation utility:
```typescript
export function validateEquipmentDates(equipment: IEquipmentClient): void {
if (equipment.InfestationDate && !isValidMongoDate(equipment.InfestationDate)) {
throw new Error('Invalid InfestationDate format');
}
if (equipment.Expiry && !isValidMongoDate(equipment.Expiry)) {
throw new Error('Invalid Expiry format');
}
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ -106,12 +109,12 @@ export interface IEquipmentDatabase {
|
|||||||
CustomizationSlotPurchases?: number;
|
CustomizationSlotPurchases?: number;
|
||||||
UpgradeType?: string;
|
UpgradeType?: string;
|
||||||
UpgradeFingerprint?: string;
|
UpgradeFingerprint?: string;
|
||||||
InfestationDate?: IMongoDate;
|
InfestationDate?: Date;
|
||||||
InfestationDays?: number;
|
InfestationDays?: number;
|
||||||
InfestationType?: string;
|
InfestationType?: string;
|
||||||
ModularParts?: string[];
|
ModularParts?: string[];
|
||||||
UnlockLevel?: number;
|
UnlockLevel?: number;
|
||||||
Expiry?: IMongoDate;
|
Expiry?: Date;
|
||||||
SkillTree?: string;
|
SkillTree?: string;
|
||||||
OffensiveUpgrade?: string;
|
OffensiveUpgrade?: string;
|
||||||
DefensiveUpgrade?: string;
|
DefensiveUpgrade?: string;
|
||||||
|
@ -7,12 +7,14 @@ import {
|
|||||||
IItemConfig,
|
IItemConfig,
|
||||||
IOperatorConfigClient,
|
IOperatorConfigClient,
|
||||||
IEquipmentSelection,
|
IEquipmentSelection,
|
||||||
IEquipmentDatabase
|
IEquipmentDatabase,
|
||||||
|
IEquipmentClient,
|
||||||
|
IOperatorConfigDatabase
|
||||||
} from "@/src/types/inventoryTypes/commonInventoryTypes";
|
} from "@/src/types/inventoryTypes/commonInventoryTypes";
|
||||||
|
|
||||||
export interface IInventoryDatabase
|
export interface IInventoryDatabase
|
||||||
extends Omit<
|
extends Omit<
|
||||||
IInventoryResponse,
|
IInventoryClient,
|
||||||
| "TrainingDate"
|
| "TrainingDate"
|
||||||
| "LoadOutPresets"
|
| "LoadOutPresets"
|
||||||
| "Mailbox"
|
| "Mailbox"
|
||||||
@ -23,6 +25,15 @@ export interface IInventoryDatabase
|
|||||||
| "BlessingCooldown"
|
| "BlessingCooldown"
|
||||||
| "Ships"
|
| "Ships"
|
||||||
| "WeaponSkins"
|
| "WeaponSkins"
|
||||||
|
| "Upgrades"
|
||||||
|
| "CrewShipSalvagedWeaponSkins"
|
||||||
|
| "CrewShipWeaponSkins"
|
||||||
|
| "OperatorLoadOuts"
|
||||||
|
| "AdultOperatorLoadOuts"
|
||||||
|
| "CrewShips"
|
||||||
|
| "InfestedFoundry"
|
||||||
|
| "DialogueHistory"
|
||||||
|
| TEquipmentKey
|
||||||
> {
|
> {
|
||||||
accountOwnerId: Types.ObjectId;
|
accountOwnerId: Types.ObjectId;
|
||||||
Created: Date;
|
Created: Date;
|
||||||
@ -35,6 +46,28 @@ export interface IInventoryDatabase
|
|||||||
BlessingCooldown: Date;
|
BlessingCooldown: Date;
|
||||||
Ships: Types.ObjectId[];
|
Ships: Types.ObjectId[];
|
||||||
WeaponSkins: IWeaponSkinDatabase[];
|
WeaponSkins: IWeaponSkinDatabase[];
|
||||||
|
Upgrades: IUpgradeDatabase[];
|
||||||
|
CrewShipSalvagedWeaponSkins: IUpgradeDatabase[];
|
||||||
|
CrewShipWeaponSkins: IUpgradeDatabase[];
|
||||||
|
OperatorLoadOuts: IOperatorConfigDatabase[];
|
||||||
|
AdultOperatorLoadOuts: IOperatorConfigDatabase[];
|
||||||
|
CrewShips: ICrewShipDatabase[];
|
||||||
|
InfestedFoundry?: IInfestedFoundryDatabase;
|
||||||
|
DialogueHistory?: IDialogueHistoryDatabase;
|
||||||
|
|
||||||
|
Suits: IEquipmentDatabase[];
|
||||||
|
LongGuns: IEquipmentDatabase[];
|
||||||
|
Pistols: IEquipmentDatabase[];
|
||||||
|
Melee: IEquipmentDatabase[];
|
||||||
|
SpecialItems: IEquipmentDatabase[];
|
||||||
|
Sentinels: IEquipmentDatabase[];
|
||||||
|
SentinelWeapons: IEquipmentDatabase[];
|
||||||
|
SpaceSuits: IEquipmentDatabase[];
|
||||||
|
SpaceGuns: IEquipmentDatabase[];
|
||||||
|
SpaceMelee: IEquipmentDatabase[];
|
||||||
|
Hoverboards: IEquipmentDatabase[];
|
||||||
|
OperatorAmps: IEquipmentDatabase[];
|
||||||
|
MoaPets: IEquipmentDatabase[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IQuestKeyDatabase {
|
export interface IQuestKeyDatabase {
|
||||||
@ -46,12 +79,6 @@ export interface IQuestKeyDatabase {
|
|||||||
CompletionDate?: Date;
|
CompletionDate?: Date;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IFocusUpgrades {
|
|
||||||
ItemType: string;
|
|
||||||
Level: number;
|
|
||||||
IsUniversal: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ITypeCount {
|
export interface ITypeCount {
|
||||||
ItemType: string;
|
ItemType: string;
|
||||||
ItemCount: number;
|
ItemCount: number;
|
||||||
@ -126,7 +153,21 @@ export interface IDailyAffiliations {
|
|||||||
DailyAffiliationHex: number;
|
DailyAffiliationHex: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IInventoryResponse extends IDailyAffiliations {
|
export interface IInventoryClient extends IDailyAffiliations {
|
||||||
|
Suits: IEquipmentClient[];
|
||||||
|
LongGuns: IEquipmentClient[];
|
||||||
|
Pistols: IEquipmentClient[];
|
||||||
|
Melee: IEquipmentClient[];
|
||||||
|
SpecialItems: IEquipmentClient[];
|
||||||
|
Sentinels: IEquipmentClient[];
|
||||||
|
SentinelWeapons: IEquipmentClient[];
|
||||||
|
SpaceSuits: IEquipmentClient[];
|
||||||
|
SpaceGuns: IEquipmentClient[];
|
||||||
|
SpaceMelee: IEquipmentClient[];
|
||||||
|
Hoverboards: IEquipmentClient[];
|
||||||
|
OperatorAmps: IEquipmentClient[];
|
||||||
|
MoaPets: IEquipmentClient[];
|
||||||
|
|
||||||
Horses: IEquipmentDatabase[];
|
Horses: IEquipmentDatabase[];
|
||||||
DrifterMelee: IEquipmentDatabase[];
|
DrifterMelee: IEquipmentDatabase[];
|
||||||
DrifterGuns: IEquipmentDatabase[];
|
DrifterGuns: IEquipmentDatabase[];
|
||||||
@ -163,17 +204,13 @@ export interface IInventoryResponse extends IDailyAffiliations {
|
|||||||
ChallengeProgress: IChallengeProgress[];
|
ChallengeProgress: IChallengeProgress[];
|
||||||
RawUpgrades: IRawUpgrade[];
|
RawUpgrades: IRawUpgrade[];
|
||||||
ReceivedStartingGear: boolean;
|
ReceivedStartingGear: boolean;
|
||||||
Suits: IEquipmentDatabase[];
|
|
||||||
LongGuns: IEquipmentDatabase[];
|
|
||||||
Pistols: IEquipmentDatabase[];
|
|
||||||
Melee: IEquipmentDatabase[];
|
|
||||||
Ships: IShipInventory[];
|
Ships: IShipInventory[];
|
||||||
QuestKeys: IQuestKeyResponse[];
|
QuestKeys: IQuestKeyResponse[];
|
||||||
FlavourItems: IFlavourItem[];
|
FlavourItems: IFlavourItem[];
|
||||||
Scoops: IEquipmentDatabase[];
|
Scoops: IEquipmentDatabase[];
|
||||||
TrainingRetriesLeft: number;
|
TrainingRetriesLeft: number;
|
||||||
LoadOutPresets: ILoadOutPresets;
|
LoadOutPresets: ILoadOutPresets;
|
||||||
CurrentLoadOutIds: Array<any[] | IOid>;
|
CurrentLoadOutIds: IOid[]; // we store it in the database using this representation as well :/
|
||||||
Missions: IMission[];
|
Missions: IMission[];
|
||||||
RandomUpgradesIdentified?: number;
|
RandomUpgradesIdentified?: number;
|
||||||
LastRegionPlayed: TSolarMapRegion;
|
LastRegionPlayed: TSolarMapRegion;
|
||||||
@ -191,7 +228,7 @@ export interface IInventoryResponse extends IDailyAffiliations {
|
|||||||
Accolades?: {
|
Accolades?: {
|
||||||
Heirloom?: boolean;
|
Heirloom?: boolean;
|
||||||
};
|
};
|
||||||
Upgrades: ICrewShipSalvagedWeaponSkin[];
|
Upgrades: IUpgradeClient[];
|
||||||
EquippedGear: string[];
|
EquippedGear: string[];
|
||||||
DeathMarks: string[];
|
DeathMarks: string[];
|
||||||
FusionTreasures: IFusionTreasure[];
|
FusionTreasures: IFusionTreasure[];
|
||||||
@ -213,14 +250,9 @@ export interface IInventoryResponse extends IDailyAffiliations {
|
|||||||
Affiliations: IAffiliation[];
|
Affiliations: IAffiliation[];
|
||||||
QualifyingInvasions: any[];
|
QualifyingInvasions: any[];
|
||||||
FactionScores: number[];
|
FactionScores: number[];
|
||||||
SpaceSuits: IEquipmentDatabase[];
|
|
||||||
SpaceMelee: IEquipmentDatabase[];
|
|
||||||
SpaceGuns: IEquipmentDatabase[];
|
|
||||||
ArchwingEnabled: boolean;
|
ArchwingEnabled: boolean;
|
||||||
PendingSpectreLoadouts?: ISpectreLoadout[];
|
PendingSpectreLoadouts?: ISpectreLoadout[];
|
||||||
SpectreLoadouts?: ISpectreLoadout[];
|
SpectreLoadouts?: ISpectreLoadout[];
|
||||||
SentinelWeapons: IEquipmentDatabase[];
|
|
||||||
Sentinels: IEquipmentDatabase[];
|
|
||||||
EmailItems: ITypeCount[];
|
EmailItems: ITypeCount[];
|
||||||
CompletedSyndicates: string[];
|
CompletedSyndicates: string[];
|
||||||
FocusXP: IFocusXP;
|
FocusXP: IFocusXP;
|
||||||
@ -237,13 +269,11 @@ export interface IInventoryResponse extends IDailyAffiliations {
|
|||||||
CompletedJobs: ICompletedJob[];
|
CompletedJobs: ICompletedJob[];
|
||||||
FocusAbility: string;
|
FocusAbility: string;
|
||||||
FocusUpgrades: IFocusUpgrade[];
|
FocusUpgrades: IFocusUpgrade[];
|
||||||
OperatorAmps: IEquipmentDatabase[];
|
|
||||||
HasContributedToDojo?: boolean;
|
HasContributedToDojo?: boolean;
|
||||||
HWIDProtectEnabled?: boolean;
|
HWIDProtectEnabled?: boolean;
|
||||||
KubrowPetPrints: IKubrowPetPrint[];
|
KubrowPetPrints: IKubrowPetPrint[];
|
||||||
AlignmentReplay: IAlignment;
|
AlignmentReplay: IAlignment;
|
||||||
PersonalGoalProgress: IPersonalGoalProgress[];
|
PersonalGoalProgress: IPersonalGoalProgress[];
|
||||||
SpecialItems: IEquipmentDatabase[];
|
|
||||||
ThemeStyle: string;
|
ThemeStyle: string;
|
||||||
ThemeBackground: string;
|
ThemeBackground: string;
|
||||||
ThemeSounds: string;
|
ThemeSounds: string;
|
||||||
@ -252,12 +282,10 @@ export interface IInventoryResponse extends IDailyAffiliations {
|
|||||||
LoginMilestoneRewards: string[];
|
LoginMilestoneRewards: string[];
|
||||||
OperatorLoadOuts: IOperatorConfigClient[];
|
OperatorLoadOuts: IOperatorConfigClient[];
|
||||||
RecentVendorPurchases: Array<number | string>;
|
RecentVendorPurchases: Array<number | string>;
|
||||||
Hoverboards: IEquipmentDatabase[];
|
|
||||||
NodeIntrosCompleted: string[];
|
NodeIntrosCompleted: string[];
|
||||||
GuildId?: IOid;
|
GuildId?: IOid;
|
||||||
CompletedJobChains: ICompletedJobChain[];
|
CompletedJobChains: ICompletedJobChain[];
|
||||||
SeasonChallengeHistory: ISeasonChallenge[];
|
SeasonChallengeHistory: ISeasonChallenge[];
|
||||||
MoaPets: IEquipmentDatabase[];
|
|
||||||
EquippedInstrument?: string;
|
EquippedInstrument?: string;
|
||||||
InvasionChainProgress: IInvasionChainProgress[];
|
InvasionChainProgress: IInvasionChainProgress[];
|
||||||
DataKnives: IEquipmentDatabase[];
|
DataKnives: IEquipmentDatabase[];
|
||||||
@ -266,18 +294,18 @@ export interface IInventoryResponse extends IDailyAffiliations {
|
|||||||
LastNemesisAllySpawnTime?: IMongoDate;
|
LastNemesisAllySpawnTime?: IMongoDate;
|
||||||
Settings: ISettings;
|
Settings: ISettings;
|
||||||
PersonalTechProjects: IPersonalTechProject[];
|
PersonalTechProjects: IPersonalTechProject[];
|
||||||
CrewShips: ICrewShip[];
|
CrewShips: ICrewShipClient[];
|
||||||
PlayerSkills: IPlayerSkills;
|
PlayerSkills: IPlayerSkills;
|
||||||
CrewShipAmmo: IConsumable[];
|
CrewShipAmmo: IConsumable[];
|
||||||
CrewShipSalvagedWeaponSkins: ICrewShipSalvagedWeaponSkin[];
|
CrewShipSalvagedWeaponSkins: IUpgradeClient[];
|
||||||
CrewShipWeapons: ICrewShipWeapon[];
|
CrewShipWeapons: ICrewShipWeapon[];
|
||||||
CrewShipSalvagedWeapons: ICrewShipWeapon[];
|
CrewShipSalvagedWeapons: ICrewShipWeapon[];
|
||||||
CrewShipWeaponSkins: ICrewShipSalvagedWeaponSkin[];
|
CrewShipWeaponSkins: IUpgradeClient[];
|
||||||
TradeBannedUntil?: IMongoDate;
|
TradeBannedUntil?: IMongoDate;
|
||||||
PlayedParkourTutorial: boolean;
|
PlayedParkourTutorial: boolean;
|
||||||
SubscribedToEmailsPersonalized: number;
|
SubscribedToEmailsPersonalized: number;
|
||||||
MechSuits: IEquipmentDatabase[];
|
MechSuits: IEquipmentDatabase[];
|
||||||
InfestedFoundry?: IInfestedFoundry;
|
InfestedFoundry?: IInfestedFoundryClient;
|
||||||
BlessingCooldown: IMongoDate;
|
BlessingCooldown: IMongoDate;
|
||||||
CrewShipHarnesses: IEquipmentDatabase[];
|
CrewShipHarnesses: IEquipmentDatabase[];
|
||||||
CrewShipRawSalvage: IConsumable[];
|
CrewShipRawSalvage: IConsumable[];
|
||||||
@ -304,7 +332,7 @@ export interface IInventoryResponse extends IDailyAffiliations {
|
|||||||
Harvestable: boolean;
|
Harvestable: boolean;
|
||||||
DeathSquadable: boolean;
|
DeathSquadable: boolean;
|
||||||
EndlessXP?: IEndlessXpProgress[];
|
EndlessXP?: IEndlessXpProgress[];
|
||||||
DialogueHistory?: IDialogueHistoryDatabase;
|
DialogueHistory?: IDialogueHistoryClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IAffiliation {
|
export interface IAffiliation {
|
||||||
@ -415,15 +443,18 @@ export interface ISlots {
|
|||||||
Slots: number;
|
Slots: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ICrewShipSalvagedWeaponSkin {
|
export interface IUpgradeClient {
|
||||||
ItemType: string;
|
ItemType: string;
|
||||||
UpgradeFingerprint?: string;
|
UpgradeFingerprint?: string;
|
||||||
PendingRerollFingerprint?: string;
|
PendingRerollFingerprint?: string;
|
||||||
ItemId?: IOid;
|
ItemId: IOid;
|
||||||
_id?: Types.ObjectId;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ICrewShip {
|
export interface IUpgradeDatabase extends Omit<IUpgradeClient, "ItemId"> {
|
||||||
|
_id: Types.ObjectId;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ICrewShipClient {
|
||||||
ItemType: string;
|
ItemType: string;
|
||||||
Configs: IItemConfig[];
|
Configs: IItemConfig[];
|
||||||
Weapon?: ICrewShipWeapon;
|
Weapon?: ICrewShipWeapon;
|
||||||
@ -432,6 +463,10 @@ export interface ICrewShip {
|
|||||||
RailjackImage?: IFlavourItem;
|
RailjackImage?: IFlavourItem;
|
||||||
CrewMembers?: ICrewShipMembersClient;
|
CrewMembers?: ICrewShipMembersClient;
|
||||||
ItemId: IOid;
|
ItemId: IOid;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ICrewShipDatabase extends Omit<ICrewShipClient, "CrewMembers" | "ItemId"> {
|
||||||
|
CrewMembers?: ICrewShipMembersDatabase;
|
||||||
_id: Types.ObjectId;
|
_id: Types.ObjectId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -535,7 +570,7 @@ export interface IHelminthResource {
|
|||||||
RecentlyConvertedResources?: IHelminthFoodRecord[];
|
RecentlyConvertedResources?: IHelminthFoodRecord[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IInfestedFoundry {
|
export interface IInfestedFoundryClient {
|
||||||
Name?: string;
|
Name?: string;
|
||||||
Resources?: IHelminthResource[];
|
Resources?: IHelminthResource[];
|
||||||
Slots?: number;
|
Slots?: number;
|
||||||
@ -544,6 +579,12 @@ export interface IInfestedFoundry {
|
|||||||
InvigorationIndex?: number;
|
InvigorationIndex?: number;
|
||||||
InvigorationSuitOfferings?: string[];
|
InvigorationSuitOfferings?: string[];
|
||||||
InvigorationsApplied?: number;
|
InvigorationsApplied?: number;
|
||||||
|
LastConsumedSuit?: IEquipmentClient;
|
||||||
|
AbilityOverrideUnlockCooldown?: IMongoDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IInfestedFoundryDatabase
|
||||||
|
extends Omit<IInfestedFoundryClient, "LastConsumedSuit" | "AbilityOverrideUnlockCooldown"> {
|
||||||
LastConsumedSuit?: IEquipmentDatabase;
|
LastConsumedSuit?: IEquipmentDatabase;
|
||||||
AbilityOverrideUnlockCooldown?: Date;
|
AbilityOverrideUnlockCooldown?: Date;
|
||||||
}
|
}
|
||||||
@ -636,7 +677,7 @@ export interface ILibraryPersonalProgress {
|
|||||||
Completed: boolean;
|
Completed: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
//this needs to be checked against ILoadoutDatabase
|
// keep in sync with ILoadoutDatabase
|
||||||
export interface ILoadOutPresets {
|
export interface ILoadOutPresets {
|
||||||
NORMAL: ILoadoutConfigClient[];
|
NORMAL: ILoadoutConfigClient[];
|
||||||
NORMAL_PVP: ILoadoutConfigClient[];
|
NORMAL_PVP: ILoadoutConfigClient[];
|
||||||
@ -649,6 +690,7 @@ export interface ILoadOutPresets {
|
|||||||
DATAKNIFE: ILoadoutConfigClient[];
|
DATAKNIFE: ILoadoutConfigClient[];
|
||||||
MECH: ILoadoutConfigClient[];
|
MECH: ILoadoutConfigClient[];
|
||||||
OPERATOR_ADULT: ILoadoutConfigClient[];
|
OPERATOR_ADULT: ILoadoutConfigClient[];
|
||||||
|
DRIFTER: ILoadoutConfigClient[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum FocusSchool {
|
export enum FocusSchool {
|
||||||
@ -913,9 +955,10 @@ export interface ITaunt {
|
|||||||
|
|
||||||
export interface IWeaponSkinDatabase {
|
export interface IWeaponSkinDatabase {
|
||||||
ItemType: string;
|
ItemType: string;
|
||||||
|
_id: Types.ObjectId;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IWeaponSkinClient extends IWeaponSkinDatabase {
|
export interface IWeaponSkinClient extends Omit<IWeaponSkinDatabase, "_id"> {
|
||||||
ItemId: IOid;
|
ItemId: IOid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { IInfestedFoundry } from "./inventoryTypes/inventoryTypes";
|
import { IInfestedFoundryClient } from "./inventoryTypes/inventoryTypes";
|
||||||
|
|
||||||
export interface IPurchaseRequest {
|
export interface IPurchaseRequest {
|
||||||
PurchaseParams: IPurchaseParams;
|
PurchaseParams: IPurchaseParams;
|
||||||
@ -29,9 +29,9 @@ export interface ICurrencyChanges {
|
|||||||
|
|
||||||
export type IInventoryChanges = {
|
export type IInventoryChanges = {
|
||||||
[_ in SlotNames]?: IBinChanges;
|
[_ in SlotNames]?: IBinChanges;
|
||||||
} & ICurrencyChanges & { InfestedFoundry?: IInfestedFoundry } & Record<
|
} & ICurrencyChanges & { InfestedFoundry?: IInfestedFoundryClient } & Record<
|
||||||
string,
|
string,
|
||||||
IBinChanges | number | object[] | IInfestedFoundry
|
IBinChanges | number | object[] | IInfestedFoundryClient
|
||||||
>;
|
>;
|
||||||
|
|
||||||
export interface IPurchaseResponse {
|
export interface IPurchaseResponse {
|
||||||
|
@ -54,18 +54,19 @@ export interface IConfigEntry {
|
|||||||
|
|
||||||
export interface ILoadoutClient extends Omit<ILoadoutDatabase, "_id" | "loadoutOwnerId"> {}
|
export interface ILoadoutClient extends Omit<ILoadoutDatabase, "_id" | "loadoutOwnerId"> {}
|
||||||
|
|
||||||
|
// keep in sync with ILoadOutPresets
|
||||||
![]() 💡 Codebase verification Consider using a shared type for the loadout categories The coupling between
🔗 Analysis chainConsider documenting the coupling mechanism. The comment indicates that Let's check for the usage of these interfaces: 🏁 Scripts executedThe following scripts were executed for the analysis: Script:
Length of output: 269 Script:
Length of output: 1712 _:bulb: Codebase verification_
**Consider using a shared type for the loadout categories**
The coupling between `ILoadoutDatabase` and `ILoadOutPresets` exists because they share similar property keys but use different value types (`ILoadoutConfigDatabase[]` vs `ILoadoutConfigClient[]`). To better maintain this relationship:
- Consider extracting the common loadout categories into a shared `enum` or string union type
- Document the intentional differences (e.g., `OPERATOR_ADULT` vs `GEAR`)
- Add a comment explaining the Database-to-Client relationship
<details>
<summary>🔗 Analysis chain</summary>
**Consider documenting the coupling mechanism.**
The comment indicates that `ILoadoutDatabase` should be kept in sync with `ILoadOutPresets`. Consider documenting how this sync is maintained and whether this coupling could be enforced through types.
Let's check for the usage of these interfaces:
</details>
<details>
<summary>🏁 Scripts executed</summary>
The following scripts were executed for the analysis:
Script:
```shell
#!/bin/bash
# Find usages of both interfaces to understand the coupling
rg -l "ILoadOutPresets|ILoadoutDatabase" --type ts
```
Length of output: 269
---
Script:
```shell
#!/bin/bash
# Get the interface definitions and surrounding context
rg "interface (ILoadOutPresets|ILoadoutDatabase)" -A 10 --type ts
```
Length of output: 1712
</details>
<!-- This is an auto-generated comment by CodeRabbit -->
|
|||||||
export interface ILoadoutDatabase {
|
export interface ILoadoutDatabase {
|
||||||
NORMAL: ILoadoutEntry;
|
NORMAL: ILoadoutConfigDatabase[];
|
||||||
SENTINEL: ILoadoutEntry;
|
SENTINEL: ILoadoutConfigDatabase[];
|
||||||
ARCHWING: ILoadoutEntry;
|
ARCHWING: ILoadoutConfigDatabase[];
|
||||||
NORMAL_PVP: ILoadoutEntry;
|
NORMAL_PVP: ILoadoutConfigDatabase[];
|
||||||
LUNARO: ILoadoutEntry;
|
LUNARO: ILoadoutConfigDatabase[];
|
||||||
OPERATOR: ILoadoutEntry;
|
OPERATOR: ILoadoutConfigDatabase[];
|
||||||
KDRIVE: ILoadoutEntry;
|
KDRIVE: ILoadoutConfigDatabase[];
|
||||||
DATAKNIFE: ILoadoutEntry;
|
DATAKNIFE: ILoadoutConfigDatabase[];
|
||||||
MECH: ILoadoutEntry;
|
MECH: ILoadoutConfigDatabase[];
|
||||||
OPERATOR_ADULT: ILoadoutEntry;
|
OPERATOR_ADULT: ILoadoutConfigDatabase[];
|
||||||
DRIFTER: ILoadoutEntry;
|
DRIFTER: ILoadoutConfigDatabase[];
|
||||||
_id: Types.ObjectId;
|
_id: Types.ObjectId;
|
||||||
loadoutOwnerId: Types.ObjectId;
|
loadoutOwnerId: Types.ObjectId;
|
||||||
}
|
}
|
||||||
|
@ -64,6 +64,9 @@
|
|||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="/webui/cheats" data-bs-dismiss="offcanvas" data-bs-target="#sidebar">Cheats</a>
|
<a class="nav-link" href="/webui/cheats" data-bs-dismiss="offcanvas" data-bs-target="#sidebar">Cheats</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="/webui/import" data-bs-dismiss="offcanvas" data-bs-target="#sidebar">Import</a>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -492,6 +495,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div data-route="/webui/import" data-title="Import | OpenWF WebUI">
|
||||||
|
<p>You can provide a full or partial inventory response (client respresentation) here. All fields that are supported by the importer <b>will be overwritten</b> in your account.</p>
|
||||||
|
<textarea class="form-control" id="import-inventory"></textarea>
|
||||||
|
<button class="btn btn-primary mt-3" onclick="doImport();">Submit</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<datalist id="datalist-Suits"></datalist>
|
<datalist id="datalist-Suits"></datalist>
|
||||||
|
@ -215,8 +215,13 @@ function updateInventory() {
|
|||||||
const td = document.createElement("td");
|
const td = document.createElement("td");
|
||||||
td.textContent = itemMap[item.ItemType]?.name ?? item.ItemType;
|
td.textContent = itemMap[item.ItemType]?.name ?? item.ItemType;
|
||||||
if (item.ItemName) {
|
if (item.ItemName) {
|
||||||
|
const pipeIndex = item.ItemName.indexOf("|");
|
||||||
|
if (pipeIndex != -1) {
|
||||||
|
td.textContent = item.ItemName.substr(1 + pipeIndex) + " " + td.textContent;
|
||||||
|
} else {
|
||||||
td.textContent = item.ItemName + " (" + td.textContent + ")";
|
td.textContent = item.ItemName + " (" + td.textContent + ")";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (item.ModularParts && item.ModularParts.length) {
|
if (item.ModularParts && item.ModularParts.length) {
|
||||||
td.textContent += " [";
|
td.textContent += " [";
|
||||||
item.ModularParts.forEach(part => {
|
item.ModularParts.forEach(part => {
|
||||||
@ -1083,3 +1088,18 @@ function doPopArchonCrystalUpgrade(type) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function doImport() {
|
||||||
|
revalidateAuthz(() => {
|
||||||
|
$.post({
|
||||||
|
url: "/custom/import?" + window.authz,
|
||||||
|
contentType: "text/plain",
|
||||||
|
data: JSON.stringify({
|
||||||
|
inventory: JSON.parse($("#import-inventory").val())
|
||||||
|
})
|
||||||
|
}).then(function () {
|
||||||
|
alert("Successfully imported.");
|
||||||
|
updateInventory();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
⚠️ Potential issue
Avoid unnecessary parsing of
req.body
Express, when configured with the appropriate middleware, automatically parses JSON request bodies. Directly calling
JSON.parse(String(req.body))
may not be necessary and could lead to errors ifreq.body
is already an object.Modify the code to use the parsed body directly:
Ensure that
express.json()
middleware is applied to parse JSON request bodies.📝 Committable suggestion