feat(webui): add "add missing warframes" & "add missing weapons" #775

Merged
Sainan merged 4 commits from bulk into main 2025-01-14 20:20:17 -08:00
Owner

Closes #344

Closes #344
coderabbitai[bot] commented 2025-01-12 00:37:52 -08:00 (Migrated from github.com)
Author
Owner

Walkthrough

The pull request introduces significant changes to the item addition process in the application. The primary modification is the transition from a single-item addition controller to a batch item addition approach. The addItemController in the src/controllers/custom/addItemController.ts file has been removed and replaced with addItemsController in a new file, which supports adding multiple items in a single request.

The changes span across multiple files, including the controller, routes, helper functions, and client-side JavaScript. The new implementation allows for batch processing of items, specifically for powersuits and weapons. The route has been updated from /addItem to /addItems, reflecting the new batch-oriented functionality. The client-side script has been modified to support sending multiple item requests simultaneously and includes new functions for adding missing warframes and weapons in bulk.

The modifications aim to improve the item addition workflow by providing more flexible and efficient item management capabilities.

Finishing Touches

  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.
<!-- This is an auto-generated comment: summarize by coderabbit.ai --> <!-- walkthrough_start --> ## Walkthrough The pull request introduces significant changes to the item addition process in the application. The primary modification is the transition from a single-item addition controller to a batch item addition approach. The `addItemController` in the `src/controllers/custom/addItemController.ts` file has been removed and replaced with `addItemsController` in a new file, which supports adding multiple items in a single request. The changes span across multiple files, including the controller, routes, helper functions, and client-side JavaScript. The new implementation allows for batch processing of items, specifically for powersuits and weapons. The route has been updated from `/addItem` to `/addItems`, reflecting the new batch-oriented functionality. The client-side script has been modified to support sending multiple item requests simultaneously and includes new functions for adding missing warframes and weapons in bulk. The modifications aim to improve the item addition workflow by providing more flexible and efficient item management capabilities. <!-- walkthrough_end --> <!-- internal state start --> <!-- FAHghAtBAEAqAWBLAztF0CGA7TBXALgPYQDmAplmQE4b5kAm0AxoQLasX4Bc0ADldEIAjAFZkm+RADcyqIQE9mhetQxChifADoMiaFAB8wY+CjGAxOegAFAErQAyrnYYq84wjJ9cAGx/QqMgBHXFl8aEl8HwZoACIAMzJaAAoAdzIhXEQASh4MekYAc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uz3nSj8TXmLx5OzjPmAm/Ds34Wi3pPPxG8iWvJiSuOWPNhtP+XyTP2eONm+PjngOhO7Qz7MgL76PxPoAuKpO0zZOwwVPxtqUlOwRvOjszKlOy1NPvC83s04UaHOV9OpSHLupcoBlAo1cSpF7Xy2BqoAgMA6oFTGpmplBWoNB2psoupQA/JIoZgAB9fYZACrwIcsOhBgCr1ODJTqeLsrgADgAE4mAnEmB1BCQMg7h6AzH6A7hIGzGmAzHrgzH4gzGhBOvOuhB7h2uevOuAA2Y0Mx40O4LEHyUrqAcrzQKr562rmBE4dIegCrgKVroAA= --> <!-- internal state end --> <!-- finishing_touch_checkbox_start --> ## Finishing Touches - [ ] <!-- {"checkboxId": "7962f53c-55bc-4827-bfbf-6a18da830691"} --> 📝 Generate Docstrings (Beta) <!-- finishing_touch_checkbox_end --> <!-- tips_start --> --- Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? <details> <summary>❤️ Share</summary> - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code) </details> <details> <summary>🪧 Tips</summary> ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit <commit_id>, please review it.` - `Generate unit testing code for this file.` - `Open a follow-up GitHub issue for this discussion.` - Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples: - `@coderabbitai generate unit testing code for this file.` - `@coderabbitai modularize this function.` - PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples: - `@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.` - `@coderabbitai read src/utils.ts and generate unit testing code.` - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.` - `@coderabbitai help me debug CodeRabbit configuration file.` Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. ### CodeRabbit Commands (Invoked using PR comments) - `@coderabbitai pause` to pause the reviews on a PR. - `@coderabbitai resume` to resume the paused reviews. - `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository. - `@coderabbitai full review` to do a full review from scratch and review all the files again. - `@coderabbitai summary` to regenerate the summary of the PR. - `@coderabbitai generate docstrings` to [generate docstrings](https://docs.coderabbit.ai/finishing-touches/docstrings) for this PR. ([Beta](https://docs.coderabbit.ai/early-access#beta)) - `@coderabbitai resolve` resolve all the CodeRabbit review comments. - `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository. - `@coderabbitai help` to get help. ### Other keywords and placeholders - Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed. - Add `@coderabbitai summary` to generate the high-level summary at a specific location in the PR description. - Add `@coderabbitai` anywhere in the PR title to generate the title automatically. ### Documentation and Community - Visit our [Documentation](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit. - Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements. </details> <!-- tips_end -->
coderabbitai[bot] (Migrated from github.com) reviewed 2025-01-12 00:42:59 -08:00
coderabbitai[bot] (Migrated from github.com) left a comment
Author
Owner

Actionable comments posted: 2

🧹 Nitpick comments (4)
src/controllers/custom/addItemsController.ts (1)

25-33: Consider using string literal types for better type safety.

The ItemType enum could be more type-safe by using string literal types.

Consider this refactor:

-enum ItemType {
-    Powersuit = "Powersuit",
-    Weapon = "Weapon"
-}
+type ItemType = "Powersuit" | "Weapon";
+const ItemType = {
+    Powersuit: "Powersuit" as ItemType,
+    Weapon: "Weapon" as ItemType
+} as const;
static/webui/script.js (2)

529-536: Consider consolidating duplicate code in item addition functions.

The doAcquireWarframe and doAcquireWeapon functions share similar structure and could be refactored to reduce duplication.

Consider this refactor:

+function doAcquireItem(type, inputId) {
+    const uniqueName = getKey(document.getElementById(inputId));
+    if (!uniqueName) {
+        $(`#${inputId}`).addClass("is-invalid").focus();
+        return;
+    }
+    revalidateAuthz(() => {
+        const req = $.post({
+            url: "/custom/addItems?" + window.authz,
+            contentType: "application/json",
+            data: JSON.stringify([
+                {
+                    type: type,
+                    internalName: uniqueName
+                }
+            ])
+        });
+        req.done(() => {
+            document.getElementById(inputId).value = "";
+            updateInventory();
+        });
+    });
+}

-function doAcquireWarframe() {
-    // ... existing code ...
-}
+function doAcquireWarframe() {
+    doAcquireItem("Powersuit", "warframe-to-acquire");
+}

-function doAcquireWeapon() {
-    // ... existing code ...
-}
+function doAcquireWeapon() {
+    doAcquireItem("Weapon", "weapon-to-acquire");
+}

Also applies to: 557-564


590-618: Consider adding progress indication for bulk operations.

The bulk addition functions could benefit from progress indication during processing.

Consider adding loading states:

 function addMissingWarframes() {
     const requests = [];
     document.querySelectorAll("#datalist-warframes option").forEach(elm => {
         if (!document.querySelector("#warframe-list [data-item-type='" + elm.getAttribute("data-key") + "']")) {
             requests.push({ type: "Powersuit", internalName: elm.getAttribute("data-key") });
         }
     });
     if (
         requests.length != 0 &&
         window.confirm("Are you sure you want to add " + requests.length + " items to your account?")
     ) {
+        const btn = document.querySelector('button[onclick="addMissingWarframes();"]');
+        const originalText = btn.textContent;
+        btn.disabled = true;
+        btn.textContent = "Adding...";
         dispatchAddItemsRequestsBatch(requests);
+        req.always(() => {
+            btn.disabled = false;
+            btn.textContent = originalText;
+        });
     }
 }

Apply similar changes to addMissingWeapons.

🧰 Tools
🪛 eslint

[error] 590-590: 'addMissingWarframes' is defined but never used.

(@typescript-eslint/no-unused-vars)


[error] 605-605: 'addMissingWeapons' is defined but never used.

(@typescript-eslint/no-unused-vars)

static/webui/index.html (1)

85-89: Consider adding loading indicators for inventory updates.

The notification about inventory updates could be enhanced with a loading indicator.

Consider adding a loading indicator:

-<p class="mb-3">
+<p class="mb-3" id="inventory-update-notice">
     Note: Changes made here will only be reflected in-game when the game re-downloads your
     inventory. Visiting the navigation should be the easiest way to trigger that.
+    <span class="d-none" id="inventory-updating">
+        <span class="spinner-border spinner-border-sm" role="status"></span>
+        Updating inventory...
+    </span>
 </p>

Also applies to: 155-159

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5cbececb04 and 89c0cbbfae.

📒 Files selected for processing (6)
  • src/controllers/custom/addItemController.ts (0 hunks)
  • src/controllers/custom/addItemsController.ts (1 hunks)
  • src/helpers/customHelpers/addItemHelpers.ts (0 hunks)
  • src/routes/custom.ts (2 hunks)
  • static/webui/index.html (9 hunks)
  • static/webui/script.js (5 hunks)
💤 Files with no reviewable changes (2)
  • src/controllers/custom/addItemController.ts
  • src/helpers/customHelpers/addItemHelpers.ts
🧰 Additional context used
🪛 eslint
static/webui/script.js

[error] 579-579: '$' is not defined.

(no-undef)


[error] 590-590: 'addMissingWarframes' is defined but never used.

(@typescript-eslint/no-unused-vars)


[error] 605-605: 'addMissingWeapons' is defined but never used.

(@typescript-eslint/no-unused-vars)

🔇 Additional comments (4)
src/controllers/custom/addItemsController.ts (1)

1-4: LGTM! Clean and focused imports.

The imports are well-organized and clearly indicate the module's dependencies.

src/routes/custom.ts (1)

11-11: LGTM! Route update aligns with the new batch processing capability.

The route changes correctly reflect the transition from single-item to batch processing.

Also applies to: 26-26

static/webui/script.js (1)

193-193: LGTM! Added data attributes improve item tracking.

The data-item-type attributes enable efficient item lookup for the new bulk actions.

Also applies to: 271-271

static/webui/index.html (1)

111-117: LGTM! Well-structured UI for bulk actions.

The new card provides clear access to batch operations while maintaining consistent styling.

**Actionable comments posted: 2** <details> <summary>🧹 Nitpick comments (4)</summary><blockquote> <details> <summary>src/controllers/custom/addItemsController.ts (1)</summary><blockquote> `25-33`: **Consider using string literal types for better type safety.** The `ItemType` enum could be more type-safe by using string literal types. Consider this refactor: ```diff -enum ItemType { - Powersuit = "Powersuit", - Weapon = "Weapon" -} +type ItemType = "Powersuit" | "Weapon"; +const ItemType = { + Powersuit: "Powersuit" as ItemType, + Weapon: "Weapon" as ItemType +} as const; ``` </blockquote></details> <details> <summary>static/webui/script.js (2)</summary><blockquote> `529-536`: **Consider consolidating duplicate code in item addition functions.** The `doAcquireWarframe` and `doAcquireWeapon` functions share similar structure and could be refactored to reduce duplication. Consider this refactor: ```diff +function doAcquireItem(type, inputId) { + const uniqueName = getKey(document.getElementById(inputId)); + if (!uniqueName) { + $(`#${inputId}`).addClass("is-invalid").focus(); + return; + } + revalidateAuthz(() => { + const req = $.post({ + url: "/custom/addItems?" + window.authz, + contentType: "application/json", + data: JSON.stringify([ + { + type: type, + internalName: uniqueName + } + ]) + }); + req.done(() => { + document.getElementById(inputId).value = ""; + updateInventory(); + }); + }); +} -function doAcquireWarframe() { - // ... existing code ... -} +function doAcquireWarframe() { + doAcquireItem("Powersuit", "warframe-to-acquire"); +} -function doAcquireWeapon() { - // ... existing code ... -} +function doAcquireWeapon() { + doAcquireItem("Weapon", "weapon-to-acquire"); +} ``` Also applies to: 557-564 --- `590-618`: **Consider adding progress indication for bulk operations.** The bulk addition functions could benefit from progress indication during processing. Consider adding loading states: ```diff function addMissingWarframes() { const requests = []; document.querySelectorAll("#datalist-warframes option").forEach(elm => { if (!document.querySelector("#warframe-list [data-item-type='" + elm.getAttribute("data-key") + "']")) { requests.push({ type: "Powersuit", internalName: elm.getAttribute("data-key") }); } }); if ( requests.length != 0 && window.confirm("Are you sure you want to add " + requests.length + " items to your account?") ) { + const btn = document.querySelector('button[onclick="addMissingWarframes();"]'); + const originalText = btn.textContent; + btn.disabled = true; + btn.textContent = "Adding..."; dispatchAddItemsRequestsBatch(requests); + req.always(() => { + btn.disabled = false; + btn.textContent = originalText; + }); } } ``` Apply similar changes to `addMissingWeapons`. <details> <summary>🧰 Tools</summary> <details> <summary>🪛 eslint</summary> [error] 590-590: 'addMissingWarframes' is defined but never used. (@typescript-eslint/no-unused-vars) --- [error] 605-605: 'addMissingWeapons' is defined but never used. (@typescript-eslint/no-unused-vars) </details> </details> </blockquote></details> <details> <summary>static/webui/index.html (1)</summary><blockquote> `85-89`: **Consider adding loading indicators for inventory updates.** The notification about inventory updates could be enhanced with a loading indicator. Consider adding a loading indicator: ```diff -<p class="mb-3"> +<p class="mb-3" id="inventory-update-notice"> Note: Changes made here will only be reflected in-game when the game re-downloads your inventory. Visiting the navigation should be the easiest way to trigger that. + <span class="d-none" id="inventory-updating"> + <span class="spinner-border spinner-border-sm" role="status"></span> + Updating inventory... + </span> </p> ``` Also applies to: 155-159 </blockquote></details> </blockquote></details> <details> <summary>📜 Review details</summary> **Configuration used: .coderabbit.yaml** **Review profile: CHILL** **Plan: Pro** <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 5cbececb0459f31f30b956e266e588f0aa90ab40 and 89c0cbbfaeb5d2d512c272f2b99b758c0963235b. </details> <details> <summary>📒 Files selected for processing (6)</summary> * `src/controllers/custom/addItemController.ts` (0 hunks) * `src/controllers/custom/addItemsController.ts` (1 hunks) * `src/helpers/customHelpers/addItemHelpers.ts` (0 hunks) * `src/routes/custom.ts` (2 hunks) * `static/webui/index.html` (9 hunks) * `static/webui/script.js` (5 hunks) </details> <details> <summary>💤 Files with no reviewable changes (2)</summary> * src/controllers/custom/addItemController.ts * src/helpers/customHelpers/addItemHelpers.ts </details> <details> <summary>🧰 Additional context used</summary> <details> <summary>🪛 eslint</summary> <details> <summary>static/webui/script.js</summary> [error] 579-579: '$' is not defined. (no-undef) --- [error] 590-590: 'addMissingWarframes' is defined but never used. (@typescript-eslint/no-unused-vars) --- [error] 605-605: 'addMissingWeapons' is defined but never used. (@typescript-eslint/no-unused-vars) </details> </details> </details> <details> <summary>🔇 Additional comments (4)</summary><blockquote> <details> <summary>src/controllers/custom/addItemsController.ts (1)</summary> `1-4`: **LGTM! Clean and focused imports.** The imports are well-organized and clearly indicate the module's dependencies. </details> <details> <summary>src/routes/custom.ts (1)</summary> `11-11`: **LGTM! Route update aligns with the new batch processing capability.** The route changes correctly reflect the transition from single-item to batch processing. Also applies to: 26-26 </details> <details> <summary>static/webui/script.js (1)</summary> `193-193`: **LGTM! Added data attributes improve item tracking.** The `data-item-type` attributes enable efficient item lookup for the new bulk actions. Also applies to: 271-271 </details> <details> <summary>static/webui/index.html (1)</summary> `111-117`: **LGTM! Well-structured UI for bulk actions.** The new card provides clear access to batch operations while maintaining consistent styling. </details> </blockquote></details> </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
@ -0,0 +20,4 @@
}
await inventory.save();
res.end();
};
coderabbitai[bot] (Migrated from github.com) commented 2025-01-12 00:42:58 -08:00
Author
Owner

🛠️ Refactor suggestion

Consider adding error handling for invalid request bodies.

The controller lacks error handling for:

  • Invalid/malformed request body
  • Empty requests array
  • Unknown item types

Consider adding error handling:

 export const addItemsController: RequestHandler = async (req, res) => {
+    if (!Array.isArray(req.body)) {
+        res.status(400).json({ error: "Request body must be an array" });
+        return;
+    }
+    if (req.body.length === 0) {
+        res.status(400).json({ error: "Request body cannot be empty" });
+        return;
+    }
     const accountId = await getAccountIdForRequest(req);
     const requests = req.body as IAddItemRequest[];
     const inventory = await getInventory(accountId);
     for (const request of requests) {
+        if (!Object.values(ItemType).includes(request.type)) {
+            res.status(400).json({ error: `Invalid item type: ${request.type}` });
+            return;
+        }
         switch (request.type) {
             case ItemType.Powersuit:
                 addPowerSuit(inventory, request.internalName);
                 break;
             case ItemType.Weapon:
                 addEquipment(inventory, getWeaponType(request.internalName), request.internalName);
                 break;
         }
     }
     await inventory.save();
-    res.end();
+    res.status(200).json({ message: "Items added successfully" });
 };
📝 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.

export const addItemsController: RequestHandler = async (req, res) => {
    if (!Array.isArray(req.body)) {
        res.status(400).json({ error: "Request body must be an array" });
        return;
    }
    if (req.body.length === 0) {
        res.status(400).json({ error: "Request body cannot be empty" });
        return;
    }
    const accountId = await getAccountIdForRequest(req);
    const requests = req.body as IAddItemRequest[];
    const inventory = await getInventory(accountId);
    for (const request of requests) {
        if (!Object.values(ItemType).includes(request.type)) {
            res.status(400).json({ error: `Invalid item type: ${request.type}` });
            return;
        }
        switch (request.type) {
            case ItemType.Powersuit:
                addPowerSuit(inventory, request.internalName);
                break;
            case ItemType.Weapon:
                addEquipment(inventory, getWeaponType(request.internalName), request.internalName);
                break;
        }
    }
    await inventory.save();
    res.status(200).json({ message: "Items added successfully" });
};
_:hammer_and_wrench: Refactor suggestion_ **Consider adding error handling for invalid request bodies.** The controller lacks error handling for: - Invalid/malformed request body - Empty requests array - Unknown item types Consider adding error handling: ```diff export const addItemsController: RequestHandler = async (req, res) => { + if (!Array.isArray(req.body)) { + res.status(400).json({ error: "Request body must be an array" }); + return; + } + if (req.body.length === 0) { + res.status(400).json({ error: "Request body cannot be empty" }); + return; + } const accountId = await getAccountIdForRequest(req); const requests = req.body as IAddItemRequest[]; const inventory = await getInventory(accountId); for (const request of requests) { + if (!Object.values(ItemType).includes(request.type)) { + res.status(400).json({ error: `Invalid item type: ${request.type}` }); + return; + } switch (request.type) { case ItemType.Powersuit: addPowerSuit(inventory, request.internalName); break; case ItemType.Weapon: addEquipment(inventory, getWeaponType(request.internalName), request.internalName); break; } } await inventory.save(); - res.end(); + res.status(200).json({ message: "Items added successfully" }); }; ``` <!-- suggestion_start --> <details> <summary>📝 Committable suggestion</summary> > ‼️ **IMPORTANT** > Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements. `````suggestion export const addItemsController: RequestHandler = async (req, res) => { if (!Array.isArray(req.body)) { res.status(400).json({ error: "Request body must be an array" }); return; } if (req.body.length === 0) { res.status(400).json({ error: "Request body cannot be empty" }); return; } const accountId = await getAccountIdForRequest(req); const requests = req.body as IAddItemRequest[]; const inventory = await getInventory(accountId); for (const request of requests) { if (!Object.values(ItemType).includes(request.type)) { res.status(400).json({ error: `Invalid item type: ${request.type}` }); return; } switch (request.type) { case ItemType.Powersuit: addPowerSuit(inventory, request.internalName); break; case ItemType.Weapon: addEquipment(inventory, getWeaponType(request.internalName), request.internalName); break; } } await inventory.save(); res.status(200).json({ message: "Items added successfully" }); }; ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] (Migrated from github.com) commented 2025-01-12 00:42:58 -08:00
Author
Owner

🛠️ Refactor suggestion

Add error handling to batch request function.

The dispatchAddItemsRequestsBatch function should handle request failures.

Add error handling:

 function dispatchAddItemsRequestsBatch(requests) {
     revalidateAuthz(() => {
         const req = $.post({
             url: "/custom/addItems?" + window.authz,
             contentType: "application/json",
             data: JSON.stringify(requests)
         });
         req.done(() => {
             updateInventory();
         });
+        req.fail((jqXHR, textStatus, errorThrown) => {
+            alert(`Failed to add items: ${jqXHR.responseJSON?.error || errorThrown}`);
+        });
     });
 }
📝 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.

function dispatchAddItemsRequestsBatch(requests) {
    revalidateAuthz(() => {
        const req = $.post({
            url: "/custom/addItems?" + window.authz,
            contentType: "application/json",
            data: JSON.stringify(requests)
        });
        req.done(() => {
            updateInventory();
        });
        req.fail((jqXHR, textStatus, errorThrown) => {
            alert(`Failed to add items: ${jqXHR.responseJSON?.error || errorThrown}`);
        });
    });
}
🧰 Tools
🪛 eslint

[error] 579-579: '$' is not defined.

(no-undef)

_:hammer_and_wrench: Refactor suggestion_ **Add error handling to batch request function.** The `dispatchAddItemsRequestsBatch` function should handle request failures. Add error handling: ```diff function dispatchAddItemsRequestsBatch(requests) { revalidateAuthz(() => { const req = $.post({ url: "/custom/addItems?" + window.authz, contentType: "application/json", data: JSON.stringify(requests) }); req.done(() => { updateInventory(); }); + req.fail((jqXHR, textStatus, errorThrown) => { + alert(`Failed to add items: ${jqXHR.responseJSON?.error || errorThrown}`); + }); }); } ``` <!-- 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 function dispatchAddItemsRequestsBatch(requests) { revalidateAuthz(() => { const req = $.post({ url: "/custom/addItems?" + window.authz, contentType: "application/json", data: JSON.stringify(requests) }); req.done(() => { updateInventory(); }); req.fail((jqXHR, textStatus, errorThrown) => { alert(`Failed to add items: ${jqXHR.responseJSON?.error || errorThrown}`); }); }); } ````` </details> <!-- suggestion_end --> <details> <summary>🧰 Tools</summary> <details> <summary>🪛 eslint</summary> [error] 579-579: '$' is not defined. (no-undef) </details> </details> <!-- This is an auto-generated comment by CodeRabbit -->
Sign in to join this conversation.
No description provided.