feat: archon shard fusion #785

Merged
Sainan merged 2 commits from shard-fusion into main 2025-01-16 20:09:26 -08:00
4 changed files with 120 additions and 15 deletions

View File

@ -0,0 +1,51 @@
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

🛠️ Refactor suggestion

Add input validation for the request.

The controller needs validation for:

  1. Empty or undefined request.Consumed array
  2. Minimum required items for each fusion type
  3. Invalid color combinations that could crash the combineColors function

Consider adding this validation at the start of the controller:

if (!request.Consumed?.length) {
    throw new Error("No items provided for fusion");
}

switch (request.FusionType) {
    case "AFT_ASCENT":
        if (request.Consumed.length < 1) {
            throw new Error("AFT_ASCENT requires at least 1 item");
        }
        break;
    case "AFT_COALESCENT":
        if (request.Consumed.length < 2) {
            throw new Error("AFT_COALESCENT requires at least 2 items");
        }
        // Validate colors exist in shardToColor mapping
        const color1 = shardToColor[request.Consumed[0].ItemType];
        const color2 = shardToColor[request.Consumed[1].ItemType];
        if (!color1 || !color2) {
            throw new Error("Invalid shard types provided");
        }
        break;
    default:
        throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
_:hammer_and_wrench: Refactor suggestion_ **Add input validation for the request.** The controller needs validation for: 1. Empty or undefined `request.Consumed` array 2. Minimum required items for each fusion type 3. Invalid color combinations that could crash the `combineColors` function Consider adding this validation at the start of the controller: ```typescript if (!request.Consumed?.length) { throw new Error("No items provided for fusion"); } switch (request.FusionType) { case "AFT_ASCENT": if (request.Consumed.length < 1) { throw new Error("AFT_ASCENT requires at least 1 item"); } break; case "AFT_COALESCENT": if (request.Consumed.length < 2) { throw new Error("AFT_COALESCENT requires at least 2 items"); } // Validate colors exist in shardToColor mapping const color1 = shardToColor[request.Consumed[0].ItemType]; const color2 = shardToColor[request.Consumed[1].ItemType]; if (!color1 || !color2) { throw new Error("Invalid shard types provided"); } break; default: throw new Error(`Unknown fusion type: ${request.FusionType}`); } ``` <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

⚠️ Potential issue

Fix the item count negation logic.

The line request.Consumed.forEach(x => x.ItemCount * -1) performs the multiplication but doesn't assign the result back to x.ItemCount.

Apply this diff to fix the negation:

-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
📝 Committable suggestion

‼️ 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.

    request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
_:warning: Potential issue_ **Fix the item count negation logic.** The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`. Apply this diff to fix the negation: ```diff -request.Consumed.forEach(x => x.ItemCount * -1); +request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ``` <!-- 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 request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

🛠️ Refactor suggestion

Add input validation for the request.

The controller needs validation for:

  1. Empty or undefined request.Consumed array
  2. Minimum required items for each fusion type
  3. Invalid color combinations that could crash the combineColors function

Consider adding this validation at the start of the controller:

if (!request.Consumed?.length) {
    throw new Error("No items provided for fusion");
}

switch (request.FusionType) {
    case "AFT_ASCENT":
        if (request.Consumed.length < 1) {
            throw new Error("AFT_ASCENT requires at least 1 item");
        }
        break;
    case "AFT_COALESCENT":
        if (request.Consumed.length < 2) {
            throw new Error("AFT_COALESCENT requires at least 2 items");
        }
        // Validate colors exist in shardToColor mapping
        const color1 = shardToColor[request.Consumed[0].ItemType];
        const color2 = shardToColor[request.Consumed[1].ItemType];
        if (!color1 || !color2) {
            throw new Error("Invalid shard types provided");
        }
        break;
    default:
        throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
_:hammer_and_wrench: Refactor suggestion_ **Add input validation for the request.** The controller needs validation for: 1. Empty or undefined `request.Consumed` array 2. Minimum required items for each fusion type 3. Invalid color combinations that could crash the `combineColors` function Consider adding this validation at the start of the controller: ```typescript if (!request.Consumed?.length) { throw new Error("No items provided for fusion"); } switch (request.FusionType) { case "AFT_ASCENT": if (request.Consumed.length < 1) { throw new Error("AFT_ASCENT requires at least 1 item"); } break; case "AFT_COALESCENT": if (request.Consumed.length < 2) { throw new Error("AFT_COALESCENT requires at least 2 items"); } // Validate colors exist in shardToColor mapping const color1 = shardToColor[request.Consumed[0].ItemType]; const color2 = shardToColor[request.Consumed[1].ItemType]; if (!color1 || !color2) { throw new Error("Invalid shard types provided"); } break; default: throw new Error(`Unknown fusion type: ${request.FusionType}`); } ``` <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

⚠️ Potential issue

Fix the item count negation logic.

The line request.Consumed.forEach(x => x.ItemCount * -1) performs the multiplication but doesn't assign the result back to x.ItemCount.

Apply this diff to fix the negation:

-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
📝 Committable suggestion

‼️ 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.

    request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
_:warning: Potential issue_ **Fix the item count negation logic.** The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`. Apply this diff to fix the negation: ```diff -request.Consumed.forEach(x => x.ItemCount * -1); +request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ``` <!-- 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 request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->
import { RequestHandler } from "express";
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

🛠️ Refactor suggestion

Add input validation for the request.

The controller needs validation for:

  1. Empty or undefined request.Consumed array
  2. Minimum required items for each fusion type
  3. Invalid color combinations that could crash the combineColors function

Consider adding this validation at the start of the controller:

if (!request.Consumed?.length) {
    throw new Error("No items provided for fusion");
}

switch (request.FusionType) {
    case "AFT_ASCENT":
        if (request.Consumed.length < 1) {
            throw new Error("AFT_ASCENT requires at least 1 item");
        }
        break;
    case "AFT_COALESCENT":
        if (request.Consumed.length < 2) {
            throw new Error("AFT_COALESCENT requires at least 2 items");
        }
        // Validate colors exist in shardToColor mapping
        const color1 = shardToColor[request.Consumed[0].ItemType];
        const color2 = shardToColor[request.Consumed[1].ItemType];
        if (!color1 || !color2) {
            throw new Error("Invalid shard types provided");
        }
        break;
    default:
        throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
_:hammer_and_wrench: Refactor suggestion_ **Add input validation for the request.** The controller needs validation for: 1. Empty or undefined `request.Consumed` array 2. Minimum required items for each fusion type 3. Invalid color combinations that could crash the `combineColors` function Consider adding this validation at the start of the controller: ```typescript if (!request.Consumed?.length) { throw new Error("No items provided for fusion"); } switch (request.FusionType) { case "AFT_ASCENT": if (request.Consumed.length < 1) { throw new Error("AFT_ASCENT requires at least 1 item"); } break; case "AFT_COALESCENT": if (request.Consumed.length < 2) { throw new Error("AFT_COALESCENT requires at least 2 items"); } // Validate colors exist in shardToColor mapping const color1 = shardToColor[request.Consumed[0].ItemType]; const color2 = shardToColor[request.Consumed[1].ItemType]; if (!color1 || !color2) { throw new Error("Invalid shard types provided"); } break; default: throw new Error(`Unknown fusion type: ${request.FusionType}`); } ``` <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

⚠️ Potential issue

Fix the item count negation logic.

The line request.Consumed.forEach(x => x.ItemCount * -1) performs the multiplication but doesn't assign the result back to x.ItemCount.

Apply this diff to fix the negation:

-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
📝 Committable suggestion

‼️ 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.

    request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
_:warning: Potential issue_ **Fix the item count negation logic.** The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`. Apply this diff to fix the negation: ```diff -request.Consumed.forEach(x => x.ItemCount * -1); +request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ``` <!-- 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 request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->
import { getAccountIdForRequest } from "@/src/services/loginService";
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

🛠️ Refactor suggestion

Add input validation for the request.

The controller needs validation for:

  1. Empty or undefined request.Consumed array
  2. Minimum required items for each fusion type
  3. Invalid color combinations that could crash the combineColors function

Consider adding this validation at the start of the controller:

if (!request.Consumed?.length) {
    throw new Error("No items provided for fusion");
}

switch (request.FusionType) {
    case "AFT_ASCENT":
        if (request.Consumed.length < 1) {
            throw new Error("AFT_ASCENT requires at least 1 item");
        }
        break;
    case "AFT_COALESCENT":
        if (request.Consumed.length < 2) {
            throw new Error("AFT_COALESCENT requires at least 2 items");
        }
        // Validate colors exist in shardToColor mapping
        const color1 = shardToColor[request.Consumed[0].ItemType];
        const color2 = shardToColor[request.Consumed[1].ItemType];
        if (!color1 || !color2) {
            throw new Error("Invalid shard types provided");
        }
        break;
    default:
        throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
_:hammer_and_wrench: Refactor suggestion_ **Add input validation for the request.** The controller needs validation for: 1. Empty or undefined `request.Consumed` array 2. Minimum required items for each fusion type 3. Invalid color combinations that could crash the `combineColors` function Consider adding this validation at the start of the controller: ```typescript if (!request.Consumed?.length) { throw new Error("No items provided for fusion"); } switch (request.FusionType) { case "AFT_ASCENT": if (request.Consumed.length < 1) { throw new Error("AFT_ASCENT requires at least 1 item"); } break; case "AFT_COALESCENT": if (request.Consumed.length < 2) { throw new Error("AFT_COALESCENT requires at least 2 items"); } // Validate colors exist in shardToColor mapping const color1 = shardToColor[request.Consumed[0].ItemType]; const color2 = shardToColor[request.Consumed[1].ItemType]; if (!color1 || !color2) { throw new Error("Invalid shard types provided"); } break; default: throw new Error(`Unknown fusion type: ${request.FusionType}`); } ``` <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

⚠️ Potential issue

Fix the item count negation logic.

The line request.Consumed.forEach(x => x.ItemCount * -1) performs the multiplication but doesn't assign the result back to x.ItemCount.

Apply this diff to fix the negation:

-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
📝 Committable suggestion

‼️ 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.

    request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
_:warning: Potential issue_ **Fix the item count negation logic.** The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`. Apply this diff to fix the negation: ```diff -request.Consumed.forEach(x => x.ItemCount * -1); +request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ``` <!-- 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 request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->
import { addMiscItems, getInventory } from "@/src/services/inventoryService";
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

🛠️ Refactor suggestion

Add input validation for the request.

The controller needs validation for:

  1. Empty or undefined request.Consumed array
  2. Minimum required items for each fusion type
  3. Invalid color combinations that could crash the combineColors function

Consider adding this validation at the start of the controller:

if (!request.Consumed?.length) {
    throw new Error("No items provided for fusion");
}

switch (request.FusionType) {
    case "AFT_ASCENT":
        if (request.Consumed.length < 1) {
            throw new Error("AFT_ASCENT requires at least 1 item");
        }
        break;
    case "AFT_COALESCENT":
        if (request.Consumed.length < 2) {
            throw new Error("AFT_COALESCENT requires at least 2 items");
        }
        // Validate colors exist in shardToColor mapping
        const color1 = shardToColor[request.Consumed[0].ItemType];
        const color2 = shardToColor[request.Consumed[1].ItemType];
        if (!color1 || !color2) {
            throw new Error("Invalid shard types provided");
        }
        break;
    default:
        throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
_:hammer_and_wrench: Refactor suggestion_ **Add input validation for the request.** The controller needs validation for: 1. Empty or undefined `request.Consumed` array 2. Minimum required items for each fusion type 3. Invalid color combinations that could crash the `combineColors` function Consider adding this validation at the start of the controller: ```typescript if (!request.Consumed?.length) { throw new Error("No items provided for fusion"); } switch (request.FusionType) { case "AFT_ASCENT": if (request.Consumed.length < 1) { throw new Error("AFT_ASCENT requires at least 1 item"); } break; case "AFT_COALESCENT": if (request.Consumed.length < 2) { throw new Error("AFT_COALESCENT requires at least 2 items"); } // Validate colors exist in shardToColor mapping const color1 = shardToColor[request.Consumed[0].ItemType]; const color2 = shardToColor[request.Consumed[1].ItemType]; if (!color1 || !color2) { throw new Error("Invalid shard types provided"); } break; default: throw new Error(`Unknown fusion type: ${request.FusionType}`); } ``` <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

⚠️ Potential issue

Fix the item count negation logic.

The line request.Consumed.forEach(x => x.ItemCount * -1) performs the multiplication but doesn't assign the result back to x.ItemCount.

Apply this diff to fix the negation:

-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
📝 Committable suggestion

‼️ 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.

    request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
_:warning: Potential issue_ **Fix the item count negation logic.** The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`. Apply this diff to fix the negation: ```diff -request.Consumed.forEach(x => x.ItemCount * -1); +request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ``` <!-- 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 request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->
import { IMiscItem } from "@/src/types/inventoryTypes/inventoryTypes";
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

🛠️ Refactor suggestion

Add input validation for the request.

The controller needs validation for:

  1. Empty or undefined request.Consumed array
  2. Minimum required items for each fusion type
  3. Invalid color combinations that could crash the combineColors function

Consider adding this validation at the start of the controller:

if (!request.Consumed?.length) {
    throw new Error("No items provided for fusion");
}

switch (request.FusionType) {
    case "AFT_ASCENT":
        if (request.Consumed.length < 1) {
            throw new Error("AFT_ASCENT requires at least 1 item");
        }
        break;
    case "AFT_COALESCENT":
        if (request.Consumed.length < 2) {
            throw new Error("AFT_COALESCENT requires at least 2 items");
        }
        // Validate colors exist in shardToColor mapping
        const color1 = shardToColor[request.Consumed[0].ItemType];
        const color2 = shardToColor[request.Consumed[1].ItemType];
        if (!color1 || !color2) {
            throw new Error("Invalid shard types provided");
        }
        break;
    default:
        throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
_:hammer_and_wrench: Refactor suggestion_ **Add input validation for the request.** The controller needs validation for: 1. Empty or undefined `request.Consumed` array 2. Minimum required items for each fusion type 3. Invalid color combinations that could crash the `combineColors` function Consider adding this validation at the start of the controller: ```typescript if (!request.Consumed?.length) { throw new Error("No items provided for fusion"); } switch (request.FusionType) { case "AFT_ASCENT": if (request.Consumed.length < 1) { throw new Error("AFT_ASCENT requires at least 1 item"); } break; case "AFT_COALESCENT": if (request.Consumed.length < 2) { throw new Error("AFT_COALESCENT requires at least 2 items"); } // Validate colors exist in shardToColor mapping const color1 = shardToColor[request.Consumed[0].ItemType]; const color2 = shardToColor[request.Consumed[1].ItemType]; if (!color1 || !color2) { throw new Error("Invalid shard types provided"); } break; default: throw new Error(`Unknown fusion type: ${request.FusionType}`); } ``` <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

⚠️ Potential issue

Fix the item count negation logic.

The line request.Consumed.forEach(x => x.ItemCount * -1) performs the multiplication but doesn't assign the result back to x.ItemCount.

Apply this diff to fix the negation:

-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
📝 Committable suggestion

‼️ 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.

    request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
_:warning: Potential issue_ **Fix the item count negation logic.** The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`. Apply this diff to fix the negation: ```diff -request.Consumed.forEach(x => x.ItemCount * -1); +request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ``` <!-- 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 request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->
import { colorToShard, combineColors, shardToColor } from "@/src/helpers/shardHelper";
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

🛠️ Refactor suggestion

Add input validation for the request.

The controller needs validation for:

  1. Empty or undefined request.Consumed array
  2. Minimum required items for each fusion type
  3. Invalid color combinations that could crash the combineColors function

Consider adding this validation at the start of the controller:

if (!request.Consumed?.length) {
    throw new Error("No items provided for fusion");
}

switch (request.FusionType) {
    case "AFT_ASCENT":
        if (request.Consumed.length < 1) {
            throw new Error("AFT_ASCENT requires at least 1 item");
        }
        break;
    case "AFT_COALESCENT":
        if (request.Consumed.length < 2) {
            throw new Error("AFT_COALESCENT requires at least 2 items");
        }
        // Validate colors exist in shardToColor mapping
        const color1 = shardToColor[request.Consumed[0].ItemType];
        const color2 = shardToColor[request.Consumed[1].ItemType];
        if (!color1 || !color2) {
            throw new Error("Invalid shard types provided");
        }
        break;
    default:
        throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
_:hammer_and_wrench: Refactor suggestion_ **Add input validation for the request.** The controller needs validation for: 1. Empty or undefined `request.Consumed` array 2. Minimum required items for each fusion type 3. Invalid color combinations that could crash the `combineColors` function Consider adding this validation at the start of the controller: ```typescript if (!request.Consumed?.length) { throw new Error("No items provided for fusion"); } switch (request.FusionType) { case "AFT_ASCENT": if (request.Consumed.length < 1) { throw new Error("AFT_ASCENT requires at least 1 item"); } break; case "AFT_COALESCENT": if (request.Consumed.length < 2) { throw new Error("AFT_COALESCENT requires at least 2 items"); } // Validate colors exist in shardToColor mapping const color1 = shardToColor[request.Consumed[0].ItemType]; const color2 = shardToColor[request.Consumed[1].ItemType]; if (!color1 || !color2) { throw new Error("Invalid shard types provided"); } break; default: throw new Error(`Unknown fusion type: ${request.FusionType}`); } ``` <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

⚠️ Potential issue

Fix the item count negation logic.

The line request.Consumed.forEach(x => x.ItemCount * -1) performs the multiplication but doesn't assign the result back to x.ItemCount.

Apply this diff to fix the negation:

-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
📝 Committable suggestion

‼️ 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.

    request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
_:warning: Potential issue_ **Fix the item count negation logic.** The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`. Apply this diff to fix the negation: ```diff -request.Consumed.forEach(x => x.ItemCount * -1); +request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ``` <!-- 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 request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

🛠️ Refactor suggestion

Add input validation for the request.

The controller needs validation for:

  1. Empty or undefined request.Consumed array
  2. Minimum required items for each fusion type
  3. Invalid color combinations that could crash the combineColors function

Consider adding this validation at the start of the controller:

if (!request.Consumed?.length) {
    throw new Error("No items provided for fusion");
}

switch (request.FusionType) {
    case "AFT_ASCENT":
        if (request.Consumed.length < 1) {
            throw new Error("AFT_ASCENT requires at least 1 item");
        }
        break;
    case "AFT_COALESCENT":
        if (request.Consumed.length < 2) {
            throw new Error("AFT_COALESCENT requires at least 2 items");
        }
        // Validate colors exist in shardToColor mapping
        const color1 = shardToColor[request.Consumed[0].ItemType];
        const color2 = shardToColor[request.Consumed[1].ItemType];
        if (!color1 || !color2) {
            throw new Error("Invalid shard types provided");
        }
        break;
    default:
        throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
_:hammer_and_wrench: Refactor suggestion_ **Add input validation for the request.** The controller needs validation for: 1. Empty or undefined `request.Consumed` array 2. Minimum required items for each fusion type 3. Invalid color combinations that could crash the `combineColors` function Consider adding this validation at the start of the controller: ```typescript if (!request.Consumed?.length) { throw new Error("No items provided for fusion"); } switch (request.FusionType) { case "AFT_ASCENT": if (request.Consumed.length < 1) { throw new Error("AFT_ASCENT requires at least 1 item"); } break; case "AFT_COALESCENT": if (request.Consumed.length < 2) { throw new Error("AFT_COALESCENT requires at least 2 items"); } // Validate colors exist in shardToColor mapping const color1 = shardToColor[request.Consumed[0].ItemType]; const color2 = shardToColor[request.Consumed[1].ItemType]; if (!color1 || !color2) { throw new Error("Invalid shard types provided"); } break; default: throw new Error(`Unknown fusion type: ${request.FusionType}`); } ``` <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

⚠️ Potential issue

Fix the item count negation logic.

The line request.Consumed.forEach(x => x.ItemCount * -1) performs the multiplication but doesn't assign the result back to x.ItemCount.

Apply this diff to fix the negation:

-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
📝 Committable suggestion

‼️ 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.

    request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
_:warning: Potential issue_ **Fix the item count negation logic.** The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`. Apply this diff to fix the negation: ```diff -request.Consumed.forEach(x => x.ItemCount * -1); +request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ``` <!-- 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 request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->
export const archonFusionController: RequestHandler = async (req, res) => {
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

🛠️ Refactor suggestion

Add input validation for the request.

The controller needs validation for:

  1. Empty or undefined request.Consumed array
  2. Minimum required items for each fusion type
  3. Invalid color combinations that could crash the combineColors function

Consider adding this validation at the start of the controller:

if (!request.Consumed?.length) {
    throw new Error("No items provided for fusion");
}

switch (request.FusionType) {
    case "AFT_ASCENT":
        if (request.Consumed.length < 1) {
            throw new Error("AFT_ASCENT requires at least 1 item");
        }
        break;
    case "AFT_COALESCENT":
        if (request.Consumed.length < 2) {
            throw new Error("AFT_COALESCENT requires at least 2 items");
        }
        // Validate colors exist in shardToColor mapping
        const color1 = shardToColor[request.Consumed[0].ItemType];
        const color2 = shardToColor[request.Consumed[1].ItemType];
        if (!color1 || !color2) {
            throw new Error("Invalid shard types provided");
        }
        break;
    default:
        throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
_:hammer_and_wrench: Refactor suggestion_ **Add input validation for the request.** The controller needs validation for: 1. Empty or undefined `request.Consumed` array 2. Minimum required items for each fusion type 3. Invalid color combinations that could crash the `combineColors` function Consider adding this validation at the start of the controller: ```typescript if (!request.Consumed?.length) { throw new Error("No items provided for fusion"); } switch (request.FusionType) { case "AFT_ASCENT": if (request.Consumed.length < 1) { throw new Error("AFT_ASCENT requires at least 1 item"); } break; case "AFT_COALESCENT": if (request.Consumed.length < 2) { throw new Error("AFT_COALESCENT requires at least 2 items"); } // Validate colors exist in shardToColor mapping const color1 = shardToColor[request.Consumed[0].ItemType]; const color2 = shardToColor[request.Consumed[1].ItemType]; if (!color1 || !color2) { throw new Error("Invalid shard types provided"); } break; default: throw new Error(`Unknown fusion type: ${request.FusionType}`); } ``` <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

⚠️ Potential issue

Fix the item count negation logic.

The line request.Consumed.forEach(x => x.ItemCount * -1) performs the multiplication but doesn't assign the result back to x.ItemCount.

Apply this diff to fix the negation:

-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
📝 Committable suggestion

‼️ 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.

    request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
_:warning: Potential issue_ **Fix the item count negation logic.** The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`. Apply this diff to fix the negation: ```diff -request.Consumed.forEach(x => x.ItemCount * -1); +request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ``` <!-- 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 request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->
const accountId = await getAccountIdForRequest(req);
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

🛠️ Refactor suggestion

Add input validation for the request.

The controller needs validation for:

  1. Empty or undefined request.Consumed array
  2. Minimum required items for each fusion type
  3. Invalid color combinations that could crash the combineColors function

Consider adding this validation at the start of the controller:

if (!request.Consumed?.length) {
    throw new Error("No items provided for fusion");
}

switch (request.FusionType) {
    case "AFT_ASCENT":
        if (request.Consumed.length < 1) {
            throw new Error("AFT_ASCENT requires at least 1 item");
        }
        break;
    case "AFT_COALESCENT":
        if (request.Consumed.length < 2) {
            throw new Error("AFT_COALESCENT requires at least 2 items");
        }
        // Validate colors exist in shardToColor mapping
        const color1 = shardToColor[request.Consumed[0].ItemType];
        const color2 = shardToColor[request.Consumed[1].ItemType];
        if (!color1 || !color2) {
            throw new Error("Invalid shard types provided");
        }
        break;
    default:
        throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
_:hammer_and_wrench: Refactor suggestion_ **Add input validation for the request.** The controller needs validation for: 1. Empty or undefined `request.Consumed` array 2. Minimum required items for each fusion type 3. Invalid color combinations that could crash the `combineColors` function Consider adding this validation at the start of the controller: ```typescript if (!request.Consumed?.length) { throw new Error("No items provided for fusion"); } switch (request.FusionType) { case "AFT_ASCENT": if (request.Consumed.length < 1) { throw new Error("AFT_ASCENT requires at least 1 item"); } break; case "AFT_COALESCENT": if (request.Consumed.length < 2) { throw new Error("AFT_COALESCENT requires at least 2 items"); } // Validate colors exist in shardToColor mapping const color1 = shardToColor[request.Consumed[0].ItemType]; const color2 = shardToColor[request.Consumed[1].ItemType]; if (!color1 || !color2) { throw new Error("Invalid shard types provided"); } break; default: throw new Error(`Unknown fusion type: ${request.FusionType}`); } ``` <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

⚠️ Potential issue

Fix the item count negation logic.

The line request.Consumed.forEach(x => x.ItemCount * -1) performs the multiplication but doesn't assign the result back to x.ItemCount.

Apply this diff to fix the negation:

-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
📝 Committable suggestion

‼️ 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.

    request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
_:warning: Potential issue_ **Fix the item count negation logic.** The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`. Apply this diff to fix the negation: ```diff -request.Consumed.forEach(x => x.ItemCount * -1); +request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ``` <!-- 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 request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->
const request = JSON.parse(String(req.body)) as IArchonFusionRequest;
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

🛠️ Refactor suggestion

Add input validation for the request.

The controller needs validation for:

  1. Empty or undefined request.Consumed array
  2. Minimum required items for each fusion type
  3. Invalid color combinations that could crash the combineColors function

Consider adding this validation at the start of the controller:

if (!request.Consumed?.length) {
    throw new Error("No items provided for fusion");
}

switch (request.FusionType) {
    case "AFT_ASCENT":
        if (request.Consumed.length < 1) {
            throw new Error("AFT_ASCENT requires at least 1 item");
        }
        break;
    case "AFT_COALESCENT":
        if (request.Consumed.length < 2) {
            throw new Error("AFT_COALESCENT requires at least 2 items");
        }
        // Validate colors exist in shardToColor mapping
        const color1 = shardToColor[request.Consumed[0].ItemType];
        const color2 = shardToColor[request.Consumed[1].ItemType];
        if (!color1 || !color2) {
            throw new Error("Invalid shard types provided");
        }
        break;
    default:
        throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
_:hammer_and_wrench: Refactor suggestion_ **Add input validation for the request.** The controller needs validation for: 1. Empty or undefined `request.Consumed` array 2. Minimum required items for each fusion type 3. Invalid color combinations that could crash the `combineColors` function Consider adding this validation at the start of the controller: ```typescript if (!request.Consumed?.length) { throw new Error("No items provided for fusion"); } switch (request.FusionType) { case "AFT_ASCENT": if (request.Consumed.length < 1) { throw new Error("AFT_ASCENT requires at least 1 item"); } break; case "AFT_COALESCENT": if (request.Consumed.length < 2) { throw new Error("AFT_COALESCENT requires at least 2 items"); } // Validate colors exist in shardToColor mapping const color1 = shardToColor[request.Consumed[0].ItemType]; const color2 = shardToColor[request.Consumed[1].ItemType]; if (!color1 || !color2) { throw new Error("Invalid shard types provided"); } break; default: throw new Error(`Unknown fusion type: ${request.FusionType}`); } ``` <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

⚠️ Potential issue

Fix the item count negation logic.

The line request.Consumed.forEach(x => x.ItemCount * -1) performs the multiplication but doesn't assign the result back to x.ItemCount.

Apply this diff to fix the negation:

-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
📝 Committable suggestion

‼️ 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.

    request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
_:warning: Potential issue_ **Fix the item count negation logic.** The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`. Apply this diff to fix the negation: ```diff -request.Consumed.forEach(x => x.ItemCount * -1); +request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ``` <!-- 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 request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->
const inventory = await getInventory(accountId);
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

🛠️ Refactor suggestion

Add input validation for the request.

The controller needs validation for:

  1. Empty or undefined request.Consumed array
  2. Minimum required items for each fusion type
  3. Invalid color combinations that could crash the combineColors function

Consider adding this validation at the start of the controller:

if (!request.Consumed?.length) {
    throw new Error("No items provided for fusion");
}

switch (request.FusionType) {
    case "AFT_ASCENT":
        if (request.Consumed.length < 1) {
            throw new Error("AFT_ASCENT requires at least 1 item");
        }
        break;
    case "AFT_COALESCENT":
        if (request.Consumed.length < 2) {
            throw new Error("AFT_COALESCENT requires at least 2 items");
        }
        // Validate colors exist in shardToColor mapping
        const color1 = shardToColor[request.Consumed[0].ItemType];
        const color2 = shardToColor[request.Consumed[1].ItemType];
        if (!color1 || !color2) {
            throw new Error("Invalid shard types provided");
        }
        break;
    default:
        throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
_:hammer_and_wrench: Refactor suggestion_ **Add input validation for the request.** The controller needs validation for: 1. Empty or undefined `request.Consumed` array 2. Minimum required items for each fusion type 3. Invalid color combinations that could crash the `combineColors` function Consider adding this validation at the start of the controller: ```typescript if (!request.Consumed?.length) { throw new Error("No items provided for fusion"); } switch (request.FusionType) { case "AFT_ASCENT": if (request.Consumed.length < 1) { throw new Error("AFT_ASCENT requires at least 1 item"); } break; case "AFT_COALESCENT": if (request.Consumed.length < 2) { throw new Error("AFT_COALESCENT requires at least 2 items"); } // Validate colors exist in shardToColor mapping const color1 = shardToColor[request.Consumed[0].ItemType]; const color2 = shardToColor[request.Consumed[1].ItemType]; if (!color1 || !color2) { throw new Error("Invalid shard types provided"); } break; default: throw new Error(`Unknown fusion type: ${request.FusionType}`); } ``` <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

⚠️ Potential issue

Fix the item count negation logic.

The line request.Consumed.forEach(x => x.ItemCount * -1) performs the multiplication but doesn't assign the result back to x.ItemCount.

Apply this diff to fix the negation:

-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
📝 Committable suggestion

‼️ 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.

    request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
_:warning: Potential issue_ **Fix the item count negation logic.** The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`. Apply this diff to fix the negation: ```diff -request.Consumed.forEach(x => x.ItemCount * -1); +request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ``` <!-- 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 request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->
request.Consumed.forEach(x => {
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

🛠️ Refactor suggestion

Add input validation for the request.

The controller needs validation for:

  1. Empty or undefined request.Consumed array
  2. Minimum required items for each fusion type
  3. Invalid color combinations that could crash the combineColors function

Consider adding this validation at the start of the controller:

if (!request.Consumed?.length) {
    throw new Error("No items provided for fusion");
}

switch (request.FusionType) {
    case "AFT_ASCENT":
        if (request.Consumed.length < 1) {
            throw new Error("AFT_ASCENT requires at least 1 item");
        }
        break;
    case "AFT_COALESCENT":
        if (request.Consumed.length < 2) {
            throw new Error("AFT_COALESCENT requires at least 2 items");
        }
        // Validate colors exist in shardToColor mapping
        const color1 = shardToColor[request.Consumed[0].ItemType];
        const color2 = shardToColor[request.Consumed[1].ItemType];
        if (!color1 || !color2) {
            throw new Error("Invalid shard types provided");
        }
        break;
    default:
        throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
_:hammer_and_wrench: Refactor suggestion_ **Add input validation for the request.** The controller needs validation for: 1. Empty or undefined `request.Consumed` array 2. Minimum required items for each fusion type 3. Invalid color combinations that could crash the `combineColors` function Consider adding this validation at the start of the controller: ```typescript if (!request.Consumed?.length) { throw new Error("No items provided for fusion"); } switch (request.FusionType) { case "AFT_ASCENT": if (request.Consumed.length < 1) { throw new Error("AFT_ASCENT requires at least 1 item"); } break; case "AFT_COALESCENT": if (request.Consumed.length < 2) { throw new Error("AFT_COALESCENT requires at least 2 items"); } // Validate colors exist in shardToColor mapping const color1 = shardToColor[request.Consumed[0].ItemType]; const color2 = shardToColor[request.Consumed[1].ItemType]; if (!color1 || !color2) { throw new Error("Invalid shard types provided"); } break; default: throw new Error(`Unknown fusion type: ${request.FusionType}`); } ``` <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

⚠️ Potential issue

Fix the item count negation logic.

The line request.Consumed.forEach(x => x.ItemCount * -1) performs the multiplication but doesn't assign the result back to x.ItemCount.

Apply this diff to fix the negation:

-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
📝 Committable suggestion

‼️ 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.

    request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
_:warning: Potential issue_ **Fix the item count negation logic.** The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`. Apply this diff to fix the negation: ```diff -request.Consumed.forEach(x => x.ItemCount * -1); +request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ``` <!-- 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 request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->
x.ItemCount *= -1;
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

🛠️ Refactor suggestion

Add input validation for the request.

The controller needs validation for:

  1. Empty or undefined request.Consumed array
  2. Minimum required items for each fusion type
  3. Invalid color combinations that could crash the combineColors function

Consider adding this validation at the start of the controller:

if (!request.Consumed?.length) {
    throw new Error("No items provided for fusion");
}

switch (request.FusionType) {
    case "AFT_ASCENT":
        if (request.Consumed.length < 1) {
            throw new Error("AFT_ASCENT requires at least 1 item");
        }
        break;
    case "AFT_COALESCENT":
        if (request.Consumed.length < 2) {
            throw new Error("AFT_COALESCENT requires at least 2 items");
        }
        // Validate colors exist in shardToColor mapping
        const color1 = shardToColor[request.Consumed[0].ItemType];
        const color2 = shardToColor[request.Consumed[1].ItemType];
        if (!color1 || !color2) {
            throw new Error("Invalid shard types provided");
        }
        break;
    default:
        throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
_:hammer_and_wrench: Refactor suggestion_ **Add input validation for the request.** The controller needs validation for: 1. Empty or undefined `request.Consumed` array 2. Minimum required items for each fusion type 3. Invalid color combinations that could crash the `combineColors` function Consider adding this validation at the start of the controller: ```typescript if (!request.Consumed?.length) { throw new Error("No items provided for fusion"); } switch (request.FusionType) { case "AFT_ASCENT": if (request.Consumed.length < 1) { throw new Error("AFT_ASCENT requires at least 1 item"); } break; case "AFT_COALESCENT": if (request.Consumed.length < 2) { throw new Error("AFT_COALESCENT requires at least 2 items"); } // Validate colors exist in shardToColor mapping const color1 = shardToColor[request.Consumed[0].ItemType]; const color2 = shardToColor[request.Consumed[1].ItemType]; if (!color1 || !color2) { throw new Error("Invalid shard types provided"); } break; default: throw new Error(`Unknown fusion type: ${request.FusionType}`); } ``` <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

⚠️ Potential issue

Fix the item count negation logic.

The line request.Consumed.forEach(x => x.ItemCount * -1) performs the multiplication but doesn't assign the result back to x.ItemCount.

Apply this diff to fix the negation:

-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
📝 Committable suggestion

‼️ 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.

    request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
_:warning: Potential issue_ **Fix the item count negation logic.** The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`. Apply this diff to fix the negation: ```diff -request.Consumed.forEach(x => x.ItemCount * -1); +request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ``` <!-- 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 request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->
});
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

🛠️ Refactor suggestion

Add input validation for the request.

The controller needs validation for:

  1. Empty or undefined request.Consumed array
  2. Minimum required items for each fusion type
  3. Invalid color combinations that could crash the combineColors function

Consider adding this validation at the start of the controller:

if (!request.Consumed?.length) {
    throw new Error("No items provided for fusion");
}

switch (request.FusionType) {
    case "AFT_ASCENT":
        if (request.Consumed.length < 1) {
            throw new Error("AFT_ASCENT requires at least 1 item");
        }
        break;
    case "AFT_COALESCENT":
        if (request.Consumed.length < 2) {
            throw new Error("AFT_COALESCENT requires at least 2 items");
        }
        // Validate colors exist in shardToColor mapping
        const color1 = shardToColor[request.Consumed[0].ItemType];
        const color2 = shardToColor[request.Consumed[1].ItemType];
        if (!color1 || !color2) {
            throw new Error("Invalid shard types provided");
        }
        break;
    default:
        throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
_:hammer_and_wrench: Refactor suggestion_ **Add input validation for the request.** The controller needs validation for: 1. Empty or undefined `request.Consumed` array 2. Minimum required items for each fusion type 3. Invalid color combinations that could crash the `combineColors` function Consider adding this validation at the start of the controller: ```typescript if (!request.Consumed?.length) { throw new Error("No items provided for fusion"); } switch (request.FusionType) { case "AFT_ASCENT": if (request.Consumed.length < 1) { throw new Error("AFT_ASCENT requires at least 1 item"); } break; case "AFT_COALESCENT": if (request.Consumed.length < 2) { throw new Error("AFT_COALESCENT requires at least 2 items"); } // Validate colors exist in shardToColor mapping const color1 = shardToColor[request.Consumed[0].ItemType]; const color2 = shardToColor[request.Consumed[1].ItemType]; if (!color1 || !color2) { throw new Error("Invalid shard types provided"); } break; default: throw new Error(`Unknown fusion type: ${request.FusionType}`); } ``` <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

⚠️ Potential issue

Fix the item count negation logic.

The line request.Consumed.forEach(x => x.ItemCount * -1) performs the multiplication but doesn't assign the result back to x.ItemCount.

Apply this diff to fix the negation:

-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
📝 Committable suggestion

‼️ 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.

    request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
_:warning: Potential issue_ **Fix the item count negation logic.** The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`. Apply this diff to fix the negation: ```diff -request.Consumed.forEach(x => x.ItemCount * -1); +request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ``` <!-- 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 request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->
addMiscItems(inventory, request.Consumed);
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

🛠️ Refactor suggestion

Add input validation for the request.

The controller needs validation for:

  1. Empty or undefined request.Consumed array
  2. Minimum required items for each fusion type
  3. Invalid color combinations that could crash the combineColors function

Consider adding this validation at the start of the controller:

if (!request.Consumed?.length) {
    throw new Error("No items provided for fusion");
}

switch (request.FusionType) {
    case "AFT_ASCENT":
        if (request.Consumed.length < 1) {
            throw new Error("AFT_ASCENT requires at least 1 item");
        }
        break;
    case "AFT_COALESCENT":
        if (request.Consumed.length < 2) {
            throw new Error("AFT_COALESCENT requires at least 2 items");
        }
        // Validate colors exist in shardToColor mapping
        const color1 = shardToColor[request.Consumed[0].ItemType];
        const color2 = shardToColor[request.Consumed[1].ItemType];
        if (!color1 || !color2) {
            throw new Error("Invalid shard types provided");
        }
        break;
    default:
        throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
_:hammer_and_wrench: Refactor suggestion_ **Add input validation for the request.** The controller needs validation for: 1. Empty or undefined `request.Consumed` array 2. Minimum required items for each fusion type 3. Invalid color combinations that could crash the `combineColors` function Consider adding this validation at the start of the controller: ```typescript if (!request.Consumed?.length) { throw new Error("No items provided for fusion"); } switch (request.FusionType) { case "AFT_ASCENT": if (request.Consumed.length < 1) { throw new Error("AFT_ASCENT requires at least 1 item"); } break; case "AFT_COALESCENT": if (request.Consumed.length < 2) { throw new Error("AFT_COALESCENT requires at least 2 items"); } // Validate colors exist in shardToColor mapping const color1 = shardToColor[request.Consumed[0].ItemType]; const color2 = shardToColor[request.Consumed[1].ItemType]; if (!color1 || !color2) { throw new Error("Invalid shard types provided"); } break; default: throw new Error(`Unknown fusion type: ${request.FusionType}`); } ``` <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

⚠️ Potential issue

Fix the item count negation logic.

The line request.Consumed.forEach(x => x.ItemCount * -1) performs the multiplication but doesn't assign the result back to x.ItemCount.

Apply this diff to fix the negation:

-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
📝 Committable suggestion

‼️ 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.

    request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
_:warning: Potential issue_ **Fix the item count negation logic.** The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`. Apply this diff to fix the negation: ```diff -request.Consumed.forEach(x => x.ItemCount * -1); +request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ``` <!-- 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 request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->
const newArchons: IMiscItem[] = [];
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

🛠️ Refactor suggestion

Add input validation for the request.

The controller needs validation for:

  1. Empty or undefined request.Consumed array
  2. Minimum required items for each fusion type
  3. Invalid color combinations that could crash the combineColors function

Consider adding this validation at the start of the controller:

if (!request.Consumed?.length) {
    throw new Error("No items provided for fusion");
}

switch (request.FusionType) {
    case "AFT_ASCENT":
        if (request.Consumed.length < 1) {
            throw new Error("AFT_ASCENT requires at least 1 item");
        }
        break;
    case "AFT_COALESCENT":
        if (request.Consumed.length < 2) {
            throw new Error("AFT_COALESCENT requires at least 2 items");
        }
        // Validate colors exist in shardToColor mapping
        const color1 = shardToColor[request.Consumed[0].ItemType];
        const color2 = shardToColor[request.Consumed[1].ItemType];
        if (!color1 || !color2) {
            throw new Error("Invalid shard types provided");
        }
        break;
    default:
        throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
_:hammer_and_wrench: Refactor suggestion_ **Add input validation for the request.** The controller needs validation for: 1. Empty or undefined `request.Consumed` array 2. Minimum required items for each fusion type 3. Invalid color combinations that could crash the `combineColors` function Consider adding this validation at the start of the controller: ```typescript if (!request.Consumed?.length) { throw new Error("No items provided for fusion"); } switch (request.FusionType) { case "AFT_ASCENT": if (request.Consumed.length < 1) { throw new Error("AFT_ASCENT requires at least 1 item"); } break; case "AFT_COALESCENT": if (request.Consumed.length < 2) { throw new Error("AFT_COALESCENT requires at least 2 items"); } // Validate colors exist in shardToColor mapping const color1 = shardToColor[request.Consumed[0].ItemType]; const color2 = shardToColor[request.Consumed[1].ItemType]; if (!color1 || !color2) { throw new Error("Invalid shard types provided"); } break; default: throw new Error(`Unknown fusion type: ${request.FusionType}`); } ``` <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

⚠️ Potential issue

Fix the item count negation logic.

The line request.Consumed.forEach(x => x.ItemCount * -1) performs the multiplication but doesn't assign the result back to x.ItemCount.

Apply this diff to fix the negation:

-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
📝 Committable suggestion

‼️ 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.

    request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
_:warning: Potential issue_ **Fix the item count negation logic.** The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`. Apply this diff to fix the negation: ```diff -request.Consumed.forEach(x => x.ItemCount * -1); +request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ``` <!-- 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 request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->
switch (request.FusionType) {
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

🛠️ Refactor suggestion

Add input validation for the request.

The controller needs validation for:

  1. Empty or undefined request.Consumed array
  2. Minimum required items for each fusion type
  3. Invalid color combinations that could crash the combineColors function

Consider adding this validation at the start of the controller:

if (!request.Consumed?.length) {
    throw new Error("No items provided for fusion");
}

switch (request.FusionType) {
    case "AFT_ASCENT":
        if (request.Consumed.length < 1) {
            throw new Error("AFT_ASCENT requires at least 1 item");
        }
        break;
    case "AFT_COALESCENT":
        if (request.Consumed.length < 2) {
            throw new Error("AFT_COALESCENT requires at least 2 items");
        }
        // Validate colors exist in shardToColor mapping
        const color1 = shardToColor[request.Consumed[0].ItemType];
        const color2 = shardToColor[request.Consumed[1].ItemType];
        if (!color1 || !color2) {
            throw new Error("Invalid shard types provided");
        }
        break;
    default:
        throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
_:hammer_and_wrench: Refactor suggestion_ **Add input validation for the request.** The controller needs validation for: 1. Empty or undefined `request.Consumed` array 2. Minimum required items for each fusion type 3. Invalid color combinations that could crash the `combineColors` function Consider adding this validation at the start of the controller: ```typescript if (!request.Consumed?.length) { throw new Error("No items provided for fusion"); } switch (request.FusionType) { case "AFT_ASCENT": if (request.Consumed.length < 1) { throw new Error("AFT_ASCENT requires at least 1 item"); } break; case "AFT_COALESCENT": if (request.Consumed.length < 2) { throw new Error("AFT_COALESCENT requires at least 2 items"); } // Validate colors exist in shardToColor mapping const color1 = shardToColor[request.Consumed[0].ItemType]; const color2 = shardToColor[request.Consumed[1].ItemType]; if (!color1 || !color2) { throw new Error("Invalid shard types provided"); } break; default: throw new Error(`Unknown fusion type: ${request.FusionType}`); } ``` <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

⚠️ Potential issue

Fix the item count negation logic.

The line request.Consumed.forEach(x => x.ItemCount * -1) performs the multiplication but doesn't assign the result back to x.ItemCount.

Apply this diff to fix the negation:

-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
📝 Committable suggestion

‼️ 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.

    request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
_:warning: Potential issue_ **Fix the item count negation logic.** The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`. Apply this diff to fix the negation: ```diff -request.Consumed.forEach(x => x.ItemCount * -1); +request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ``` <!-- 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 request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->
case "AFT_ASCENT":
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

🛠️ Refactor suggestion

Add input validation for the request.

The controller needs validation for:

  1. Empty or undefined request.Consumed array
  2. Minimum required items for each fusion type
  3. Invalid color combinations that could crash the combineColors function

Consider adding this validation at the start of the controller:

if (!request.Consumed?.length) {
    throw new Error("No items provided for fusion");
}

switch (request.FusionType) {
    case "AFT_ASCENT":
        if (request.Consumed.length < 1) {
            throw new Error("AFT_ASCENT requires at least 1 item");
        }
        break;
    case "AFT_COALESCENT":
        if (request.Consumed.length < 2) {
            throw new Error("AFT_COALESCENT requires at least 2 items");
        }
        // Validate colors exist in shardToColor mapping
        const color1 = shardToColor[request.Consumed[0].ItemType];
        const color2 = shardToColor[request.Consumed[1].ItemType];
        if (!color1 || !color2) {
            throw new Error("Invalid shard types provided");
        }
        break;
    default:
        throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
_:hammer_and_wrench: Refactor suggestion_ **Add input validation for the request.** The controller needs validation for: 1. Empty or undefined `request.Consumed` array 2. Minimum required items for each fusion type 3. Invalid color combinations that could crash the `combineColors` function Consider adding this validation at the start of the controller: ```typescript if (!request.Consumed?.length) { throw new Error("No items provided for fusion"); } switch (request.FusionType) { case "AFT_ASCENT": if (request.Consumed.length < 1) { throw new Error("AFT_ASCENT requires at least 1 item"); } break; case "AFT_COALESCENT": if (request.Consumed.length < 2) { throw new Error("AFT_COALESCENT requires at least 2 items"); } // Validate colors exist in shardToColor mapping const color1 = shardToColor[request.Consumed[0].ItemType]; const color2 = shardToColor[request.Consumed[1].ItemType]; if (!color1 || !color2) { throw new Error("Invalid shard types provided"); } break; default: throw new Error(`Unknown fusion type: ${request.FusionType}`); } ``` <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

⚠️ Potential issue

Fix the item count negation logic.

The line request.Consumed.forEach(x => x.ItemCount * -1) performs the multiplication but doesn't assign the result back to x.ItemCount.

Apply this diff to fix the negation:

-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
📝 Committable suggestion

‼️ 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.

    request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
_:warning: Potential issue_ **Fix the item count negation logic.** The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`. Apply this diff to fix the negation: ```diff -request.Consumed.forEach(x => x.ItemCount * -1); +request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ``` <!-- 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 request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->
newArchons.push({
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

🛠️ Refactor suggestion

Add input validation for the request.

The controller needs validation for:

  1. Empty or undefined request.Consumed array
  2. Minimum required items for each fusion type
  3. Invalid color combinations that could crash the combineColors function

Consider adding this validation at the start of the controller:

if (!request.Consumed?.length) {
    throw new Error("No items provided for fusion");
}

switch (request.FusionType) {
    case "AFT_ASCENT":
        if (request.Consumed.length < 1) {
            throw new Error("AFT_ASCENT requires at least 1 item");
        }
        break;
    case "AFT_COALESCENT":
        if (request.Consumed.length < 2) {
            throw new Error("AFT_COALESCENT requires at least 2 items");
        }
        // Validate colors exist in shardToColor mapping
        const color1 = shardToColor[request.Consumed[0].ItemType];
        const color2 = shardToColor[request.Consumed[1].ItemType];
        if (!color1 || !color2) {
            throw new Error("Invalid shard types provided");
        }
        break;
    default:
        throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
_:hammer_and_wrench: Refactor suggestion_ **Add input validation for the request.** The controller needs validation for: 1. Empty or undefined `request.Consumed` array 2. Minimum required items for each fusion type 3. Invalid color combinations that could crash the `combineColors` function Consider adding this validation at the start of the controller: ```typescript if (!request.Consumed?.length) { throw new Error("No items provided for fusion"); } switch (request.FusionType) { case "AFT_ASCENT": if (request.Consumed.length < 1) { throw new Error("AFT_ASCENT requires at least 1 item"); } break; case "AFT_COALESCENT": if (request.Consumed.length < 2) { throw new Error("AFT_COALESCENT requires at least 2 items"); } // Validate colors exist in shardToColor mapping const color1 = shardToColor[request.Consumed[0].ItemType]; const color2 = shardToColor[request.Consumed[1].ItemType]; if (!color1 || !color2) { throw new Error("Invalid shard types provided"); } break; default: throw new Error(`Unknown fusion type: ${request.FusionType}`); } ``` <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

⚠️ Potential issue

Fix the item count negation logic.

The line request.Consumed.forEach(x => x.ItemCount * -1) performs the multiplication but doesn't assign the result back to x.ItemCount.

Apply this diff to fix the negation:

-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
📝 Committable suggestion

‼️ 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.

    request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
_:warning: Potential issue_ **Fix the item count negation logic.** The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`. Apply this diff to fix the negation: ```diff -request.Consumed.forEach(x => x.ItemCount * -1); +request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ``` <!-- 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 request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->
ItemType: request.Consumed[0].ItemType + "Mythic",
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

🛠️ Refactor suggestion

Add input validation for the request.

The controller needs validation for:

  1. Empty or undefined request.Consumed array
  2. Minimum required items for each fusion type
  3. Invalid color combinations that could crash the combineColors function

Consider adding this validation at the start of the controller:

if (!request.Consumed?.length) {
    throw new Error("No items provided for fusion");
}

switch (request.FusionType) {
    case "AFT_ASCENT":
        if (request.Consumed.length < 1) {
            throw new Error("AFT_ASCENT requires at least 1 item");
        }
        break;
    case "AFT_COALESCENT":
        if (request.Consumed.length < 2) {
            throw new Error("AFT_COALESCENT requires at least 2 items");
        }
        // Validate colors exist in shardToColor mapping
        const color1 = shardToColor[request.Consumed[0].ItemType];
        const color2 = shardToColor[request.Consumed[1].ItemType];
        if (!color1 || !color2) {
            throw new Error("Invalid shard types provided");
        }
        break;
    default:
        throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
_:hammer_and_wrench: Refactor suggestion_ **Add input validation for the request.** The controller needs validation for: 1. Empty or undefined `request.Consumed` array 2. Minimum required items for each fusion type 3. Invalid color combinations that could crash the `combineColors` function Consider adding this validation at the start of the controller: ```typescript if (!request.Consumed?.length) { throw new Error("No items provided for fusion"); } switch (request.FusionType) { case "AFT_ASCENT": if (request.Consumed.length < 1) { throw new Error("AFT_ASCENT requires at least 1 item"); } break; case "AFT_COALESCENT": if (request.Consumed.length < 2) { throw new Error("AFT_COALESCENT requires at least 2 items"); } // Validate colors exist in shardToColor mapping const color1 = shardToColor[request.Consumed[0].ItemType]; const color2 = shardToColor[request.Consumed[1].ItemType]; if (!color1 || !color2) { throw new Error("Invalid shard types provided"); } break; default: throw new Error(`Unknown fusion type: ${request.FusionType}`); } ``` <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

⚠️ Potential issue

Fix the item count negation logic.

The line request.Consumed.forEach(x => x.ItemCount * -1) performs the multiplication but doesn't assign the result back to x.ItemCount.

Apply this diff to fix the negation:

-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
📝 Committable suggestion

‼️ 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.

    request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
_:warning: Potential issue_ **Fix the item count negation logic.** The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`. Apply this diff to fix the negation: ```diff -request.Consumed.forEach(x => x.ItemCount * -1); +request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ``` <!-- 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 request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->
ItemCount: 1
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

🛠️ Refactor suggestion

Add input validation for the request.

The controller needs validation for:

  1. Empty or undefined request.Consumed array
  2. Minimum required items for each fusion type
  3. Invalid color combinations that could crash the combineColors function

Consider adding this validation at the start of the controller:

if (!request.Consumed?.length) {
    throw new Error("No items provided for fusion");
}

switch (request.FusionType) {
    case "AFT_ASCENT":
        if (request.Consumed.length < 1) {
            throw new Error("AFT_ASCENT requires at least 1 item");
        }
        break;
    case "AFT_COALESCENT":
        if (request.Consumed.length < 2) {
            throw new Error("AFT_COALESCENT requires at least 2 items");
        }
        // Validate colors exist in shardToColor mapping
        const color1 = shardToColor[request.Consumed[0].ItemType];
        const color2 = shardToColor[request.Consumed[1].ItemType];
        if (!color1 || !color2) {
            throw new Error("Invalid shard types provided");
        }
        break;
    default:
        throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
_:hammer_and_wrench: Refactor suggestion_ **Add input validation for the request.** The controller needs validation for: 1. Empty or undefined `request.Consumed` array 2. Minimum required items for each fusion type 3. Invalid color combinations that could crash the `combineColors` function Consider adding this validation at the start of the controller: ```typescript if (!request.Consumed?.length) { throw new Error("No items provided for fusion"); } switch (request.FusionType) { case "AFT_ASCENT": if (request.Consumed.length < 1) { throw new Error("AFT_ASCENT requires at least 1 item"); } break; case "AFT_COALESCENT": if (request.Consumed.length < 2) { throw new Error("AFT_COALESCENT requires at least 2 items"); } // Validate colors exist in shardToColor mapping const color1 = shardToColor[request.Consumed[0].ItemType]; const color2 = shardToColor[request.Consumed[1].ItemType]; if (!color1 || !color2) { throw new Error("Invalid shard types provided"); } break; default: throw new Error(`Unknown fusion type: ${request.FusionType}`); } ``` <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

⚠️ Potential issue

Fix the item count negation logic.

The line request.Consumed.forEach(x => x.ItemCount * -1) performs the multiplication but doesn't assign the result back to x.ItemCount.

Apply this diff to fix the negation:

-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
📝 Committable suggestion

‼️ 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.

    request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
_:warning: Potential issue_ **Fix the item count negation logic.** The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`. Apply this diff to fix the negation: ```diff -request.Consumed.forEach(x => x.ItemCount * -1); +request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ``` <!-- 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 request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->
});
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

🛠️ Refactor suggestion

Add input validation for the request.

The controller needs validation for:

  1. Empty or undefined request.Consumed array
  2. Minimum required items for each fusion type
  3. Invalid color combinations that could crash the combineColors function

Consider adding this validation at the start of the controller:

if (!request.Consumed?.length) {
    throw new Error("No items provided for fusion");
}

switch (request.FusionType) {
    case "AFT_ASCENT":
        if (request.Consumed.length < 1) {
            throw new Error("AFT_ASCENT requires at least 1 item");
        }
        break;
    case "AFT_COALESCENT":
        if (request.Consumed.length < 2) {
            throw new Error("AFT_COALESCENT requires at least 2 items");
        }
        // Validate colors exist in shardToColor mapping
        const color1 = shardToColor[request.Consumed[0].ItemType];
        const color2 = shardToColor[request.Consumed[1].ItemType];
        if (!color1 || !color2) {
            throw new Error("Invalid shard types provided");
        }
        break;
    default:
        throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
_:hammer_and_wrench: Refactor suggestion_ **Add input validation for the request.** The controller needs validation for: 1. Empty or undefined `request.Consumed` array 2. Minimum required items for each fusion type 3. Invalid color combinations that could crash the `combineColors` function Consider adding this validation at the start of the controller: ```typescript if (!request.Consumed?.length) { throw new Error("No items provided for fusion"); } switch (request.FusionType) { case "AFT_ASCENT": if (request.Consumed.length < 1) { throw new Error("AFT_ASCENT requires at least 1 item"); } break; case "AFT_COALESCENT": if (request.Consumed.length < 2) { throw new Error("AFT_COALESCENT requires at least 2 items"); } // Validate colors exist in shardToColor mapping const color1 = shardToColor[request.Consumed[0].ItemType]; const color2 = shardToColor[request.Consumed[1].ItemType]; if (!color1 || !color2) { throw new Error("Invalid shard types provided"); } break; default: throw new Error(`Unknown fusion type: ${request.FusionType}`); } ``` <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

⚠️ Potential issue

Fix the item count negation logic.

The line request.Consumed.forEach(x => x.ItemCount * -1) performs the multiplication but doesn't assign the result back to x.ItemCount.

Apply this diff to fix the negation:

-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
📝 Committable suggestion

‼️ 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.

    request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
_:warning: Potential issue_ **Fix the item count negation logic.** The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`. Apply this diff to fix the negation: ```diff -request.Consumed.forEach(x => x.ItemCount * -1); +request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ``` <!-- 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 request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->
break;
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

🛠️ Refactor suggestion

Add input validation for the request.

The controller needs validation for:

  1. Empty or undefined request.Consumed array
  2. Minimum required items for each fusion type
  3. Invalid color combinations that could crash the combineColors function

Consider adding this validation at the start of the controller:

if (!request.Consumed?.length) {
    throw new Error("No items provided for fusion");
}

switch (request.FusionType) {
    case "AFT_ASCENT":
        if (request.Consumed.length < 1) {
            throw new Error("AFT_ASCENT requires at least 1 item");
        }
        break;
    case "AFT_COALESCENT":
        if (request.Consumed.length < 2) {
            throw new Error("AFT_COALESCENT requires at least 2 items");
        }
        // Validate colors exist in shardToColor mapping
        const color1 = shardToColor[request.Consumed[0].ItemType];
        const color2 = shardToColor[request.Consumed[1].ItemType];
        if (!color1 || !color2) {
            throw new Error("Invalid shard types provided");
        }
        break;
    default:
        throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
_:hammer_and_wrench: Refactor suggestion_ **Add input validation for the request.** The controller needs validation for: 1. Empty or undefined `request.Consumed` array 2. Minimum required items for each fusion type 3. Invalid color combinations that could crash the `combineColors` function Consider adding this validation at the start of the controller: ```typescript if (!request.Consumed?.length) { throw new Error("No items provided for fusion"); } switch (request.FusionType) { case "AFT_ASCENT": if (request.Consumed.length < 1) { throw new Error("AFT_ASCENT requires at least 1 item"); } break; case "AFT_COALESCENT": if (request.Consumed.length < 2) { throw new Error("AFT_COALESCENT requires at least 2 items"); } // Validate colors exist in shardToColor mapping const color1 = shardToColor[request.Consumed[0].ItemType]; const color2 = shardToColor[request.Consumed[1].ItemType]; if (!color1 || !color2) { throw new Error("Invalid shard types provided"); } break; default: throw new Error(`Unknown fusion type: ${request.FusionType}`); } ``` <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

⚠️ Potential issue

Fix the item count negation logic.

The line request.Consumed.forEach(x => x.ItemCount * -1) performs the multiplication but doesn't assign the result back to x.ItemCount.

Apply this diff to fix the negation:

-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
📝 Committable suggestion

‼️ 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.

    request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
_:warning: Potential issue_ **Fix the item count negation logic.** The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`. Apply this diff to fix the negation: ```diff -request.Consumed.forEach(x => x.ItemCount * -1); +request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ``` <!-- 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 request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

🛠️ Refactor suggestion

Add input validation for the request.

The controller needs validation for:

  1. Empty or undefined request.Consumed array
  2. Minimum required items for each fusion type
  3. Invalid color combinations that could crash the combineColors function

Consider adding this validation at the start of the controller:

if (!request.Consumed?.length) {
    throw new Error("No items provided for fusion");
}

switch (request.FusionType) {
    case "AFT_ASCENT":
        if (request.Consumed.length < 1) {
            throw new Error("AFT_ASCENT requires at least 1 item");
        }
        break;
    case "AFT_COALESCENT":
        if (request.Consumed.length < 2) {
            throw new Error("AFT_COALESCENT requires at least 2 items");
        }
        // Validate colors exist in shardToColor mapping
        const color1 = shardToColor[request.Consumed[0].ItemType];
        const color2 = shardToColor[request.Consumed[1].ItemType];
        if (!color1 || !color2) {
            throw new Error("Invalid shard types provided");
        }
        break;
    default:
        throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
_:hammer_and_wrench: Refactor suggestion_ **Add input validation for the request.** The controller needs validation for: 1. Empty or undefined `request.Consumed` array 2. Minimum required items for each fusion type 3. Invalid color combinations that could crash the `combineColors` function Consider adding this validation at the start of the controller: ```typescript if (!request.Consumed?.length) { throw new Error("No items provided for fusion"); } switch (request.FusionType) { case "AFT_ASCENT": if (request.Consumed.length < 1) { throw new Error("AFT_ASCENT requires at least 1 item"); } break; case "AFT_COALESCENT": if (request.Consumed.length < 2) { throw new Error("AFT_COALESCENT requires at least 2 items"); } // Validate colors exist in shardToColor mapping const color1 = shardToColor[request.Consumed[0].ItemType]; const color2 = shardToColor[request.Consumed[1].ItemType]; if (!color1 || !color2) { throw new Error("Invalid shard types provided"); } break; default: throw new Error(`Unknown fusion type: ${request.FusionType}`); } ``` <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

⚠️ Potential issue

Fix the item count negation logic.

The line request.Consumed.forEach(x => x.ItemCount * -1) performs the multiplication but doesn't assign the result back to x.ItemCount.

Apply this diff to fix the negation:

-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
📝 Committable suggestion

‼️ 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.

    request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
_:warning: Potential issue_ **Fix the item count negation logic.** The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`. Apply this diff to fix the negation: ```diff -request.Consumed.forEach(x => x.ItemCount * -1); +request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ``` <!-- 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 request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->
case "AFT_COALESCENT":
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

🛠️ Refactor suggestion

Add input validation for the request.

The controller needs validation for:

  1. Empty or undefined request.Consumed array
  2. Minimum required items for each fusion type
  3. Invalid color combinations that could crash the combineColors function

Consider adding this validation at the start of the controller:

if (!request.Consumed?.length) {
    throw new Error("No items provided for fusion");
}

switch (request.FusionType) {
    case "AFT_ASCENT":
        if (request.Consumed.length < 1) {
            throw new Error("AFT_ASCENT requires at least 1 item");
        }
        break;
    case "AFT_COALESCENT":
        if (request.Consumed.length < 2) {
            throw new Error("AFT_COALESCENT requires at least 2 items");
        }
        // Validate colors exist in shardToColor mapping
        const color1 = shardToColor[request.Consumed[0].ItemType];
        const color2 = shardToColor[request.Consumed[1].ItemType];
        if (!color1 || !color2) {
            throw new Error("Invalid shard types provided");
        }
        break;
    default:
        throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
_:hammer_and_wrench: Refactor suggestion_ **Add input validation for the request.** The controller needs validation for: 1. Empty or undefined `request.Consumed` array 2. Minimum required items for each fusion type 3. Invalid color combinations that could crash the `combineColors` function Consider adding this validation at the start of the controller: ```typescript if (!request.Consumed?.length) { throw new Error("No items provided for fusion"); } switch (request.FusionType) { case "AFT_ASCENT": if (request.Consumed.length < 1) { throw new Error("AFT_ASCENT requires at least 1 item"); } break; case "AFT_COALESCENT": if (request.Consumed.length < 2) { throw new Error("AFT_COALESCENT requires at least 2 items"); } // Validate colors exist in shardToColor mapping const color1 = shardToColor[request.Consumed[0].ItemType]; const color2 = shardToColor[request.Consumed[1].ItemType]; if (!color1 || !color2) { throw new Error("Invalid shard types provided"); } break; default: throw new Error(`Unknown fusion type: ${request.FusionType}`); } ``` <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

⚠️ Potential issue

Fix the item count negation logic.

The line request.Consumed.forEach(x => x.ItemCount * -1) performs the multiplication but doesn't assign the result back to x.ItemCount.

Apply this diff to fix the negation:

-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
📝 Committable suggestion

‼️ 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.

    request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
_:warning: Potential issue_ **Fix the item count negation logic.** The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`. Apply this diff to fix the negation: ```diff -request.Consumed.forEach(x => x.ItemCount * -1); +request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ``` <!-- 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 request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->
newArchons.push({
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

🛠️ Refactor suggestion

Add input validation for the request.

The controller needs validation for:

  1. Empty or undefined request.Consumed array
  2. Minimum required items for each fusion type
  3. Invalid color combinations that could crash the combineColors function

Consider adding this validation at the start of the controller:

if (!request.Consumed?.length) {
    throw new Error("No items provided for fusion");
}

switch (request.FusionType) {
    case "AFT_ASCENT":
        if (request.Consumed.length < 1) {
            throw new Error("AFT_ASCENT requires at least 1 item");
        }
        break;
    case "AFT_COALESCENT":
        if (request.Consumed.length < 2) {
            throw new Error("AFT_COALESCENT requires at least 2 items");
        }
        // Validate colors exist in shardToColor mapping
        const color1 = shardToColor[request.Consumed[0].ItemType];
        const color2 = shardToColor[request.Consumed[1].ItemType];
        if (!color1 || !color2) {
            throw new Error("Invalid shard types provided");
        }
        break;
    default:
        throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
_:hammer_and_wrench: Refactor suggestion_ **Add input validation for the request.** The controller needs validation for: 1. Empty or undefined `request.Consumed` array 2. Minimum required items for each fusion type 3. Invalid color combinations that could crash the `combineColors` function Consider adding this validation at the start of the controller: ```typescript if (!request.Consumed?.length) { throw new Error("No items provided for fusion"); } switch (request.FusionType) { case "AFT_ASCENT": if (request.Consumed.length < 1) { throw new Error("AFT_ASCENT requires at least 1 item"); } break; case "AFT_COALESCENT": if (request.Consumed.length < 2) { throw new Error("AFT_COALESCENT requires at least 2 items"); } // Validate colors exist in shardToColor mapping const color1 = shardToColor[request.Consumed[0].ItemType]; const color2 = shardToColor[request.Consumed[1].ItemType]; if (!color1 || !color2) { throw new Error("Invalid shard types provided"); } break; default: throw new Error(`Unknown fusion type: ${request.FusionType}`); } ``` <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

⚠️ Potential issue

Fix the item count negation logic.

The line request.Consumed.forEach(x => x.ItemCount * -1) performs the multiplication but doesn't assign the result back to x.ItemCount.

Apply this diff to fix the negation:

-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
📝 Committable suggestion

‼️ 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.

    request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
_:warning: Potential issue_ **Fix the item count negation logic.** The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`. Apply this diff to fix the negation: ```diff -request.Consumed.forEach(x => x.ItemCount * -1); +request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ``` <!-- 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 request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->
ItemType:
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

🛠️ Refactor suggestion

Add input validation for the request.

The controller needs validation for:

  1. Empty or undefined request.Consumed array
  2. Minimum required items for each fusion type
  3. Invalid color combinations that could crash the combineColors function

Consider adding this validation at the start of the controller:

if (!request.Consumed?.length) {
    throw new Error("No items provided for fusion");
}

switch (request.FusionType) {
    case "AFT_ASCENT":
        if (request.Consumed.length < 1) {
            throw new Error("AFT_ASCENT requires at least 1 item");
        }
        break;
    case "AFT_COALESCENT":
        if (request.Consumed.length < 2) {
            throw new Error("AFT_COALESCENT requires at least 2 items");
        }
        // Validate colors exist in shardToColor mapping
        const color1 = shardToColor[request.Consumed[0].ItemType];
        const color2 = shardToColor[request.Consumed[1].ItemType];
        if (!color1 || !color2) {
            throw new Error("Invalid shard types provided");
        }
        break;
    default:
        throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
_:hammer_and_wrench: Refactor suggestion_ **Add input validation for the request.** The controller needs validation for: 1. Empty or undefined `request.Consumed` array 2. Minimum required items for each fusion type 3. Invalid color combinations that could crash the `combineColors` function Consider adding this validation at the start of the controller: ```typescript if (!request.Consumed?.length) { throw new Error("No items provided for fusion"); } switch (request.FusionType) { case "AFT_ASCENT": if (request.Consumed.length < 1) { throw new Error("AFT_ASCENT requires at least 1 item"); } break; case "AFT_COALESCENT": if (request.Consumed.length < 2) { throw new Error("AFT_COALESCENT requires at least 2 items"); } // Validate colors exist in shardToColor mapping const color1 = shardToColor[request.Consumed[0].ItemType]; const color2 = shardToColor[request.Consumed[1].ItemType]; if (!color1 || !color2) { throw new Error("Invalid shard types provided"); } break; default: throw new Error(`Unknown fusion type: ${request.FusionType}`); } ``` <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

⚠️ Potential issue

Fix the item count negation logic.

The line request.Consumed.forEach(x => x.ItemCount * -1) performs the multiplication but doesn't assign the result back to x.ItemCount.

Apply this diff to fix the negation:

-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
📝 Committable suggestion

‼️ 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.

    request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
_:warning: Potential issue_ **Fix the item count negation logic.** The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`. Apply this diff to fix the negation: ```diff -request.Consumed.forEach(x => x.ItemCount * -1); +request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ``` <!-- 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 request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->
colorToShard[
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

🛠️ Refactor suggestion

Add input validation for the request.

The controller needs validation for:

  1. Empty or undefined request.Consumed array
  2. Minimum required items for each fusion type
  3. Invalid color combinations that could crash the combineColors function

Consider adding this validation at the start of the controller:

if (!request.Consumed?.length) {
    throw new Error("No items provided for fusion");
}

switch (request.FusionType) {
    case "AFT_ASCENT":
        if (request.Consumed.length < 1) {
            throw new Error("AFT_ASCENT requires at least 1 item");
        }
        break;
    case "AFT_COALESCENT":
        if (request.Consumed.length < 2) {
            throw new Error("AFT_COALESCENT requires at least 2 items");
        }
        // Validate colors exist in shardToColor mapping
        const color1 = shardToColor[request.Consumed[0].ItemType];
        const color2 = shardToColor[request.Consumed[1].ItemType];
        if (!color1 || !color2) {
            throw new Error("Invalid shard types provided");
        }
        break;
    default:
        throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
_:hammer_and_wrench: Refactor suggestion_ **Add input validation for the request.** The controller needs validation for: 1. Empty or undefined `request.Consumed` array 2. Minimum required items for each fusion type 3. Invalid color combinations that could crash the `combineColors` function Consider adding this validation at the start of the controller: ```typescript if (!request.Consumed?.length) { throw new Error("No items provided for fusion"); } switch (request.FusionType) { case "AFT_ASCENT": if (request.Consumed.length < 1) { throw new Error("AFT_ASCENT requires at least 1 item"); } break; case "AFT_COALESCENT": if (request.Consumed.length < 2) { throw new Error("AFT_COALESCENT requires at least 2 items"); } // Validate colors exist in shardToColor mapping const color1 = shardToColor[request.Consumed[0].ItemType]; const color2 = shardToColor[request.Consumed[1].ItemType]; if (!color1 || !color2) { throw new Error("Invalid shard types provided"); } break; default: throw new Error(`Unknown fusion type: ${request.FusionType}`); } ``` <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

⚠️ Potential issue

Fix the item count negation logic.

The line request.Consumed.forEach(x => x.ItemCount * -1) performs the multiplication but doesn't assign the result back to x.ItemCount.

Apply this diff to fix the negation:

-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
📝 Committable suggestion

‼️ 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.

    request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
_:warning: Potential issue_ **Fix the item count negation logic.** The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`. Apply this diff to fix the negation: ```diff -request.Consumed.forEach(x => x.ItemCount * -1); +request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ``` <!-- 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 request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->
combineColors(
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

🛠️ Refactor suggestion

Add input validation for the request.

The controller needs validation for:

  1. Empty or undefined request.Consumed array
  2. Minimum required items for each fusion type
  3. Invalid color combinations that could crash the combineColors function

Consider adding this validation at the start of the controller:

if (!request.Consumed?.length) {
    throw new Error("No items provided for fusion");
}

switch (request.FusionType) {
    case "AFT_ASCENT":
        if (request.Consumed.length < 1) {
            throw new Error("AFT_ASCENT requires at least 1 item");
        }
        break;
    case "AFT_COALESCENT":
        if (request.Consumed.length < 2) {
            throw new Error("AFT_COALESCENT requires at least 2 items");
        }
        // Validate colors exist in shardToColor mapping
        const color1 = shardToColor[request.Consumed[0].ItemType];
        const color2 = shardToColor[request.Consumed[1].ItemType];
        if (!color1 || !color2) {
            throw new Error("Invalid shard types provided");
        }
        break;
    default:
        throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
_:hammer_and_wrench: Refactor suggestion_ **Add input validation for the request.** The controller needs validation for: 1. Empty or undefined `request.Consumed` array 2. Minimum required items for each fusion type 3. Invalid color combinations that could crash the `combineColors` function Consider adding this validation at the start of the controller: ```typescript if (!request.Consumed?.length) { throw new Error("No items provided for fusion"); } switch (request.FusionType) { case "AFT_ASCENT": if (request.Consumed.length < 1) { throw new Error("AFT_ASCENT requires at least 1 item"); } break; case "AFT_COALESCENT": if (request.Consumed.length < 2) { throw new Error("AFT_COALESCENT requires at least 2 items"); } // Validate colors exist in shardToColor mapping const color1 = shardToColor[request.Consumed[0].ItemType]; const color2 = shardToColor[request.Consumed[1].ItemType]; if (!color1 || !color2) { throw new Error("Invalid shard types provided"); } break; default: throw new Error(`Unknown fusion type: ${request.FusionType}`); } ``` <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

⚠️ Potential issue

Fix the item count negation logic.

The line request.Consumed.forEach(x => x.ItemCount * -1) performs the multiplication but doesn't assign the result back to x.ItemCount.

Apply this diff to fix the negation:

-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
📝 Committable suggestion

‼️ 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.

    request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
_:warning: Potential issue_ **Fix the item count negation logic.** The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`. Apply this diff to fix the negation: ```diff -request.Consumed.forEach(x => x.ItemCount * -1); +request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ``` <!-- 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 request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->
shardToColor[request.Consumed[0].ItemType],
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

🛠️ Refactor suggestion

Add input validation for the request.

The controller needs validation for:

  1. Empty or undefined request.Consumed array
  2. Minimum required items for each fusion type
  3. Invalid color combinations that could crash the combineColors function

Consider adding this validation at the start of the controller:

if (!request.Consumed?.length) {
    throw new Error("No items provided for fusion");
}

switch (request.FusionType) {
    case "AFT_ASCENT":
        if (request.Consumed.length < 1) {
            throw new Error("AFT_ASCENT requires at least 1 item");
        }
        break;
    case "AFT_COALESCENT":
        if (request.Consumed.length < 2) {
            throw new Error("AFT_COALESCENT requires at least 2 items");
        }
        // Validate colors exist in shardToColor mapping
        const color1 = shardToColor[request.Consumed[0].ItemType];
        const color2 = shardToColor[request.Consumed[1].ItemType];
        if (!color1 || !color2) {
            throw new Error("Invalid shard types provided");
        }
        break;
    default:
        throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
_:hammer_and_wrench: Refactor suggestion_ **Add input validation for the request.** The controller needs validation for: 1. Empty or undefined `request.Consumed` array 2. Minimum required items for each fusion type 3. Invalid color combinations that could crash the `combineColors` function Consider adding this validation at the start of the controller: ```typescript if (!request.Consumed?.length) { throw new Error("No items provided for fusion"); } switch (request.FusionType) { case "AFT_ASCENT": if (request.Consumed.length < 1) { throw new Error("AFT_ASCENT requires at least 1 item"); } break; case "AFT_COALESCENT": if (request.Consumed.length < 2) { throw new Error("AFT_COALESCENT requires at least 2 items"); } // Validate colors exist in shardToColor mapping const color1 = shardToColor[request.Consumed[0].ItemType]; const color2 = shardToColor[request.Consumed[1].ItemType]; if (!color1 || !color2) { throw new Error("Invalid shard types provided"); } break; default: throw new Error(`Unknown fusion type: ${request.FusionType}`); } ``` <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

⚠️ Potential issue

Fix the item count negation logic.

The line request.Consumed.forEach(x => x.ItemCount * -1) performs the multiplication but doesn't assign the result back to x.ItemCount.

Apply this diff to fix the negation:

-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
📝 Committable suggestion

‼️ 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.

    request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
_:warning: Potential issue_ **Fix the item count negation logic.** The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`. Apply this diff to fix the negation: ```diff -request.Consumed.forEach(x => x.ItemCount * -1); +request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ``` <!-- 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 request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->
shardToColor[request.Consumed[1].ItemType]
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

🛠️ Refactor suggestion

Add input validation for the request.

The controller needs validation for:

  1. Empty or undefined request.Consumed array
  2. Minimum required items for each fusion type
  3. Invalid color combinations that could crash the combineColors function

Consider adding this validation at the start of the controller:

if (!request.Consumed?.length) {
    throw new Error("No items provided for fusion");
}

switch (request.FusionType) {
    case "AFT_ASCENT":
        if (request.Consumed.length < 1) {
            throw new Error("AFT_ASCENT requires at least 1 item");
        }
        break;
    case "AFT_COALESCENT":
        if (request.Consumed.length < 2) {
            throw new Error("AFT_COALESCENT requires at least 2 items");
        }
        // Validate colors exist in shardToColor mapping
        const color1 = shardToColor[request.Consumed[0].ItemType];
        const color2 = shardToColor[request.Consumed[1].ItemType];
        if (!color1 || !color2) {
            throw new Error("Invalid shard types provided");
        }
        break;
    default:
        throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
_:hammer_and_wrench: Refactor suggestion_ **Add input validation for the request.** The controller needs validation for: 1. Empty or undefined `request.Consumed` array 2. Minimum required items for each fusion type 3. Invalid color combinations that could crash the `combineColors` function Consider adding this validation at the start of the controller: ```typescript if (!request.Consumed?.length) { throw new Error("No items provided for fusion"); } switch (request.FusionType) { case "AFT_ASCENT": if (request.Consumed.length < 1) { throw new Error("AFT_ASCENT requires at least 1 item"); } break; case "AFT_COALESCENT": if (request.Consumed.length < 2) { throw new Error("AFT_COALESCENT requires at least 2 items"); } // Validate colors exist in shardToColor mapping const color1 = shardToColor[request.Consumed[0].ItemType]; const color2 = shardToColor[request.Consumed[1].ItemType]; if (!color1 || !color2) { throw new Error("Invalid shard types provided"); } break; default: throw new Error(`Unknown fusion type: ${request.FusionType}`); } ``` <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

⚠️ Potential issue

Fix the item count negation logic.

The line request.Consumed.forEach(x => x.ItemCount * -1) performs the multiplication but doesn't assign the result back to x.ItemCount.

Apply this diff to fix the negation:

-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
📝 Committable suggestion

‼️ 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.

    request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
_:warning: Potential issue_ **Fix the item count negation logic.** The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`. Apply this diff to fix the negation: ```diff -request.Consumed.forEach(x => x.ItemCount * -1); +request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ``` <!-- 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 request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->
)
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

🛠️ Refactor suggestion

Add input validation for the request.

The controller needs validation for:

  1. Empty or undefined request.Consumed array
  2. Minimum required items for each fusion type
  3. Invalid color combinations that could crash the combineColors function

Consider adding this validation at the start of the controller:

if (!request.Consumed?.length) {
    throw new Error("No items provided for fusion");
}

switch (request.FusionType) {
    case "AFT_ASCENT":
        if (request.Consumed.length < 1) {
            throw new Error("AFT_ASCENT requires at least 1 item");
        }
        break;
    case "AFT_COALESCENT":
        if (request.Consumed.length < 2) {
            throw new Error("AFT_COALESCENT requires at least 2 items");
        }
        // Validate colors exist in shardToColor mapping
        const color1 = shardToColor[request.Consumed[0].ItemType];
        const color2 = shardToColor[request.Consumed[1].ItemType];
        if (!color1 || !color2) {
            throw new Error("Invalid shard types provided");
        }
        break;
    default:
        throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
_:hammer_and_wrench: Refactor suggestion_ **Add input validation for the request.** The controller needs validation for: 1. Empty or undefined `request.Consumed` array 2. Minimum required items for each fusion type 3. Invalid color combinations that could crash the `combineColors` function Consider adding this validation at the start of the controller: ```typescript if (!request.Consumed?.length) { throw new Error("No items provided for fusion"); } switch (request.FusionType) { case "AFT_ASCENT": if (request.Consumed.length < 1) { throw new Error("AFT_ASCENT requires at least 1 item"); } break; case "AFT_COALESCENT": if (request.Consumed.length < 2) { throw new Error("AFT_COALESCENT requires at least 2 items"); } // Validate colors exist in shardToColor mapping const color1 = shardToColor[request.Consumed[0].ItemType]; const color2 = shardToColor[request.Consumed[1].ItemType]; if (!color1 || !color2) { throw new Error("Invalid shard types provided"); } break; default: throw new Error(`Unknown fusion type: ${request.FusionType}`); } ``` <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

⚠️ Potential issue

Fix the item count negation logic.

The line request.Consumed.forEach(x => x.ItemCount * -1) performs the multiplication but doesn't assign the result back to x.ItemCount.

Apply this diff to fix the negation:

-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
📝 Committable suggestion

‼️ 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.

    request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
_:warning: Potential issue_ **Fix the item count negation logic.** The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`. Apply this diff to fix the negation: ```diff -request.Consumed.forEach(x => x.ItemCount * -1); +request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ``` <!-- 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 request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->
],
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

🛠️ Refactor suggestion

Add input validation for the request.

The controller needs validation for:

  1. Empty or undefined request.Consumed array
  2. Minimum required items for each fusion type
  3. Invalid color combinations that could crash the combineColors function

Consider adding this validation at the start of the controller:

if (!request.Consumed?.length) {
    throw new Error("No items provided for fusion");
}

switch (request.FusionType) {
    case "AFT_ASCENT":
        if (request.Consumed.length < 1) {
            throw new Error("AFT_ASCENT requires at least 1 item");
        }
        break;
    case "AFT_COALESCENT":
        if (request.Consumed.length < 2) {
            throw new Error("AFT_COALESCENT requires at least 2 items");
        }
        // Validate colors exist in shardToColor mapping
        const color1 = shardToColor[request.Consumed[0].ItemType];
        const color2 = shardToColor[request.Consumed[1].ItemType];
        if (!color1 || !color2) {
            throw new Error("Invalid shard types provided");
        }
        break;
    default:
        throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
_:hammer_and_wrench: Refactor suggestion_ **Add input validation for the request.** The controller needs validation for: 1. Empty or undefined `request.Consumed` array 2. Minimum required items for each fusion type 3. Invalid color combinations that could crash the `combineColors` function Consider adding this validation at the start of the controller: ```typescript if (!request.Consumed?.length) { throw new Error("No items provided for fusion"); } switch (request.FusionType) { case "AFT_ASCENT": if (request.Consumed.length < 1) { throw new Error("AFT_ASCENT requires at least 1 item"); } break; case "AFT_COALESCENT": if (request.Consumed.length < 2) { throw new Error("AFT_COALESCENT requires at least 2 items"); } // Validate colors exist in shardToColor mapping const color1 = shardToColor[request.Consumed[0].ItemType]; const color2 = shardToColor[request.Consumed[1].ItemType]; if (!color1 || !color2) { throw new Error("Invalid shard types provided"); } break; default: throw new Error(`Unknown fusion type: ${request.FusionType}`); } ``` <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

⚠️ Potential issue

Fix the item count negation logic.

The line request.Consumed.forEach(x => x.ItemCount * -1) performs the multiplication but doesn't assign the result back to x.ItemCount.

Apply this diff to fix the negation:

-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
📝 Committable suggestion

‼️ 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.

    request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
_:warning: Potential issue_ **Fix the item count negation logic.** The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`. Apply this diff to fix the negation: ```diff -request.Consumed.forEach(x => x.ItemCount * -1); +request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ``` <!-- 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 request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->
ItemCount: 1
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

🛠️ Refactor suggestion

Add input validation for the request.

The controller needs validation for:

  1. Empty or undefined request.Consumed array
  2. Minimum required items for each fusion type
  3. Invalid color combinations that could crash the combineColors function

Consider adding this validation at the start of the controller:

if (!request.Consumed?.length) {
    throw new Error("No items provided for fusion");
}

switch (request.FusionType) {
    case "AFT_ASCENT":
        if (request.Consumed.length < 1) {
            throw new Error("AFT_ASCENT requires at least 1 item");
        }
        break;
    case "AFT_COALESCENT":
        if (request.Consumed.length < 2) {
            throw new Error("AFT_COALESCENT requires at least 2 items");
        }
        // Validate colors exist in shardToColor mapping
        const color1 = shardToColor[request.Consumed[0].ItemType];
        const color2 = shardToColor[request.Consumed[1].ItemType];
        if (!color1 || !color2) {
            throw new Error("Invalid shard types provided");
        }
        break;
    default:
        throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
_:hammer_and_wrench: Refactor suggestion_ **Add input validation for the request.** The controller needs validation for: 1. Empty or undefined `request.Consumed` array 2. Minimum required items for each fusion type 3. Invalid color combinations that could crash the `combineColors` function Consider adding this validation at the start of the controller: ```typescript if (!request.Consumed?.length) { throw new Error("No items provided for fusion"); } switch (request.FusionType) { case "AFT_ASCENT": if (request.Consumed.length < 1) { throw new Error("AFT_ASCENT requires at least 1 item"); } break; case "AFT_COALESCENT": if (request.Consumed.length < 2) { throw new Error("AFT_COALESCENT requires at least 2 items"); } // Validate colors exist in shardToColor mapping const color1 = shardToColor[request.Consumed[0].ItemType]; const color2 = shardToColor[request.Consumed[1].ItemType]; if (!color1 || !color2) { throw new Error("Invalid shard types provided"); } break; default: throw new Error(`Unknown fusion type: ${request.FusionType}`); } ``` <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

⚠️ Potential issue

Fix the item count negation logic.

The line request.Consumed.forEach(x => x.ItemCount * -1) performs the multiplication but doesn't assign the result back to x.ItemCount.

Apply this diff to fix the negation:

-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
📝 Committable suggestion

‼️ 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.

    request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
_:warning: Potential issue_ **Fix the item count negation logic.** The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`. Apply this diff to fix the negation: ```diff -request.Consumed.forEach(x => x.ItemCount * -1); +request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ``` <!-- 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 request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->
});
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

🛠️ Refactor suggestion

Add input validation for the request.

The controller needs validation for:

  1. Empty or undefined request.Consumed array
  2. Minimum required items for each fusion type
  3. Invalid color combinations that could crash the combineColors function

Consider adding this validation at the start of the controller:

if (!request.Consumed?.length) {
    throw new Error("No items provided for fusion");
}

switch (request.FusionType) {
    case "AFT_ASCENT":
        if (request.Consumed.length < 1) {
            throw new Error("AFT_ASCENT requires at least 1 item");
        }
        break;
    case "AFT_COALESCENT":
        if (request.Consumed.length < 2) {
            throw new Error("AFT_COALESCENT requires at least 2 items");
        }
        // Validate colors exist in shardToColor mapping
        const color1 = shardToColor[request.Consumed[0].ItemType];
        const color2 = shardToColor[request.Consumed[1].ItemType];
        if (!color1 || !color2) {
            throw new Error("Invalid shard types provided");
        }
        break;
    default:
        throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
_:hammer_and_wrench: Refactor suggestion_ **Add input validation for the request.** The controller needs validation for: 1. Empty or undefined `request.Consumed` array 2. Minimum required items for each fusion type 3. Invalid color combinations that could crash the `combineColors` function Consider adding this validation at the start of the controller: ```typescript if (!request.Consumed?.length) { throw new Error("No items provided for fusion"); } switch (request.FusionType) { case "AFT_ASCENT": if (request.Consumed.length < 1) { throw new Error("AFT_ASCENT requires at least 1 item"); } break; case "AFT_COALESCENT": if (request.Consumed.length < 2) { throw new Error("AFT_COALESCENT requires at least 2 items"); } // Validate colors exist in shardToColor mapping const color1 = shardToColor[request.Consumed[0].ItemType]; const color2 = shardToColor[request.Consumed[1].ItemType]; if (!color1 || !color2) { throw new Error("Invalid shard types provided"); } break; default: throw new Error(`Unknown fusion type: ${request.FusionType}`); } ``` <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

⚠️ Potential issue

Fix the item count negation logic.

The line request.Consumed.forEach(x => x.ItemCount * -1) performs the multiplication but doesn't assign the result back to x.ItemCount.

Apply this diff to fix the negation:

-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
📝 Committable suggestion

‼️ 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.

    request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
_:warning: Potential issue_ **Fix the item count negation logic.** The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`. Apply this diff to fix the negation: ```diff -request.Consumed.forEach(x => x.ItemCount * -1); +request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ``` <!-- 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 request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->
break;
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

🛠️ Refactor suggestion

Add input validation for the request.

The controller needs validation for:

  1. Empty or undefined request.Consumed array
  2. Minimum required items for each fusion type
  3. Invalid color combinations that could crash the combineColors function

Consider adding this validation at the start of the controller:

if (!request.Consumed?.length) {
    throw new Error("No items provided for fusion");
}

switch (request.FusionType) {
    case "AFT_ASCENT":
        if (request.Consumed.length < 1) {
            throw new Error("AFT_ASCENT requires at least 1 item");
        }
        break;
    case "AFT_COALESCENT":
        if (request.Consumed.length < 2) {
            throw new Error("AFT_COALESCENT requires at least 2 items");
        }
        // Validate colors exist in shardToColor mapping
        const color1 = shardToColor[request.Consumed[0].ItemType];
        const color2 = shardToColor[request.Consumed[1].ItemType];
        if (!color1 || !color2) {
            throw new Error("Invalid shard types provided");
        }
        break;
    default:
        throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
_:hammer_and_wrench: Refactor suggestion_ **Add input validation for the request.** The controller needs validation for: 1. Empty or undefined `request.Consumed` array 2. Minimum required items for each fusion type 3. Invalid color combinations that could crash the `combineColors` function Consider adding this validation at the start of the controller: ```typescript if (!request.Consumed?.length) { throw new Error("No items provided for fusion"); } switch (request.FusionType) { case "AFT_ASCENT": if (request.Consumed.length < 1) { throw new Error("AFT_ASCENT requires at least 1 item"); } break; case "AFT_COALESCENT": if (request.Consumed.length < 2) { throw new Error("AFT_COALESCENT requires at least 2 items"); } // Validate colors exist in shardToColor mapping const color1 = shardToColor[request.Consumed[0].ItemType]; const color2 = shardToColor[request.Consumed[1].ItemType]; if (!color1 || !color2) { throw new Error("Invalid shard types provided"); } break; default: throw new Error(`Unknown fusion type: ${request.FusionType}`); } ``` <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

⚠️ Potential issue

Fix the item count negation logic.

The line request.Consumed.forEach(x => x.ItemCount * -1) performs the multiplication but doesn't assign the result back to x.ItemCount.

Apply this diff to fix the negation:

-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
📝 Committable suggestion

‼️ 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.

    request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
_:warning: Potential issue_ **Fix the item count negation logic.** The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`. Apply this diff to fix the negation: ```diff -request.Consumed.forEach(x => x.ItemCount * -1); +request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ``` <!-- 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 request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

🛠️ Refactor suggestion

Add input validation for the request.

The controller needs validation for:

  1. Empty or undefined request.Consumed array
  2. Minimum required items for each fusion type
  3. Invalid color combinations that could crash the combineColors function

Consider adding this validation at the start of the controller:

if (!request.Consumed?.length) {
    throw new Error("No items provided for fusion");
}

switch (request.FusionType) {
    case "AFT_ASCENT":
        if (request.Consumed.length < 1) {
            throw new Error("AFT_ASCENT requires at least 1 item");
        }
        break;
    case "AFT_COALESCENT":
        if (request.Consumed.length < 2) {
            throw new Error("AFT_COALESCENT requires at least 2 items");
        }
        // Validate colors exist in shardToColor mapping
        const color1 = shardToColor[request.Consumed[0].ItemType];
        const color2 = shardToColor[request.Consumed[1].ItemType];
        if (!color1 || !color2) {
            throw new Error("Invalid shard types provided");
        }
        break;
    default:
        throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
_:hammer_and_wrench: Refactor suggestion_ **Add input validation for the request.** The controller needs validation for: 1. Empty or undefined `request.Consumed` array 2. Minimum required items for each fusion type 3. Invalid color combinations that could crash the `combineColors` function Consider adding this validation at the start of the controller: ```typescript if (!request.Consumed?.length) { throw new Error("No items provided for fusion"); } switch (request.FusionType) { case "AFT_ASCENT": if (request.Consumed.length < 1) { throw new Error("AFT_ASCENT requires at least 1 item"); } break; case "AFT_COALESCENT": if (request.Consumed.length < 2) { throw new Error("AFT_COALESCENT requires at least 2 items"); } // Validate colors exist in shardToColor mapping const color1 = shardToColor[request.Consumed[0].ItemType]; const color2 = shardToColor[request.Consumed[1].ItemType]; if (!color1 || !color2) { throw new Error("Invalid shard types provided"); } break; default: throw new Error(`Unknown fusion type: ${request.FusionType}`); } ``` <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

⚠️ Potential issue

Fix the item count negation logic.

The line request.Consumed.forEach(x => x.ItemCount * -1) performs the multiplication but doesn't assign the result back to x.ItemCount.

Apply this diff to fix the negation:

-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
📝 Committable suggestion

‼️ 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.

    request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
_:warning: Potential issue_ **Fix the item count negation logic.** The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`. Apply this diff to fix the negation: ```diff -request.Consumed.forEach(x => x.ItemCount * -1); +request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ``` <!-- 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 request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->
default:
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

🛠️ Refactor suggestion

Add input validation for the request.

The controller needs validation for:

  1. Empty or undefined request.Consumed array
  2. Minimum required items for each fusion type
  3. Invalid color combinations that could crash the combineColors function

Consider adding this validation at the start of the controller:

if (!request.Consumed?.length) {
    throw new Error("No items provided for fusion");
}

switch (request.FusionType) {
    case "AFT_ASCENT":
        if (request.Consumed.length < 1) {
            throw new Error("AFT_ASCENT requires at least 1 item");
        }
        break;
    case "AFT_COALESCENT":
        if (request.Consumed.length < 2) {
            throw new Error("AFT_COALESCENT requires at least 2 items");
        }
        // Validate colors exist in shardToColor mapping
        const color1 = shardToColor[request.Consumed[0].ItemType];
        const color2 = shardToColor[request.Consumed[1].ItemType];
        if (!color1 || !color2) {
            throw new Error("Invalid shard types provided");
        }
        break;
    default:
        throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
_:hammer_and_wrench: Refactor suggestion_ **Add input validation for the request.** The controller needs validation for: 1. Empty or undefined `request.Consumed` array 2. Minimum required items for each fusion type 3. Invalid color combinations that could crash the `combineColors` function Consider adding this validation at the start of the controller: ```typescript if (!request.Consumed?.length) { throw new Error("No items provided for fusion"); } switch (request.FusionType) { case "AFT_ASCENT": if (request.Consumed.length < 1) { throw new Error("AFT_ASCENT requires at least 1 item"); } break; case "AFT_COALESCENT": if (request.Consumed.length < 2) { throw new Error("AFT_COALESCENT requires at least 2 items"); } // Validate colors exist in shardToColor mapping const color1 = shardToColor[request.Consumed[0].ItemType]; const color2 = shardToColor[request.Consumed[1].ItemType]; if (!color1 || !color2) { throw new Error("Invalid shard types provided"); } break; default: throw new Error(`Unknown fusion type: ${request.FusionType}`); } ``` <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

⚠️ Potential issue

Fix the item count negation logic.

The line request.Consumed.forEach(x => x.ItemCount * -1) performs the multiplication but doesn't assign the result back to x.ItemCount.

Apply this diff to fix the negation:

-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
📝 Committable suggestion

‼️ 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.

    request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
_:warning: Potential issue_ **Fix the item count negation logic.** The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`. Apply this diff to fix the negation: ```diff -request.Consumed.forEach(x => x.ItemCount * -1); +request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ``` <!-- 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 request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->
throw new Error(`unknown archon fusion type: ${request.FusionType}`);
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

🛠️ Refactor suggestion

Add input validation for the request.

The controller needs validation for:

  1. Empty or undefined request.Consumed array
  2. Minimum required items for each fusion type
  3. Invalid color combinations that could crash the combineColors function

Consider adding this validation at the start of the controller:

if (!request.Consumed?.length) {
    throw new Error("No items provided for fusion");
}

switch (request.FusionType) {
    case "AFT_ASCENT":
        if (request.Consumed.length < 1) {
            throw new Error("AFT_ASCENT requires at least 1 item");
        }
        break;
    case "AFT_COALESCENT":
        if (request.Consumed.length < 2) {
            throw new Error("AFT_COALESCENT requires at least 2 items");
        }
        // Validate colors exist in shardToColor mapping
        const color1 = shardToColor[request.Consumed[0].ItemType];
        const color2 = shardToColor[request.Consumed[1].ItemType];
        if (!color1 || !color2) {
            throw new Error("Invalid shard types provided");
        }
        break;
    default:
        throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
_:hammer_and_wrench: Refactor suggestion_ **Add input validation for the request.** The controller needs validation for: 1. Empty or undefined `request.Consumed` array 2. Minimum required items for each fusion type 3. Invalid color combinations that could crash the `combineColors` function Consider adding this validation at the start of the controller: ```typescript if (!request.Consumed?.length) { throw new Error("No items provided for fusion"); } switch (request.FusionType) { case "AFT_ASCENT": if (request.Consumed.length < 1) { throw new Error("AFT_ASCENT requires at least 1 item"); } break; case "AFT_COALESCENT": if (request.Consumed.length < 2) { throw new Error("AFT_COALESCENT requires at least 2 items"); } // Validate colors exist in shardToColor mapping const color1 = shardToColor[request.Consumed[0].ItemType]; const color2 = shardToColor[request.Consumed[1].ItemType]; if (!color1 || !color2) { throw new Error("Invalid shard types provided"); } break; default: throw new Error(`Unknown fusion type: ${request.FusionType}`); } ``` <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

⚠️ Potential issue

Fix the item count negation logic.

The line request.Consumed.forEach(x => x.ItemCount * -1) performs the multiplication but doesn't assign the result back to x.ItemCount.

Apply this diff to fix the negation:

-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
📝 Committable suggestion

‼️ 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.

    request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
_:warning: Potential issue_ **Fix the item count negation logic.** The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`. Apply this diff to fix the negation: ```diff -request.Consumed.forEach(x => x.ItemCount * -1); +request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ``` <!-- 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 request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->
}
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

🛠️ Refactor suggestion

Add input validation for the request.

The controller needs validation for:

  1. Empty or undefined request.Consumed array
  2. Minimum required items for each fusion type
  3. Invalid color combinations that could crash the combineColors function

Consider adding this validation at the start of the controller:

if (!request.Consumed?.length) {
    throw new Error("No items provided for fusion");
}

switch (request.FusionType) {
    case "AFT_ASCENT":
        if (request.Consumed.length < 1) {
            throw new Error("AFT_ASCENT requires at least 1 item");
        }
        break;
    case "AFT_COALESCENT":
        if (request.Consumed.length < 2) {
            throw new Error("AFT_COALESCENT requires at least 2 items");
        }
        // Validate colors exist in shardToColor mapping
        const color1 = shardToColor[request.Consumed[0].ItemType];
        const color2 = shardToColor[request.Consumed[1].ItemType];
        if (!color1 || !color2) {
            throw new Error("Invalid shard types provided");
        }
        break;
    default:
        throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
_:hammer_and_wrench: Refactor suggestion_ **Add input validation for the request.** The controller needs validation for: 1. Empty or undefined `request.Consumed` array 2. Minimum required items for each fusion type 3. Invalid color combinations that could crash the `combineColors` function Consider adding this validation at the start of the controller: ```typescript if (!request.Consumed?.length) { throw new Error("No items provided for fusion"); } switch (request.FusionType) { case "AFT_ASCENT": if (request.Consumed.length < 1) { throw new Error("AFT_ASCENT requires at least 1 item"); } break; case "AFT_COALESCENT": if (request.Consumed.length < 2) { throw new Error("AFT_COALESCENT requires at least 2 items"); } // Validate colors exist in shardToColor mapping const color1 = shardToColor[request.Consumed[0].ItemType]; const color2 = shardToColor[request.Consumed[1].ItemType]; if (!color1 || !color2) { throw new Error("Invalid shard types provided"); } break; default: throw new Error(`Unknown fusion type: ${request.FusionType}`); } ``` <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

⚠️ Potential issue

Fix the item count negation logic.

The line request.Consumed.forEach(x => x.ItemCount * -1) performs the multiplication but doesn't assign the result back to x.ItemCount.

Apply this diff to fix the negation:

-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
📝 Committable suggestion

‼️ 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.

    request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
_:warning: Potential issue_ **Fix the item count negation logic.** The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`. Apply this diff to fix the negation: ```diff -request.Consumed.forEach(x => x.ItemCount * -1); +request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ``` <!-- 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 request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->
addMiscItems(inventory, newArchons);
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

🛠️ Refactor suggestion

Add input validation for the request.

The controller needs validation for:

  1. Empty or undefined request.Consumed array
  2. Minimum required items for each fusion type
  3. Invalid color combinations that could crash the combineColors function

Consider adding this validation at the start of the controller:

if (!request.Consumed?.length) {
    throw new Error("No items provided for fusion");
}

switch (request.FusionType) {
    case "AFT_ASCENT":
        if (request.Consumed.length < 1) {
            throw new Error("AFT_ASCENT requires at least 1 item");
        }
        break;
    case "AFT_COALESCENT":
        if (request.Consumed.length < 2) {
            throw new Error("AFT_COALESCENT requires at least 2 items");
        }
        // Validate colors exist in shardToColor mapping
        const color1 = shardToColor[request.Consumed[0].ItemType];
        const color2 = shardToColor[request.Consumed[1].ItemType];
        if (!color1 || !color2) {
            throw new Error("Invalid shard types provided");
        }
        break;
    default:
        throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
_:hammer_and_wrench: Refactor suggestion_ **Add input validation for the request.** The controller needs validation for: 1. Empty or undefined `request.Consumed` array 2. Minimum required items for each fusion type 3. Invalid color combinations that could crash the `combineColors` function Consider adding this validation at the start of the controller: ```typescript if (!request.Consumed?.length) { throw new Error("No items provided for fusion"); } switch (request.FusionType) { case "AFT_ASCENT": if (request.Consumed.length < 1) { throw new Error("AFT_ASCENT requires at least 1 item"); } break; case "AFT_COALESCENT": if (request.Consumed.length < 2) { throw new Error("AFT_COALESCENT requires at least 2 items"); } // Validate colors exist in shardToColor mapping const color1 = shardToColor[request.Consumed[0].ItemType]; const color2 = shardToColor[request.Consumed[1].ItemType]; if (!color1 || !color2) { throw new Error("Invalid shard types provided"); } break; default: throw new Error(`Unknown fusion type: ${request.FusionType}`); } ``` <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

⚠️ Potential issue

Fix the item count negation logic.

The line request.Consumed.forEach(x => x.ItemCount * -1) performs the multiplication but doesn't assign the result back to x.ItemCount.

Apply this diff to fix the negation:

-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
📝 Committable suggestion

‼️ 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.

    request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
_:warning: Potential issue_ **Fix the item count negation logic.** The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`. Apply this diff to fix the negation: ```diff -request.Consumed.forEach(x => x.ItemCount * -1); +request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ``` <!-- 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 request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->
await inventory.save();
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

🛠️ Refactor suggestion

Add input validation for the request.

The controller needs validation for:

  1. Empty or undefined request.Consumed array
  2. Minimum required items for each fusion type
  3. Invalid color combinations that could crash the combineColors function

Consider adding this validation at the start of the controller:

if (!request.Consumed?.length) {
    throw new Error("No items provided for fusion");
}

switch (request.FusionType) {
    case "AFT_ASCENT":
        if (request.Consumed.length < 1) {
            throw new Error("AFT_ASCENT requires at least 1 item");
        }
        break;
    case "AFT_COALESCENT":
        if (request.Consumed.length < 2) {
            throw new Error("AFT_COALESCENT requires at least 2 items");
        }
        // Validate colors exist in shardToColor mapping
        const color1 = shardToColor[request.Consumed[0].ItemType];
        const color2 = shardToColor[request.Consumed[1].ItemType];
        if (!color1 || !color2) {
            throw new Error("Invalid shard types provided");
        }
        break;
    default:
        throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
_:hammer_and_wrench: Refactor suggestion_ **Add input validation for the request.** The controller needs validation for: 1. Empty or undefined `request.Consumed` array 2. Minimum required items for each fusion type 3. Invalid color combinations that could crash the `combineColors` function Consider adding this validation at the start of the controller: ```typescript if (!request.Consumed?.length) { throw new Error("No items provided for fusion"); } switch (request.FusionType) { case "AFT_ASCENT": if (request.Consumed.length < 1) { throw new Error("AFT_ASCENT requires at least 1 item"); } break; case "AFT_COALESCENT": if (request.Consumed.length < 2) { throw new Error("AFT_COALESCENT requires at least 2 items"); } // Validate colors exist in shardToColor mapping const color1 = shardToColor[request.Consumed[0].ItemType]; const color2 = shardToColor[request.Consumed[1].ItemType]; if (!color1 || !color2) { throw new Error("Invalid shard types provided"); } break; default: throw new Error(`Unknown fusion type: ${request.FusionType}`); } ``` <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

⚠️ Potential issue

Fix the item count negation logic.

The line request.Consumed.forEach(x => x.ItemCount * -1) performs the multiplication but doesn't assign the result back to x.ItemCount.

Apply this diff to fix the negation:

-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
📝 Committable suggestion

‼️ 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.

    request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
_:warning: Potential issue_ **Fix the item count negation logic.** The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`. Apply this diff to fix the negation: ```diff -request.Consumed.forEach(x => x.ItemCount * -1); +request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ``` <!-- 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 request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->
res.json({
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

🛠️ Refactor suggestion

Add input validation for the request.

The controller needs validation for:

  1. Empty or undefined request.Consumed array
  2. Minimum required items for each fusion type
  3. Invalid color combinations that could crash the combineColors function

Consider adding this validation at the start of the controller:

if (!request.Consumed?.length) {
    throw new Error("No items provided for fusion");
}

switch (request.FusionType) {
    case "AFT_ASCENT":
        if (request.Consumed.length < 1) {
            throw new Error("AFT_ASCENT requires at least 1 item");
        }
        break;
    case "AFT_COALESCENT":
        if (request.Consumed.length < 2) {
            throw new Error("AFT_COALESCENT requires at least 2 items");
        }
        // Validate colors exist in shardToColor mapping
        const color1 = shardToColor[request.Consumed[0].ItemType];
        const color2 = shardToColor[request.Consumed[1].ItemType];
        if (!color1 || !color2) {
            throw new Error("Invalid shard types provided");
        }
        break;
    default:
        throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
_:hammer_and_wrench: Refactor suggestion_ **Add input validation for the request.** The controller needs validation for: 1. Empty or undefined `request.Consumed` array 2. Minimum required items for each fusion type 3. Invalid color combinations that could crash the `combineColors` function Consider adding this validation at the start of the controller: ```typescript if (!request.Consumed?.length) { throw new Error("No items provided for fusion"); } switch (request.FusionType) { case "AFT_ASCENT": if (request.Consumed.length < 1) { throw new Error("AFT_ASCENT requires at least 1 item"); } break; case "AFT_COALESCENT": if (request.Consumed.length < 2) { throw new Error("AFT_COALESCENT requires at least 2 items"); } // Validate colors exist in shardToColor mapping const color1 = shardToColor[request.Consumed[0].ItemType]; const color2 = shardToColor[request.Consumed[1].ItemType]; if (!color1 || !color2) { throw new Error("Invalid shard types provided"); } break; default: throw new Error(`Unknown fusion type: ${request.FusionType}`); } ``` <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

⚠️ Potential issue

Fix the item count negation logic.

The line request.Consumed.forEach(x => x.ItemCount * -1) performs the multiplication but doesn't assign the result back to x.ItemCount.

Apply this diff to fix the negation:

-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
📝 Committable suggestion

‼️ 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.

    request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
_:warning: Potential issue_ **Fix the item count negation logic.** The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`. Apply this diff to fix the negation: ```diff -request.Consumed.forEach(x => x.ItemCount * -1); +request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ``` <!-- 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 request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->
NewArchons: newArchons
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

🛠️ Refactor suggestion

Add input validation for the request.

The controller needs validation for:

  1. Empty or undefined request.Consumed array
  2. Minimum required items for each fusion type
  3. Invalid color combinations that could crash the combineColors function

Consider adding this validation at the start of the controller:

if (!request.Consumed?.length) {
    throw new Error("No items provided for fusion");
}

switch (request.FusionType) {
    case "AFT_ASCENT":
        if (request.Consumed.length < 1) {
            throw new Error("AFT_ASCENT requires at least 1 item");
        }
        break;
    case "AFT_COALESCENT":
        if (request.Consumed.length < 2) {
            throw new Error("AFT_COALESCENT requires at least 2 items");
        }
        // Validate colors exist in shardToColor mapping
        const color1 = shardToColor[request.Consumed[0].ItemType];
        const color2 = shardToColor[request.Consumed[1].ItemType];
        if (!color1 || !color2) {
            throw new Error("Invalid shard types provided");
        }
        break;
    default:
        throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
_:hammer_and_wrench: Refactor suggestion_ **Add input validation for the request.** The controller needs validation for: 1. Empty or undefined `request.Consumed` array 2. Minimum required items for each fusion type 3. Invalid color combinations that could crash the `combineColors` function Consider adding this validation at the start of the controller: ```typescript if (!request.Consumed?.length) { throw new Error("No items provided for fusion"); } switch (request.FusionType) { case "AFT_ASCENT": if (request.Consumed.length < 1) { throw new Error("AFT_ASCENT requires at least 1 item"); } break; case "AFT_COALESCENT": if (request.Consumed.length < 2) { throw new Error("AFT_COALESCENT requires at least 2 items"); } // Validate colors exist in shardToColor mapping const color1 = shardToColor[request.Consumed[0].ItemType]; const color2 = shardToColor[request.Consumed[1].ItemType]; if (!color1 || !color2) { throw new Error("Invalid shard types provided"); } break; default: throw new Error(`Unknown fusion type: ${request.FusionType}`); } ``` <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

⚠️ Potential issue

Fix the item count negation logic.

The line request.Consumed.forEach(x => x.ItemCount * -1) performs the multiplication but doesn't assign the result back to x.ItemCount.

Apply this diff to fix the negation:

-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
📝 Committable suggestion

‼️ 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.

    request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
_:warning: Potential issue_ **Fix the item count negation logic.** The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`. Apply this diff to fix the negation: ```diff -request.Consumed.forEach(x => x.ItemCount * -1); +request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ``` <!-- 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 request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->
});
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

🛠️ Refactor suggestion

Add input validation for the request.

The controller needs validation for:

  1. Empty or undefined request.Consumed array
  2. Minimum required items for each fusion type
  3. Invalid color combinations that could crash the combineColors function

Consider adding this validation at the start of the controller:

if (!request.Consumed?.length) {
    throw new Error("No items provided for fusion");
}

switch (request.FusionType) {
    case "AFT_ASCENT":
        if (request.Consumed.length < 1) {
            throw new Error("AFT_ASCENT requires at least 1 item");
        }
        break;
    case "AFT_COALESCENT":
        if (request.Consumed.length < 2) {
            throw new Error("AFT_COALESCENT requires at least 2 items");
        }
        // Validate colors exist in shardToColor mapping
        const color1 = shardToColor[request.Consumed[0].ItemType];
        const color2 = shardToColor[request.Consumed[1].ItemType];
        if (!color1 || !color2) {
            throw new Error("Invalid shard types provided");
        }
        break;
    default:
        throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
_:hammer_and_wrench: Refactor suggestion_ **Add input validation for the request.** The controller needs validation for: 1. Empty or undefined `request.Consumed` array 2. Minimum required items for each fusion type 3. Invalid color combinations that could crash the `combineColors` function Consider adding this validation at the start of the controller: ```typescript if (!request.Consumed?.length) { throw new Error("No items provided for fusion"); } switch (request.FusionType) { case "AFT_ASCENT": if (request.Consumed.length < 1) { throw new Error("AFT_ASCENT requires at least 1 item"); } break; case "AFT_COALESCENT": if (request.Consumed.length < 2) { throw new Error("AFT_COALESCENT requires at least 2 items"); } // Validate colors exist in shardToColor mapping const color1 = shardToColor[request.Consumed[0].ItemType]; const color2 = shardToColor[request.Consumed[1].ItemType]; if (!color1 || !color2) { throw new Error("Invalid shard types provided"); } break; default: throw new Error(`Unknown fusion type: ${request.FusionType}`); } ``` <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

⚠️ Potential issue

Fix the item count negation logic.

The line request.Consumed.forEach(x => x.ItemCount * -1) performs the multiplication but doesn't assign the result back to x.ItemCount.

Apply this diff to fix the negation:

-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
📝 Committable suggestion

‼️ 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.

    request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
_:warning: Potential issue_ **Fix the item count negation logic.** The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`. Apply this diff to fix the negation: ```diff -request.Consumed.forEach(x => x.ItemCount * -1); +request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ``` <!-- 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 request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->
};
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

🛠️ Refactor suggestion

Add input validation for the request.

The controller needs validation for:

  1. Empty or undefined request.Consumed array
  2. Minimum required items for each fusion type
  3. Invalid color combinations that could crash the combineColors function

Consider adding this validation at the start of the controller:

if (!request.Consumed?.length) {
    throw new Error("No items provided for fusion");
}

switch (request.FusionType) {
    case "AFT_ASCENT":
        if (request.Consumed.length < 1) {
            throw new Error("AFT_ASCENT requires at least 1 item");
        }
        break;
    case "AFT_COALESCENT":
        if (request.Consumed.length < 2) {
            throw new Error("AFT_COALESCENT requires at least 2 items");
        }
        // Validate colors exist in shardToColor mapping
        const color1 = shardToColor[request.Consumed[0].ItemType];
        const color2 = shardToColor[request.Consumed[1].ItemType];
        if (!color1 || !color2) {
            throw new Error("Invalid shard types provided");
        }
        break;
    default:
        throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
_:hammer_and_wrench: Refactor suggestion_ **Add input validation for the request.** The controller needs validation for: 1. Empty or undefined `request.Consumed` array 2. Minimum required items for each fusion type 3. Invalid color combinations that could crash the `combineColors` function Consider adding this validation at the start of the controller: ```typescript if (!request.Consumed?.length) { throw new Error("No items provided for fusion"); } switch (request.FusionType) { case "AFT_ASCENT": if (request.Consumed.length < 1) { throw new Error("AFT_ASCENT requires at least 1 item"); } break; case "AFT_COALESCENT": if (request.Consumed.length < 2) { throw new Error("AFT_COALESCENT requires at least 2 items"); } // Validate colors exist in shardToColor mapping const color1 = shardToColor[request.Consumed[0].ItemType]; const color2 = shardToColor[request.Consumed[1].ItemType]; if (!color1 || !color2) { throw new Error("Invalid shard types provided"); } break; default: throw new Error(`Unknown fusion type: ${request.FusionType}`); } ``` <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

⚠️ Potential issue

Fix the item count negation logic.

The line request.Consumed.forEach(x => x.ItemCount * -1) performs the multiplication but doesn't assign the result back to x.ItemCount.

Apply this diff to fix the negation:

-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
📝 Committable suggestion

‼️ 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.

    request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
_:warning: Potential issue_ **Fix the item count negation logic.** The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`. Apply this diff to fix the negation: ```diff -request.Consumed.forEach(x => x.ItemCount * -1); +request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ``` <!-- 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 request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

🛠️ Refactor suggestion

Add input validation for the request.

The controller needs validation for:

  1. Empty or undefined request.Consumed array
  2. Minimum required items for each fusion type
  3. Invalid color combinations that could crash the combineColors function

Consider adding this validation at the start of the controller:

if (!request.Consumed?.length) {
    throw new Error("No items provided for fusion");
}

switch (request.FusionType) {
    case "AFT_ASCENT":
        if (request.Consumed.length < 1) {
            throw new Error("AFT_ASCENT requires at least 1 item");
        }
        break;
    case "AFT_COALESCENT":
        if (request.Consumed.length < 2) {
            throw new Error("AFT_COALESCENT requires at least 2 items");
        }
        // Validate colors exist in shardToColor mapping
        const color1 = shardToColor[request.Consumed[0].ItemType];
        const color2 = shardToColor[request.Consumed[1].ItemType];
        if (!color1 || !color2) {
            throw new Error("Invalid shard types provided");
        }
        break;
    default:
        throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
_:hammer_and_wrench: Refactor suggestion_ **Add input validation for the request.** The controller needs validation for: 1. Empty or undefined `request.Consumed` array 2. Minimum required items for each fusion type 3. Invalid color combinations that could crash the `combineColors` function Consider adding this validation at the start of the controller: ```typescript if (!request.Consumed?.length) { throw new Error("No items provided for fusion"); } switch (request.FusionType) { case "AFT_ASCENT": if (request.Consumed.length < 1) { throw new Error("AFT_ASCENT requires at least 1 item"); } break; case "AFT_COALESCENT": if (request.Consumed.length < 2) { throw new Error("AFT_COALESCENT requires at least 2 items"); } // Validate colors exist in shardToColor mapping const color1 = shardToColor[request.Consumed[0].ItemType]; const color2 = shardToColor[request.Consumed[1].ItemType]; if (!color1 || !color2) { throw new Error("Invalid shard types provided"); } break; default: throw new Error(`Unknown fusion type: ${request.FusionType}`); } ``` <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

⚠️ Potential issue

Fix the item count negation logic.

The line request.Consumed.forEach(x => x.ItemCount * -1) performs the multiplication but doesn't assign the result back to x.ItemCount.

Apply this diff to fix the negation:

-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
📝 Committable suggestion

‼️ 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.

    request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
_:warning: Potential issue_ **Fix the item count negation logic.** The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`. Apply this diff to fix the negation: ```diff -request.Consumed.forEach(x => x.ItemCount * -1); +request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ``` <!-- 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 request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->
interface IArchonFusionRequest {
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

🛠️ Refactor suggestion

Add input validation for the request.

The controller needs validation for:

  1. Empty or undefined request.Consumed array
  2. Minimum required items for each fusion type
  3. Invalid color combinations that could crash the combineColors function

Consider adding this validation at the start of the controller:

if (!request.Consumed?.length) {
    throw new Error("No items provided for fusion");
}

switch (request.FusionType) {
    case "AFT_ASCENT":
        if (request.Consumed.length < 1) {
            throw new Error("AFT_ASCENT requires at least 1 item");
        }
        break;
    case "AFT_COALESCENT":
        if (request.Consumed.length < 2) {
            throw new Error("AFT_COALESCENT requires at least 2 items");
        }
        // Validate colors exist in shardToColor mapping
        const color1 = shardToColor[request.Consumed[0].ItemType];
        const color2 = shardToColor[request.Consumed[1].ItemType];
        if (!color1 || !color2) {
            throw new Error("Invalid shard types provided");
        }
        break;
    default:
        throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
_:hammer_and_wrench: Refactor suggestion_ **Add input validation for the request.** The controller needs validation for: 1. Empty or undefined `request.Consumed` array 2. Minimum required items for each fusion type 3. Invalid color combinations that could crash the `combineColors` function Consider adding this validation at the start of the controller: ```typescript if (!request.Consumed?.length) { throw new Error("No items provided for fusion"); } switch (request.FusionType) { case "AFT_ASCENT": if (request.Consumed.length < 1) { throw new Error("AFT_ASCENT requires at least 1 item"); } break; case "AFT_COALESCENT": if (request.Consumed.length < 2) { throw new Error("AFT_COALESCENT requires at least 2 items"); } // Validate colors exist in shardToColor mapping const color1 = shardToColor[request.Consumed[0].ItemType]; const color2 = shardToColor[request.Consumed[1].ItemType]; if (!color1 || !color2) { throw new Error("Invalid shard types provided"); } break; default: throw new Error(`Unknown fusion type: ${request.FusionType}`); } ``` <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

⚠️ Potential issue

Fix the item count negation logic.

The line request.Consumed.forEach(x => x.ItemCount * -1) performs the multiplication but doesn't assign the result back to x.ItemCount.

Apply this diff to fix the negation:

-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
📝 Committable suggestion

‼️ 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.

    request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
_:warning: Potential issue_ **Fix the item count negation logic.** The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`. Apply this diff to fix the negation: ```diff -request.Consumed.forEach(x => x.ItemCount * -1); +request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ``` <!-- 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 request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->
Consumed: IMiscItem[];
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

🛠️ Refactor suggestion

Add input validation for the request.

The controller needs validation for:

  1. Empty or undefined request.Consumed array
  2. Minimum required items for each fusion type
  3. Invalid color combinations that could crash the combineColors function

Consider adding this validation at the start of the controller:

if (!request.Consumed?.length) {
    throw new Error("No items provided for fusion");
}

switch (request.FusionType) {
    case "AFT_ASCENT":
        if (request.Consumed.length < 1) {
            throw new Error("AFT_ASCENT requires at least 1 item");
        }
        break;
    case "AFT_COALESCENT":
        if (request.Consumed.length < 2) {
            throw new Error("AFT_COALESCENT requires at least 2 items");
        }
        // Validate colors exist in shardToColor mapping
        const color1 = shardToColor[request.Consumed[0].ItemType];
        const color2 = shardToColor[request.Consumed[1].ItemType];
        if (!color1 || !color2) {
            throw new Error("Invalid shard types provided");
        }
        break;
    default:
        throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
_:hammer_and_wrench: Refactor suggestion_ **Add input validation for the request.** The controller needs validation for: 1. Empty or undefined `request.Consumed` array 2. Minimum required items for each fusion type 3. Invalid color combinations that could crash the `combineColors` function Consider adding this validation at the start of the controller: ```typescript if (!request.Consumed?.length) { throw new Error("No items provided for fusion"); } switch (request.FusionType) { case "AFT_ASCENT": if (request.Consumed.length < 1) { throw new Error("AFT_ASCENT requires at least 1 item"); } break; case "AFT_COALESCENT": if (request.Consumed.length < 2) { throw new Error("AFT_COALESCENT requires at least 2 items"); } // Validate colors exist in shardToColor mapping const color1 = shardToColor[request.Consumed[0].ItemType]; const color2 = shardToColor[request.Consumed[1].ItemType]; if (!color1 || !color2) { throw new Error("Invalid shard types provided"); } break; default: throw new Error(`Unknown fusion type: ${request.FusionType}`); } ``` <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

⚠️ Potential issue

Fix the item count negation logic.

The line request.Consumed.forEach(x => x.ItemCount * -1) performs the multiplication but doesn't assign the result back to x.ItemCount.

Apply this diff to fix the negation:

-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
📝 Committable suggestion

‼️ 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.

    request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
_:warning: Potential issue_ **Fix the item count negation logic.** The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`. Apply this diff to fix the negation: ```diff -request.Consumed.forEach(x => x.ItemCount * -1); +request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ``` <!-- 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 request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->
FusionType: string;
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

🛠️ Refactor suggestion

Add input validation for the request.

The controller needs validation for:

  1. Empty or undefined request.Consumed array
  2. Minimum required items for each fusion type
  3. Invalid color combinations that could crash the combineColors function

Consider adding this validation at the start of the controller:

if (!request.Consumed?.length) {
    throw new Error("No items provided for fusion");
}

switch (request.FusionType) {
    case "AFT_ASCENT":
        if (request.Consumed.length < 1) {
            throw new Error("AFT_ASCENT requires at least 1 item");
        }
        break;
    case "AFT_COALESCENT":
        if (request.Consumed.length < 2) {
            throw new Error("AFT_COALESCENT requires at least 2 items");
        }
        // Validate colors exist in shardToColor mapping
        const color1 = shardToColor[request.Consumed[0].ItemType];
        const color2 = shardToColor[request.Consumed[1].ItemType];
        if (!color1 || !color2) {
            throw new Error("Invalid shard types provided");
        }
        break;
    default:
        throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
_:hammer_and_wrench: Refactor suggestion_ **Add input validation for the request.** The controller needs validation for: 1. Empty or undefined `request.Consumed` array 2. Minimum required items for each fusion type 3. Invalid color combinations that could crash the `combineColors` function Consider adding this validation at the start of the controller: ```typescript if (!request.Consumed?.length) { throw new Error("No items provided for fusion"); } switch (request.FusionType) { case "AFT_ASCENT": if (request.Consumed.length < 1) { throw new Error("AFT_ASCENT requires at least 1 item"); } break; case "AFT_COALESCENT": if (request.Consumed.length < 2) { throw new Error("AFT_COALESCENT requires at least 2 items"); } // Validate colors exist in shardToColor mapping const color1 = shardToColor[request.Consumed[0].ItemType]; const color2 = shardToColor[request.Consumed[1].ItemType]; if (!color1 || !color2) { throw new Error("Invalid shard types provided"); } break; default: throw new Error(`Unknown fusion type: ${request.FusionType}`); } ``` <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

⚠️ Potential issue

Fix the item count negation logic.

The line request.Consumed.forEach(x => x.ItemCount * -1) performs the multiplication but doesn't assign the result back to x.ItemCount.

Apply this diff to fix the negation:

-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
📝 Committable suggestion

‼️ 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.

    request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
_:warning: Potential issue_ **Fix the item count negation logic.** The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`. Apply this diff to fix the negation: ```diff -request.Consumed.forEach(x => x.ItemCount * -1); +request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ``` <!-- 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 request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->
StatResultType: "SRT_NEW_STAT"; // ???
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

🛠️ Refactor suggestion

Add input validation for the request.

The controller needs validation for:

  1. Empty or undefined request.Consumed array
  2. Minimum required items for each fusion type
  3. Invalid color combinations that could crash the combineColors function

Consider adding this validation at the start of the controller:

if (!request.Consumed?.length) {
    throw new Error("No items provided for fusion");
}

switch (request.FusionType) {
    case "AFT_ASCENT":
        if (request.Consumed.length < 1) {
            throw new Error("AFT_ASCENT requires at least 1 item");
        }
        break;
    case "AFT_COALESCENT":
        if (request.Consumed.length < 2) {
            throw new Error("AFT_COALESCENT requires at least 2 items");
        }
        // Validate colors exist in shardToColor mapping
        const color1 = shardToColor[request.Consumed[0].ItemType];
        const color2 = shardToColor[request.Consumed[1].ItemType];
        if (!color1 || !color2) {
            throw new Error("Invalid shard types provided");
        }
        break;
    default:
        throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
_:hammer_and_wrench: Refactor suggestion_ **Add input validation for the request.** The controller needs validation for: 1. Empty or undefined `request.Consumed` array 2. Minimum required items for each fusion type 3. Invalid color combinations that could crash the `combineColors` function Consider adding this validation at the start of the controller: ```typescript if (!request.Consumed?.length) { throw new Error("No items provided for fusion"); } switch (request.FusionType) { case "AFT_ASCENT": if (request.Consumed.length < 1) { throw new Error("AFT_ASCENT requires at least 1 item"); } break; case "AFT_COALESCENT": if (request.Consumed.length < 2) { throw new Error("AFT_COALESCENT requires at least 2 items"); } // Validate colors exist in shardToColor mapping const color1 = shardToColor[request.Consumed[0].ItemType]; const color2 = shardToColor[request.Consumed[1].ItemType]; if (!color1 || !color2) { throw new Error("Invalid shard types provided"); } break; default: throw new Error(`Unknown fusion type: ${request.FusionType}`); } ``` <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

⚠️ Potential issue

Fix the item count negation logic.

The line request.Consumed.forEach(x => x.ItemCount * -1) performs the multiplication but doesn't assign the result back to x.ItemCount.

Apply this diff to fix the negation:

-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
📝 Committable suggestion

‼️ 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.

    request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
_:warning: Potential issue_ **Fix the item count negation logic.** The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`. Apply this diff to fix the negation: ```diff -request.Consumed.forEach(x => x.ItemCount * -1); +request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ``` <!-- 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 request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->
}
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

🛠️ Refactor suggestion

Add input validation for the request.

The controller needs validation for:

  1. Empty or undefined request.Consumed array
  2. Minimum required items for each fusion type
  3. Invalid color combinations that could crash the combineColors function

Consider adding this validation at the start of the controller:

if (!request.Consumed?.length) {
    throw new Error("No items provided for fusion");
}

switch (request.FusionType) {
    case "AFT_ASCENT":
        if (request.Consumed.length < 1) {
            throw new Error("AFT_ASCENT requires at least 1 item");
        }
        break;
    case "AFT_COALESCENT":
        if (request.Consumed.length < 2) {
            throw new Error("AFT_COALESCENT requires at least 2 items");
        }
        // Validate colors exist in shardToColor mapping
        const color1 = shardToColor[request.Consumed[0].ItemType];
        const color2 = shardToColor[request.Consumed[1].ItemType];
        if (!color1 || !color2) {
            throw new Error("Invalid shard types provided");
        }
        break;
    default:
        throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
_:hammer_and_wrench: Refactor suggestion_ **Add input validation for the request.** The controller needs validation for: 1. Empty or undefined `request.Consumed` array 2. Minimum required items for each fusion type 3. Invalid color combinations that could crash the `combineColors` function Consider adding this validation at the start of the controller: ```typescript if (!request.Consumed?.length) { throw new Error("No items provided for fusion"); } switch (request.FusionType) { case "AFT_ASCENT": if (request.Consumed.length < 1) { throw new Error("AFT_ASCENT requires at least 1 item"); } break; case "AFT_COALESCENT": if (request.Consumed.length < 2) { throw new Error("AFT_COALESCENT requires at least 2 items"); } // Validate colors exist in shardToColor mapping const color1 = shardToColor[request.Consumed[0].ItemType]; const color2 = shardToColor[request.Consumed[1].ItemType]; if (!color1 || !color2) { throw new Error("Invalid shard types provided"); } break; default: throw new Error(`Unknown fusion type: ${request.FusionType}`); } ``` <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

⚠️ Potential issue

Fix the item count negation logic.

The line request.Consumed.forEach(x => x.ItemCount * -1) performs the multiplication but doesn't assign the result back to x.ItemCount.

Apply this diff to fix the negation:

-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
📝 Committable suggestion

‼️ 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.

    request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
_:warning: Potential issue_ **Fix the item count negation logic.** The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`. Apply this diff to fix the negation: ```diff -request.Consumed.forEach(x => x.ItemCount * -1); +request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ``` <!-- 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 request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1); ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->

View File

@ -15,6 +15,7 @@ import { getRecipe } from "@/src/services/itemDataService";
import { TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel";
import { toMongoDate } from "@/src/helpers/inventoryHelpers";
import { logger } from "@/src/utils/logger";
import { colorToShard } from "@/src/helpers/shardHelper";
export const infestedFoundryController: RequestHandler = async (req, res) => {
const accountId = await getAccountIdForRequest(req);
@ -355,21 +356,6 @@ interface IHelminthFeedRequest {
}[];
}
const colorToShard: Record<string, string> = {
ACC_RED: "/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalAmar",
ACC_RED_MYTHIC: "/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalAmarMythic",
ACC_YELLOW: "/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalNira",
ACC_YELLOW_MYTHIC: "/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalNiraMythic",
ACC_BLUE: "/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalBoreal",
ACC_BLUE_MYTHIC: "/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalBorealMythic",
ACC_GREEN: "/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalGreen",
ACC_GREEN_MYTHIC: "/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalGreenMythic",
ACC_ORANGE: "/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalOrange",
ACC_ORANGE_MYTHIC: "/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalOrangeMythic",
ACC_PURPLE: "/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalViolet",
ACC_PURPLE_MYTHIC: "/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalVioletMythic"
};
export const addInfestedFoundryXP = (infestedFoundry: IInfestedFoundry, delta: number): ITypeCount[] => {
const recipeChanges: ITypeCount[] = [];
infestedFoundry.XP ??= 0;

View File

@ -0,0 +1,66 @@
export const colorToShard: Record<string, string> = {
ACC_RED: "/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalAmar",
ACC_RED_MYTHIC: "/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalAmarMythic",
ACC_YELLOW: "/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalNira",
ACC_YELLOW_MYTHIC: "/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalNiraMythic",
ACC_BLUE: "/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalBoreal",
ACC_BLUE_MYTHIC: "/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalBorealMythic",
ACC_GREEN: "/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalGreen",
ACC_GREEN_MYTHIC: "/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalGreenMythic",
ACC_ORANGE: "/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalOrange",
ACC_ORANGE_MYTHIC: "/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalOrangeMythic",
ACC_PURPLE: "/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalViolet",
ACC_PURPLE_MYTHIC: "/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalVioletMythic"
};
export const shardToColor: Record<string, string> = {
"/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalAmar": "ACC_RED",
"/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalAmarMythic": "ACC_RED_MYTHIC",
"/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalNira": "ACC_YELLOW",
"/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalNiraMythic": "ACC_YELLOW_MYTHIC",
"/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalBoreal": "ACC_BLUE",
"/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalBorealMythic": "ACC_BLUE_MYTHIC",
"/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalGreen": "ACC_GREEN",
"/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalGreenMythic": "ACC_GREEN_MYTHIC",
"/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalOrange": "ACC_ORANGE",
"/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalOrangeMythic": "ACC_ORANGE_MYTHIC",
"/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalViolet": "ACC_PURPLE",
"/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalVioletMythic": "ACC_PURPLE_MYTHIC"
};
export const combineColors = (a: string, b: string): string => {
return (
combinePlainColors(a.replace("_MYTHIC", ""), b.replace("_MYTHIC", "")) +
(a.indexOf("_MYTHIC") != -1 ? "_MYTHIC" : "")
);
};
const combinePlainColors = (a: string, b: string): string => {
switch (a) {
case "ACC_RED":
switch (b) {
case "ACC_YELLOW":
return "ACC_ORANGE";
case "ACC_BLUE":
return "ACC_PURPLE";
}
break;
case "ACC_YELLOW":
switch (b) {
case "ACC_RED":
return "ACC_ORANGE";
case "ACC_BLUE":
return "ACC_GREEN";
}
break;
case "ACC_BLUE":
switch (b) {
case "ACC_RED":
return "ACC_PURPLE";
case "ACC_YELLOW":
return "ACC_GREEN";
}
break;
}
throw new Error(`invalid color combination request: ${a} and ${b}`);
};
coderabbitai[bot] commented 2025-01-16 06:25:00 -08:00 (Migrated from github.com)
Review

🛠️ Refactor suggestion

Complete the color combination matrix.

The combinePlainColors function only handles some color combinations. It's missing:

  1. Reverse combinations (e.g., YELLOW + RED should equal ORANGE)
  2. Invalid combinations should be explicitly handled

Consider this more complete implementation:

const combinePlainColors = (a: string, b: string): string => {
    // Normalize order for consistent combinations
    const [color1, color2] = [a, b].sort();
    
    const combination = `${color1}:${color2}`;
    switch (combination) {
        case "ACC_RED:ACC_YELLOW":
            return "ACC_ORANGE";
        case "ACC_RED:ACC_BLUE":
            return "ACC_PURPLE";
        case "ACC_YELLOW:ACC_BLUE":
            return "ACC_GREEN";
        default:
            throw new Error(`Invalid color combination: ${a} and ${b}`);
    }
};
_:hammer_and_wrench: Refactor suggestion_ **Complete the color combination matrix.** The `combinePlainColors` function only handles some color combinations. It's missing: 1. Reverse combinations (e.g., YELLOW + RED should equal ORANGE) 2. Invalid combinations should be explicitly handled Consider this more complete implementation: ```typescript const combinePlainColors = (a: string, b: string): string => { // Normalize order for consistent combinations const [color1, color2] = [a, b].sort(); const combination = `${color1}:${color2}`; switch (combination) { case "ACC_RED:ACC_YELLOW": return "ACC_ORANGE"; case "ACC_RED:ACC_BLUE": return "ACC_PURPLE"; case "ACC_YELLOW:ACC_BLUE": return "ACC_GREEN"; default: throw new Error(`Invalid color combination: ${a} and ${b}`); } }; ``` <!-- This is an auto-generated comment by CodeRabbit -->

View File

@ -2,6 +2,7 @@ import express from "express";
import { activateRandomModController } from "@/src/controllers/api/activateRandomModController";
import { addFriendImageController } from "@/src/controllers/api/addFriendImageController";
import { arcaneCommonController } from "@/src/controllers/api/arcaneCommonController";
import { archonFusionController } from "@/src/controllers/api/archonFusionController";
import { artifactsController } from "../controllers/api/artifactsController";
import { checkDailyMissionBonusController } from "@/src/controllers/api/checkDailyMissionBonusController";
import { claimCompletedRecipeController } from "@/src/controllers/api/claimCompletedRecipeController";
@ -114,6 +115,7 @@ apiRouter.get("/updateSession.php", updateSessionGetController);
apiRouter.post("/activateRandomMod.php", activateRandomModController);
apiRouter.post("/addFriendImage.php", addFriendImageController);
apiRouter.post("/arcaneCommon.php", arcaneCommonController);
apiRouter.post("/archonFusion.php", archonFusionController);
apiRouter.post("/artifacts.php", artifactsController);
apiRouter.post("/claimCompletedRecipe.php", claimCompletedRecipeController);
apiRouter.post("/createGuild.php", createGuildController);