feat: import #831
@ -29,11 +29,10 @@ const convertOptionalDate = (value: IMongoDate | undefined): Date | undefined =>
 | 
				
			|||||||
| 
						
							
	
	
	
	
	
	
	
	 | 
				|||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const convertEquipment = (client: IEquipmentClient): IEquipmentDatabase => {
 | 
					const convertEquipment = (client: IEquipmentClient): IEquipmentDatabase => {
 | 
				
			||||||
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
 | 
					 | 
				
			||||||
| 
						
							
	
	
	
	
	
	
	
	 🛠️ 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;
 | 
					    const { ItemId, ...rest } = client;
 | 
				
			||||||
    return {
 | 
					    return {
 | 
				
			||||||
        ...rest,
 | 
					        ...rest,
 | 
				
			||||||
        _id: new Types.ObjectId(client.ItemId.$oid),
 | 
					        _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 --> 
			
			
		 | 
					|||||||
        InfestationDate: convertOptionalDate(client.InfestationDate),
 | 
					        InfestationDate: convertOptionalDate(client.InfestationDate),
 | 
				
			||||||
        Expiry: convertOptionalDate(client.Expiry),
 | 
					        Expiry: convertOptionalDate(client.Expiry),
 | 
				
			||||||
        UpgradesExpiry: convertOptionalDate(client.UpgradesExpiry)
 | 
					        UpgradesExpiry: convertOptionalDate(client.UpgradesExpiry)
 | 
				
			||||||
@ -41,29 +40,26 @@ 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 --> 
			
			
		🛠️ 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 => {
 | 
					const convertWeaponSkin = (client: IWeaponSkinClient): IWeaponSkinDatabase => {
 | 
				
			||||||
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
 | 
					 | 
				
			||||||
| 
						
							
	
	
	
	
	
	
	
	 🛠️ 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;
 | 
					    const { ItemId, ...rest } = client;
 | 
				
			||||||
    return {
 | 
					    return {
 | 
				
			||||||
        ...rest,
 | 
					        ...rest,
 | 
				
			||||||
| 
						
							
	
	
	
	
	
	
	
	 ⚠️ 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 --> 
			
			
		 | 
				|||||||
        _id: new Types.ObjectId(client.ItemId.$oid)
 | 
					        _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 --> 
			
			
		 | 
					|||||||
    };
 | 
					    };
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const convertUpgrade = (client: IUpgradeClient): IUpgradeDatabase => {
 | 
					const convertUpgrade = (client: IUpgradeClient): IUpgradeDatabase => {
 | 
				
			||||||
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
 | 
					 | 
				
			||||||
| 
						
							
	
	
	
	
	
	
	
	 🛠️ 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;
 | 
					    const { ItemId, ...rest } = client;
 | 
				
			||||||
    return {
 | 
					    return {
 | 
				
			||||||
        ...rest,
 | 
					        ...rest,
 | 
				
			||||||
        _id: new Types.ObjectId(client.ItemId.$oid)
 | 
					        _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 --> 
			
			
		 | 
					|||||||
    };
 | 
					    };
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						
							
	
	
	
	
	
	
	
	 ⚠️ 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 --> 
			
			
		 | 
				|||||||
 | 
					
 | 
				
			||||||
const convertOperatorConfig = (client: IOperatorConfigClient): IOperatorConfigDatabase => {
 | 
					const convertOperatorConfig = (client: IOperatorConfigClient): IOperatorConfigDatabase => {
 | 
				
			||||||
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
 | 
					 | 
				
			||||||
| 
						
							
	
	
	
	
	
	
	
	 🛠️ 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;
 | 
					    const { ItemId, ...rest } = client;
 | 
				
			||||||
    return {
 | 
					    return {
 | 
				
			||||||
        ...rest,
 | 
					        ...rest,
 | 
				
			||||||
        _id: new Types.ObjectId(client.ItemId.$oid)
 | 
					        _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 --> 
			
			
		 | 
					|||||||
    };
 | 
					    };
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						
							
	
	
	
	
	
	
	
	 ⚠️ 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 --> 
			
			
		 | 
				|||||||
 | 
					
 | 
				
			||||||
@ -144,11 +140,10 @@ export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<
 | 
				
			|||||||
| 
						
							
	
	
	
	
	
	
	
	 🛠️ 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 => {
 | 
					const convertLoadOutConfig = (client: ILoadoutConfigClient): ILoadoutConfigDatabase => {
 | 
				
			||||||
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
 | 
					 | 
				
			||||||
| 
						
							
	
	
	
	
	
	
	
	 🛠️ 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;
 | 
					    const { ItemId, ...rest } = client;
 | 
				
			||||||
    return {
 | 
					    return {
 | 
				
			||||||
        ...rest,
 | 
					        ...rest,
 | 
				
			||||||
        _id: new Types.ObjectId(client.ItemId.$oid)
 | 
					        _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 --> 
			
			
		 | 
				|||||||
🛠️ Refactor suggestion
Consider using transactions for atomic operations.
The
importInventoryfunction 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.
🛠️ Refactor suggestion
Consider using transactions for atomic operations.
The
importInventoryfunction 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.