feat: import #831
@ -168,6 +168,9 @@ export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<
|
|||||||
|
|||||||
db[key] = client[key];
|
db[key] = client[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
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.InfestedFoundry) {
|
if (client.InfestedFoundry) {
|
||||||
db.InfestedFoundry = convertInfestedFoundry(client.InfestedFoundry);
|
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 -->
|
🛠️ Refactor suggestion
Consider using transactions for atomic operations.
The
importInventory
function performs 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
importInventory
function performs multiple updates that should be atomic. Consider wrapping the operations in a transaction.Additionally, the function should validate the client object structure before processing.