feat: Quests 2 #878

Merged
OrdisPrime merged 5 commits from Quests2 into main 2025-02-01 07:26:02 -08:00
OrdisPrime commented 2025-01-31 14:01:12 -08:00 (Migrated from github.com)
No description provided.
coderabbitai[bot] commented 2025-01-31 14:01:20 -08:00 (Migrated from github.com)

Walkthrough

This pull request introduces several interconnected changes across multiple files in the project. The modifications primarily focus on updating the key chain and quest-related functionality. A new dependency version for warframe-public-export-plus is updated in the package.json. The changes include introducing a new controller for handling key chain triggered messages, modifying the inventory and quest services, and updating interfaces related to messages and key chain requests.

The modifications streamline the handling of key chain items, quest stages, and message processing. A new giveKeyChainTriggeredMessageController has been added to the API routes, and the existing services have been refactored to support more flexible item and message handling. The changes also include improvements to error messaging and data structure organization.

Suggested reviewers

  • Sainan
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 This pull request introduces several interconnected changes across multiple files in the project. The modifications primarily focus on updating the key chain and quest-related functionality. A new dependency version for `warframe-public-export-plus` is updated in the `package.json`. The changes include introducing a new controller for handling key chain triggered messages, modifying the inventory and quest services, and updating interfaces related to messages and key chain requests. The modifications streamline the handling of key chain items, quest stages, and message processing. A new `giveKeyChainTriggeredMessageController` has been added to the API routes, and the existing services have been refactored to support more flexible item and message handling. The changes also include improvements to error messaging and data structure organization. ## Suggested reviewers - Sainan <!-- walkthrough_end --> <!-- internal state start --> <!-- FAHghAtBAEAqAWBLAztF0CGA7TBXALgPYQDmAplmQE4b5kAm0AxoQLasX4Bc0ADldEIAjAFZkm+RADcyqIQE9mhetQxChifADoMiaFAB8wY+CjHYmgDZkeAMzK0eARVyz8qAEzAAcrlZDqHgAOAHYg4ABVZEDoAHkqehQABSpEDmNDE0gYCkZCWzwiUgpVOkYWdk4efkFRcUkZOUUWFRp1TR09TNMYBHR0bELickoaMqVKrG5oGgB3aGQ/VgwqRQUlVrUNbV19CCMss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SWkzKAvHRCzoRQSQ7ruX2eZYjaoik+vOZlmwuRpQm9GtNvSCEHjVJvlZ9IFVbTKxhqq5cUgSFARVSxx2Mfka3mk6qFboc4daHBwhFUc2auoWKGwWaorDhsUcfRth2bGetEwrsLeLiIF4/Fm6r+EzsSPF4ENNqL4eFqQxgD7UTS34tFmchOpo1Pqkky8Qb2lGyiWMSYwaZWMZQXTTxzo1UXdMnEjiG8T09+C9MTHJjPpDIakci0NzVCXRPrFkehPEmYTQZ1o1ZODOjG+4IiDE13sSD1BVE3iGbUibI3InLxKJb9TgCY25FjJeRbkfkYaKt5BipYl0ZMfo0kkoo5J5AOoin32CHAcgBUU2gQGGBM0S8NZKYDwDmAs1TI6wFoKoHaA7AugPMnoBMBUz4B7ayAJMkuNVC5h6ASZR8lTEyCgBsg0Af0EEAcAeBWOGAH0LYCCAYB/Q72H0KxzIABBgwwYVjqxyEAhBT4/oIQLYHoCscmAQQH2UwH9DRgQgHgPYAcCVlSJNAasjWSgXBQMAky25QwEAA --> <!-- internal state end --> <!-- finishing_touch_checkbox_start --> <details> <summary>✨ Finishing Touches</summary> - [ ] <!-- {"checkboxId": "7962f53c-55bc-4827-bfbf-6a18da830691"} --> 📝 Generate Docstrings (Beta) </details> <!-- 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-31 14:04:18 -08:00
coderabbitai[bot] (Migrated from github.com) left a comment

Actionable comments posted: 8

🧹 Nitpick comments (3)
src/controllers/api/giveKeyChainTriggeredMessageController.ts (1)

17-26: Consider extracting message construction to a separate function.

The message construction logic could be moved to a dedicated function for better maintainability and reusability.

+const constructMessage = (keyChainMessage: ReturnType<typeof getKeyChainMessage>): IMessage => ({
+    sndr: keyChainMessage.sender,
+    msg: keyChainMessage.body,
+    sub: keyChainMessage.title,
+    att: keyChainMessage.attachments.length > 0 ? keyChainMessage.attachments : undefined,
+    icon: keyChainMessage.icon ?? "",
+    transmission: keyChainMessage.transmission ?? "",
+    highPriority: keyChainMessage.highPriority ?? false,
+    r: false
+});

-    const message = {
-        sndr: keyChainMessage.sender,
-        msg: keyChainMessage.body,
-        sub: keyChainMessage.title,
-        att: keyChainMessage.attachments.length > 0 ? keyChainMessage.attachments : undefined,
-        icon: keyChainMessage.icon ?? "",
-        transmission: keyChainMessage.transmission ?? "",
-        highPriority: keyChainMessage.highPriority ?? false,
-        r: false
-    } satisfies IMessage;
+    const message = constructMessage(keyChainMessage);
src/controllers/api/giveKeyChainTriggeredItemsController.ts (1)

34-38: Document the IKeyChainRequest interface.

Add JSDoc comments to describe the purpose and requirements of each property.

+/**
+ * Represents a request for key chain related operations
+ * @property {string} KeyChain - The identifier for the key chain
+ * @property {number} ChainStage - The current stage of the chain
+ * @property {IGroup[]} [Groups] - Optional groups associated with the request
+ */
 export interface IKeyChainRequest {
     KeyChain: string;
     ChainStage: number;
     Groups?: IGroup[];
 }
src/models/inboxModel.ts (1)

21-35: Add validation constraints to the schema.

Consider adding validation constraints to the schema to ensure data integrity.

 const messageSchema = new Schema<IMessageDatabase>(
     {
         ownerId: Schema.Types.ObjectId,
-        sndr: String,
+        sndr: { type: String, required: true },
-        msg: String,
+        msg: { type: String, required: true },
-        sub: String,
+        sub: { type: String, required: true },
         icon: String,
         highPriority: Boolean,
         lowPrioNewPlayers: Boolean,
-        startDate: Date,
+        startDate: { type: Date, validate: {
+            validator: function(v: Date) {
+                return !this.endDate || v < this.endDate;
+            },
+            message: 'Start date must be before end date'
+        }},
         endDate: Date,
         r: Boolean,
         att: { type: [String], default: undefined },
         countedAtt: { type: [typeCountSchema], default: undefined },
         transmission: String,
         arg: {
             type: [
                 {
                     Key: String,
                     Tag: String,
                     _id: false
                 }
             ],
             default: undefined
         }
     },
     { timestamps: { createdAt: "date", updatedAt: false }, id: false }
 );
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 01d369bf38 and 58ea23a0f8.

Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (10)
  • package.json (1 hunks)
  • src/controllers/api/giveKeyChainTriggeredItemsController.ts (2 hunks)
  • src/controllers/api/giveKeyChainTriggeredMessageController.ts (1 hunks)
  • src/controllers/api/updateQuestController.ts (2 hunks)
  • src/models/inboxModel.ts (1 hunks)
  • src/models/inventoryModels/inventoryModel.ts (1 hunks)
  • src/routes/api.ts (2 hunks)
  • src/services/inventoryService.ts (4 hunks)
  • src/services/itemDataService.ts (5 hunks)
  • src/services/questService.ts (2 hunks)
🧰 Additional context used
🪛 GitHub Check: build (22)
src/controllers/api/updateQuestController.ts

[failure] 7-7:
'addItem' is defined but never used


[failure] 7-7:
'combineInventoryChanges' is defined but never used

src/services/questService.ts

[failure] 53-53:
'questStage' is never reassigned. Use 'const' instead

src/services/itemDataService.ts

[failure] 36-36:
'IMessageDatabase' is defined but never used

🪛 GitHub Check: build (20)
src/controllers/api/updateQuestController.ts

[failure] 7-7:
'addItem' is defined but never used


[failure] 7-7:
'combineInventoryChanges' is defined but never used

src/services/questService.ts

[failure] 53-53:
'questStage' is never reassigned. Use 'const' instead

src/services/itemDataService.ts

[failure] 36-36:
'IMessageDatabase' is defined but never used

🪛 GitHub Check: build (18)
src/controllers/api/updateQuestController.ts

[failure] 7-7:
'addItem' is defined but never used


[failure] 7-7:
'combineInventoryChanges' is defined but never used

src/services/questService.ts

[failure] 53-53:
'questStage' is never reassigned. Use 'const' instead

src/services/itemDataService.ts

[failure] 36-36:
'IMessageDatabase' is defined but never used

🪛 ESLint
src/controllers/api/updateQuestController.ts

[error] 7-7: 'addItem' is defined but never used.

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


[error] 7-7: 'combineInventoryChanges' is defined but never used.

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

src/services/questService.ts

[error] 53-53: 'questStage' is never reassigned. Use 'const' instead.

(prefer-const)

src/services/itemDataService.ts

[error] 36-36: 'IMessageDatabase' is defined but never used.

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

🪛 GitHub Actions: Build
src/controllers/api/updateQuestController.ts

[error] 7-7: 'addItem' is defined but never used

🔇 Additional comments (7)
package.json (1)

19-19: Verify the package version update.

The version update of warframe-public-export-plus from ^0.5.24 to ^0.5.26 needs verification.

Let's verify the package version and check for any potential issues:

Verification successful

Package version update is valid and safe to use

The requested version 0.5.26 exists, is the latest version, and was published recently. The package has no dependencies, which reduces potential compatibility issues.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the package version, its dependencies, and check for any security advisories.

# Check if the version exists and get its details
echo "Checking package details..."
npm view warframe-public-export-plus@0.5.26

# Check for any known vulnerabilities
echo -e "\nChecking for vulnerabilities..."
npm audit warframe-public-export-plus@0.5.26

# Get the changelog or release notes (if available)
echo -e "\nChecking repository for changelog..."
gh api graphql -f query='
{
  repository(owner: "WFCD", name: "warframe-export-plus") {
    releases(last: 2) {
      nodes {
        name
        description
        tagName
        publishedAt
      }
    }
  }
}'

Length of output: 1868

src/services/itemDataService.ts (2)

158-160: LGTM! Error message improvement.

The error message now provides better context by specifying that the client requested items that did not exist.


201-220: LGTM! Well-structured message retrieval function.

The new getKeyChainMessage function follows good practices:

  • Proper error handling for missing chain stages
  • Clear error messages
  • Consistent with the pattern used in getKeyChainItems
src/routes/api.ts (1)

84-84: LGTM! Consistent route registration.

The new route for key chain triggered messages follows the established pattern:

  • Import controller at the top with other controllers
  • Register POST route with consistent naming convention

Also applies to: 140-140

src/models/inventoryModels/inventoryModel.ts (1)

460-468: LGTM! Optimized schema configuration.

Adding { _id: false } to the schema options prevents Mongoose from automatically adding unnecessary _id fields to quest progress documents, which improves efficiency.

src/services/inventoryService.ts (1)

479-479: LGTM! Enhanced type flexibility.

The function now accepts both string[] and ITypeCount[] inputs, with clean handling of both cases.

Also applies to: 482-488

src/controllers/api/updateQuestController.ts (1)

27-30: LGTM! Improved inventory update efficiency.

The changes improve efficiency by using a batch operation (addItems) instead of multiple individual addItem calls. The operations are properly sequenced with appropriate debug logging.

**Actionable comments posted: 8** <details> <summary>🧹 Nitpick comments (3)</summary><blockquote> <details> <summary>src/controllers/api/giveKeyChainTriggeredMessageController.ts (1)</summary><blockquote> `17-26`: **Consider extracting message construction to a separate function.** The message construction logic could be moved to a dedicated function for better maintainability and reusability. ```diff +const constructMessage = (keyChainMessage: ReturnType<typeof getKeyChainMessage>): IMessage => ({ + sndr: keyChainMessage.sender, + msg: keyChainMessage.body, + sub: keyChainMessage.title, + att: keyChainMessage.attachments.length > 0 ? keyChainMessage.attachments : undefined, + icon: keyChainMessage.icon ?? "", + transmission: keyChainMessage.transmission ?? "", + highPriority: keyChainMessage.highPriority ?? false, + r: false +}); - const message = { - sndr: keyChainMessage.sender, - msg: keyChainMessage.body, - sub: keyChainMessage.title, - att: keyChainMessage.attachments.length > 0 ? keyChainMessage.attachments : undefined, - icon: keyChainMessage.icon ?? "", - transmission: keyChainMessage.transmission ?? "", - highPriority: keyChainMessage.highPriority ?? false, - r: false - } satisfies IMessage; + const message = constructMessage(keyChainMessage); ``` </blockquote></details> <details> <summary>src/controllers/api/giveKeyChainTriggeredItemsController.ts (1)</summary><blockquote> `34-38`: **Document the IKeyChainRequest interface.** Add JSDoc comments to describe the purpose and requirements of each property. ```diff +/** + * Represents a request for key chain related operations + * @property {string} KeyChain - The identifier for the key chain + * @property {number} ChainStage - The current stage of the chain + * @property {IGroup[]} [Groups] - Optional groups associated with the request + */ export interface IKeyChainRequest { KeyChain: string; ChainStage: number; Groups?: IGroup[]; } ``` </blockquote></details> <details> <summary>src/models/inboxModel.ts (1)</summary><blockquote> `21-35`: **Add validation constraints to the schema.** Consider adding validation constraints to the schema to ensure data integrity. ```diff const messageSchema = new Schema<IMessageDatabase>( { ownerId: Schema.Types.ObjectId, - sndr: String, + sndr: { type: String, required: true }, - msg: String, + msg: { type: String, required: true }, - sub: String, + sub: { type: String, required: true }, icon: String, highPriority: Boolean, lowPrioNewPlayers: Boolean, - startDate: Date, + startDate: { type: Date, validate: { + validator: function(v: Date) { + return !this.endDate || v < this.endDate; + }, + message: 'Start date must be before end date' + }}, endDate: Date, r: Boolean, att: { type: [String], default: undefined }, countedAtt: { type: [typeCountSchema], default: undefined }, transmission: String, arg: { type: [ { Key: String, Tag: String, _id: false } ], default: undefined } }, { timestamps: { createdAt: "date", updatedAt: false }, id: false } ); ``` </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 01d369bf383d9ce15161f1b4fc1a01321aca39d8 and 58ea23a0f8a5103ebe4433b7dd5bfd3c8bfc5672. </details> <details> <summary>⛔ Files ignored due to path filters (1)</summary> * `package-lock.json` is excluded by `!**/package-lock.json` </details> <details> <summary>📒 Files selected for processing (10)</summary> * `package.json` (1 hunks) * `src/controllers/api/giveKeyChainTriggeredItemsController.ts` (2 hunks) * `src/controllers/api/giveKeyChainTriggeredMessageController.ts` (1 hunks) * `src/controllers/api/updateQuestController.ts` (2 hunks) * `src/models/inboxModel.ts` (1 hunks) * `src/models/inventoryModels/inventoryModel.ts` (1 hunks) * `src/routes/api.ts` (2 hunks) * `src/services/inventoryService.ts` (4 hunks) * `src/services/itemDataService.ts` (5 hunks) * `src/services/questService.ts` (2 hunks) </details> <details> <summary>🧰 Additional context used</summary> <details> <summary>🪛 GitHub Check: build (22)</summary> <details> <summary>src/controllers/api/updateQuestController.ts</summary> [failure] 7-7: 'addItem' is defined but never used --- [failure] 7-7: 'combineInventoryChanges' is defined but never used </details> <details> <summary>src/services/questService.ts</summary> [failure] 53-53: 'questStage' is never reassigned. Use 'const' instead </details> <details> <summary>src/services/itemDataService.ts</summary> [failure] 36-36: 'IMessageDatabase' is defined but never used </details> </details> <details> <summary>🪛 GitHub Check: build (20)</summary> <details> <summary>src/controllers/api/updateQuestController.ts</summary> [failure] 7-7: 'addItem' is defined but never used --- [failure] 7-7: 'combineInventoryChanges' is defined but never used </details> <details> <summary>src/services/questService.ts</summary> [failure] 53-53: 'questStage' is never reassigned. Use 'const' instead </details> <details> <summary>src/services/itemDataService.ts</summary> [failure] 36-36: 'IMessageDatabase' is defined but never used </details> </details> <details> <summary>🪛 GitHub Check: build (18)</summary> <details> <summary>src/controllers/api/updateQuestController.ts</summary> [failure] 7-7: 'addItem' is defined but never used --- [failure] 7-7: 'combineInventoryChanges' is defined but never used </details> <details> <summary>src/services/questService.ts</summary> [failure] 53-53: 'questStage' is never reassigned. Use 'const' instead </details> <details> <summary>src/services/itemDataService.ts</summary> [failure] 36-36: 'IMessageDatabase' is defined but never used </details> </details> <details> <summary>🪛 ESLint</summary> <details> <summary>src/controllers/api/updateQuestController.ts</summary> [error] 7-7: 'addItem' is defined but never used. (@typescript-eslint/no-unused-vars) --- [error] 7-7: 'combineInventoryChanges' is defined but never used. (@typescript-eslint/no-unused-vars) </details> <details> <summary>src/services/questService.ts</summary> [error] 53-53: 'questStage' is never reassigned. Use 'const' instead. (prefer-const) </details> <details> <summary>src/services/itemDataService.ts</summary> [error] 36-36: 'IMessageDatabase' is defined but never used. (@typescript-eslint/no-unused-vars) </details> </details> <details> <summary>🪛 GitHub Actions: Build</summary> <details> <summary>src/controllers/api/updateQuestController.ts</summary> [error] 7-7: 'addItem' is defined but never used </details> </details> </details> <details> <summary>🔇 Additional comments (7)</summary><blockquote> <details> <summary>package.json (1)</summary> `19-19`: **Verify the package version update.** The version update of `warframe-public-export-plus` from `^0.5.24` to `^0.5.26` needs verification. Let's verify the package version and check for any potential issues: <details> <summary>✅ Verification successful</summary> <!-- [monologue] [task verification_1/1] Verify the package version update and its implications. [observations] 1. Package details: - Version 0.5.26 exists and was published 23 hours ago - No dependencies listed - Package is proprietary - Maintained by sainansama - Latest version matches the requested version 2. Security audit: - Failed due to missing lockfile, but this is expected in sandbox 3. Changelog: - GitHub repository lookup failed, suggesting repository might be private - Repository name might have changed or be different [analysis] 1. Version verification: - ✅ Version 0.5.26 exists and is the latest version - ✅ Package is actively maintained (recent publish) - ✅ No dependencies means lower risk of conflicts 2. Security considerations: - Unable to verify security issues, but no dependencies reduces attack surface 3. Repository access: - Private/proprietary nature explains failed GitHub API call - Common for Warframe-related tools due to game data licensing [actions] - Generate final response marking this as verified - Version exists and is latest - Recent publish indicates active maintenance - No dependencies reduces risk - Private/proprietary nature explains limited public information --> **Package version update is valid and safe to use** ✅ The requested version `0.5.26` exists, is the latest version, and was published recently. The package has no dependencies, which reduces potential compatibility issues. </details> <details> <summary>🏁 Scripts executed</summary> The following scripts were executed for the analysis: Script: ```shell #!/bin/bash # Description: Verify the package version, its dependencies, and check for any security advisories. # Check if the version exists and get its details echo "Checking package details..." npm view warframe-public-export-plus@0.5.26 # Check for any known vulnerabilities echo -e "\nChecking for vulnerabilities..." npm audit warframe-public-export-plus@0.5.26 # Get the changelog or release notes (if available) echo -e "\nChecking repository for changelog..." gh api graphql -f query=' { repository(owner: "WFCD", name: "warframe-export-plus") { releases(last: 2) { nodes { name description tagName publishedAt } } } }' ``` Length of output: 1868 </details> </details> <details> <summary>src/services/itemDataService.ts (2)</summary> `158-160`: **LGTM! Error message improvement.** The error message now provides better context by specifying that the client requested items that did not exist. --- `201-220`: **LGTM! Well-structured message retrieval function.** The new `getKeyChainMessage` function follows good practices: - Proper error handling for missing chain stages - Clear error messages - Consistent with the pattern used in `getKeyChainItems` </details> <details> <summary>src/routes/api.ts (1)</summary> `84-84`: **LGTM! Consistent route registration.** The new route for key chain triggered messages follows the established pattern: - Import controller at the top with other controllers - Register POST route with consistent naming convention Also applies to: 140-140 </details> <details> <summary>src/models/inventoryModels/inventoryModel.ts (1)</summary> `460-468`: **LGTM! Optimized schema configuration.** Adding `{ _id: false }` to the schema options prevents Mongoose from automatically adding unnecessary `_id` fields to quest progress documents, which improves efficiency. </details> <details> <summary>src/services/inventoryService.ts (1)</summary> `479-479`: **LGTM! Enhanced type flexibility.** The function now accepts both `string[]` and `ITypeCount[]` inputs, with clean handling of both cases. Also applies to: 482-488 </details> <details> <summary>src/controllers/api/updateQuestController.ts (1)</summary> `27-30`: **LGTM! Improved inventory update efficiency.** The changes improve efficiency by using a batch operation (`addItems`) instead of multiple individual `addItem` calls. The operations are properly sequenced with appropriate debug logging. </details> </blockquote></details> </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
coderabbitai[bot] (Migrated from github.com) commented 2025-01-31 14:04:17 -08:00

⚠️ Potential issue

Add validation for keyChainInfo properties.

The keyChainInfo object should be validated before use to ensure required properties exist.

     const keyChainInfo = getJSONfromString<IKeyChainRequest>((req.body as string).toString());
+    if (!keyChainInfo?.KeyChain || typeof keyChainInfo.ChainStage !== 'number') {
+        throw new Error('Invalid keyChainInfo: missing required properties');
+    }
📝 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.

    const keyChainInfo = getJSONfromString<IKeyChainRequest>((req.body as string).toString());
    if (!keyChainInfo?.KeyChain || typeof keyChainInfo.ChainStage !== 'number') {
        throw new Error('Invalid keyChainInfo: missing required properties');
    }

    const inventory = await getInventory(accountId);
    const inventoryChanges = await addKeyChainItems(inventory, keyChainInfo);

    if (isEmptyObject(inventoryChanges)) {
        throw new Error("inventory changes was empty after getting keychain items: should not happen");
    }
    // items were added: update quest stage's i (item was given)
    updateQuestStage(inventory, keyChainInfo, { i: true });
_:warning: Potential issue_ **Add validation for keyChainInfo properties.** The keyChainInfo object should be validated before use to ensure required properties exist. ```diff const keyChainInfo = getJSONfromString<IKeyChainRequest>((req.body as string).toString()); + if (!keyChainInfo?.KeyChain || typeof keyChainInfo.ChainStage !== 'number') { + throw new Error('Invalid keyChainInfo: missing required properties'); + } ``` <!-- suggestion_start --> <details> <summary>📝 Committable suggestion</summary> > ‼️ **IMPORTANT** > Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements. `````suggestion const keyChainInfo = getJSONfromString<IKeyChainRequest>((req.body as string).toString()); if (!keyChainInfo?.KeyChain || typeof keyChainInfo.ChainStage !== 'number') { throw new Error('Invalid keyChainInfo: missing required properties'); } const inventory = await getInventory(accountId); const inventoryChanges = await addKeyChainItems(inventory, keyChainInfo); if (isEmptyObject(inventoryChanges)) { throw new Error("inventory changes was empty after getting keychain items: should not happen"); } // items were added: update quest stage's i (item was given) updateQuestStage(inventory, keyChainInfo, { i: true }); ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->
OrdisPrime marked this conversation as resolved
@ -0,0 +11,4 @@
const accountId = await getAccountIdForRequest(req);
const keyChainInfo = JSON.parse((req.body as Buffer).toString()) as IKeyChainRequest;
console.log(keyChainInfo);
coderabbitai[bot] (Migrated from github.com) commented 2025-01-31 14:04:16 -08:00

⚠️ Potential issue

Add error handling for JSON parsing.

The JSON parsing of the request body should be wrapped in a try-catch block to handle malformed JSON gracefully.

-    const keyChainInfo = JSON.parse((req.body as Buffer).toString()) as IKeyChainRequest;
+    let keyChainInfo: IKeyChainRequest;
+    try {
+        keyChainInfo = JSON.parse((req.body as Buffer).toString()) as IKeyChainRequest;
+    } catch (error) {
+        throw new Error('Invalid JSON in request body');
+    }
📝 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 giveKeyChainTriggeredMessageController: RequestHandler = async (req, res) => {
    const accountId = await getAccountIdForRequest(req);
    let keyChainInfo: IKeyChainRequest;
    try {
        keyChainInfo = JSON.parse((req.body as Buffer).toString()) as IKeyChainRequest;
    } catch (error) {
        throw new Error('Invalid JSON in request body');
    }
    console.log(keyChainInfo);

_:warning: Potential issue_ **Add error handling for JSON parsing.** The JSON parsing of the request body should be wrapped in a try-catch block to handle malformed JSON gracefully. ```diff - const keyChainInfo = JSON.parse((req.body as Buffer).toString()) as IKeyChainRequest; + let keyChainInfo: IKeyChainRequest; + try { + keyChainInfo = JSON.parse((req.body as Buffer).toString()) as IKeyChainRequest; + } catch (error) { + throw new Error('Invalid JSON in request body'); + } ``` <!-- 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 giveKeyChainTriggeredMessageController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); let keyChainInfo: IKeyChainRequest; try { keyChainInfo = JSON.parse((req.body as Buffer).toString()) as IKeyChainRequest; } catch (error) { throw new Error('Invalid JSON in request body'); } console.log(keyChainInfo); ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->
OrdisPrime marked this conversation as resolved
@ -0,0 +31,4 @@
const inventory = await getInventory(accountId, "QuestKeys");
updateQuestStage(inventory, keyChainInfo, { m: true });
await inventory.save();
coderabbitai[bot] (Migrated from github.com) commented 2025-01-31 14:04:16 -08:00

⚠️ Potential issue

Add error handling for database operations.

The database operations should be wrapped in a try-catch block to handle potential failures gracefully.

+    try {
         const savedMessages = await createMessage(accountId, [message]);
         console.log("savedMessages", savedMessages);

         const inventory = await getInventory(accountId, "QuestKeys");
         updateQuestStage(inventory, keyChainInfo, { m: true });
         await inventory.save();
+    } catch (error) {
+        console.error('Failed to process message:', error);
+        throw new Error('Failed to process message');
+    }
📝 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.

    try {
        const savedMessages = await createMessage(accountId, [message]);
        console.log("savedMessages", savedMessages);

        const inventory = await getInventory(accountId, "QuestKeys");
        updateQuestStage(inventory, keyChainInfo, { m: true });
        await inventory.save();
    } catch (error) {
        console.error('Failed to process message:', error);
        throw new Error('Failed to process message');
    }
_:warning: Potential issue_ **Add error handling for database operations.** The database operations should be wrapped in a try-catch block to handle potential failures gracefully. ```diff + try { const savedMessages = await createMessage(accountId, [message]); console.log("savedMessages", savedMessages); const inventory = await getInventory(accountId, "QuestKeys"); updateQuestStage(inventory, keyChainInfo, { m: true }); await inventory.save(); + } catch (error) { + console.error('Failed to process message:', error); + throw new Error('Failed to process message'); + } ``` <!-- 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 try { const savedMessages = await createMessage(accountId, [message]); console.log("savedMessages", savedMessages); const inventory = await getInventory(accountId, "QuestKeys"); updateQuestStage(inventory, keyChainInfo, { m: true }); await inventory.save(); } catch (error) { console.error('Failed to process message:', error); throw new Error('Failed to process message'); } ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->
OrdisPrime marked this conversation as resolved
@ -6,3 +6,3 @@
import { getQuestCompletionItems } from "@/src/services/itemDataService";
import { addItem, combineInventoryChanges, getInventory } from "@/src/services/inventoryService";
import { addItem, addItems, combineInventoryChanges, getInventory } from "@/src/services/inventoryService";
coderabbitai[bot] (Migrated from github.com) commented 2025-01-31 14:04:17 -08:00

⚠️ Potential issue

Remove unused imports.

The imports addItem and combineInventoryChanges are no longer used in the code. This is causing build failures.

Apply this diff to fix the build:

-import { addItem, addItems, combineInventoryChanges, getInventory } from "@/src/services/inventoryService";
+import { addItems, getInventory } from "@/src/services/inventoryService";
📝 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.

import { addItems, getInventory } from "@/src/services/inventoryService";
🧰 Tools
🪛 GitHub Check: build (22)

[failure] 7-7:
'addItem' is defined but never used


[failure] 7-7:
'combineInventoryChanges' is defined but never used

🪛 GitHub Check: build (20)

[failure] 7-7:
'addItem' is defined but never used


[failure] 7-7:
'combineInventoryChanges' is defined but never used

🪛 GitHub Check: build (18)

[failure] 7-7:
'addItem' is defined but never used


[failure] 7-7:
'combineInventoryChanges' is defined but never used

🪛 ESLint

[error] 7-7: 'addItem' is defined but never used.

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


[error] 7-7: 'combineInventoryChanges' is defined but never used.

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

🪛 GitHub Actions: Build

[error] 7-7: 'addItem' is defined but never used

_:warning: Potential issue_ **Remove unused imports.** The imports `addItem` and `combineInventoryChanges` are no longer used in the code. This is causing build failures. Apply this diff to fix the build: ```diff -import { addItem, addItems, combineInventoryChanges, getInventory } from "@/src/services/inventoryService"; +import { addItems, getInventory } from "@/src/services/inventoryService"; ``` <!-- 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 import { addItems, getInventory } from "@/src/services/inventoryService"; ````` </details> <!-- suggestion_end --> <details> <summary>🧰 Tools</summary> <details> <summary>🪛 GitHub Check: build (22)</summary> [failure] 7-7: 'addItem' is defined but never used --- [failure] 7-7: 'combineInventoryChanges' is defined but never used </details> <details> <summary>🪛 GitHub Check: build (20)</summary> [failure] 7-7: 'addItem' is defined but never used --- [failure] 7-7: 'combineInventoryChanges' is defined but never used </details> <details> <summary>🪛 GitHub Check: build (18)</summary> [failure] 7-7: 'addItem' is defined but never used --- [failure] 7-7: 'combineInventoryChanges' is defined but never used </details> <details> <summary>🪛 ESLint</summary> [error] 7-7: 'addItem' is defined but never used. (@typescript-eslint/no-unused-vars) --- [error] 7-7: 'combineInventoryChanges' is defined but never used. (@typescript-eslint/no-unused-vars) </details> <details> <summary>🪛 GitHub Actions: Build</summary> [error] 7-7: 'addItem' is defined but never used </details> </details> <!-- This is an auto-generated comment by CodeRabbit -->
OrdisPrime marked this conversation as resolved
coderabbitai[bot] (Migrated from github.com) commented 2025-01-31 14:04:17 -08:00

⚠️ Potential issue

Remove duplicate item addition.

The addKeyChainItems function is adding items twice:

  1. Through the loop using addItem
  2. Through the new addItems call

Apply this diff to remove the duplicate operation:

-    await addItems(inventory, nonStoreItems);
_:warning: Potential issue_ **Remove duplicate item addition.** The `addKeyChainItems` function is adding items twice: 1. Through the loop using `addItem` 2. Through the new `addItems` call Apply this diff to remove the duplicate operation: ```diff - await addItems(inventory, nonStoreItems); ``` <!-- This is an auto-generated comment by CodeRabbit -->
OrdisPrime marked this conversation as resolved
coderabbitai[bot] (Migrated from github.com) commented 2025-01-31 14:04:17 -08:00

⚠️ Potential issue

Remove unused import.

The IMessageDatabase import is not used in this file.

Apply this diff to remove the unused import:

-import { IMessageDatabase } from "@/src/models/inboxModel";
🧰 Tools
🪛 GitHub Check: build (22)

[failure] 36-36:
'IMessageDatabase' is defined but never used

🪛 GitHub Check: build (20)

[failure] 36-36:
'IMessageDatabase' is defined but never used

🪛 GitHub Check: build (18)

[failure] 36-36:
'IMessageDatabase' is defined but never used

🪛 ESLint

[error] 36-36: 'IMessageDatabase' is defined but never used.

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

_:warning: Potential issue_ **Remove unused import.** The `IMessageDatabase` import is not used in this file. Apply this diff to remove the unused import: ```diff -import { IMessageDatabase } from "@/src/models/inboxModel"; ``` <details> <summary>🧰 Tools</summary> <details> <summary>🪛 GitHub Check: build (22)</summary> [failure] 36-36: 'IMessageDatabase' is defined but never used </details> <details> <summary>🪛 GitHub Check: build (20)</summary> [failure] 36-36: 'IMessageDatabase' is defined but never used </details> <details> <summary>🪛 GitHub Check: build (18)</summary> [failure] 36-36: 'IMessageDatabase' is defined but never used </details> <details> <summary>🪛 ESLint</summary> [error] 36-36: 'IMessageDatabase' is defined but never used. (@typescript-eslint/no-unused-vars) </details> </details> <!-- This is an auto-generated comment by CodeRabbit -->
OrdisPrime marked this conversation as resolved
coderabbitai[bot] (Migrated from github.com) commented 2025-01-31 14:04:17 -08:00

⚠️ Potential issue

Use const for questStage variable.

The variable is never reassigned, so it should use const instead of let.

-    let questStage = quest.Progress[ChainStage];
+    const questStage = quest.Progress[ChainStage];
📝 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.

    const questStage = quest.Progress[ChainStage];
    console.log("questStage", questStage);

🧰 Tools
🪛 GitHub Check: build (22)

[failure] 53-53:
'questStage' is never reassigned. Use 'const' instead

🪛 GitHub Check: build (20)

[failure] 53-53:
'questStage' is never reassigned. Use 'const' instead

🪛 GitHub Check: build (18)

[failure] 53-53:
'questStage' is never reassigned. Use 'const' instead

🪛 ESLint

[error] 53-53: 'questStage' is never reassigned. Use 'const' instead.

(prefer-const)

_:warning: Potential issue_ **Use const for questStage variable.** The variable is never reassigned, so it should use const instead of let. ```diff - let questStage = quest.Progress[ChainStage]; + const questStage = quest.Progress[ChainStage]; ``` <!-- suggestion_start --> <details> <summary>📝 Committable suggestion</summary> > ‼️ **IMPORTANT** > Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements. `````suggestion const questStage = quest.Progress[ChainStage]; console.log("questStage", questStage); ````` </details> <!-- suggestion_end --> <details> <summary>🧰 Tools</summary> <details> <summary>🪛 GitHub Check: build (22)</summary> [failure] 53-53: 'questStage' is never reassigned. Use 'const' instead </details> <details> <summary>🪛 GitHub Check: build (20)</summary> [failure] 53-53: 'questStage' is never reassigned. Use 'const' instead </details> <details> <summary>🪛 GitHub Check: build (18)</summary> [failure] 53-53: 'questStage' is never reassigned. Use 'const' instead </details> <details> <summary>🪛 ESLint</summary> [error] 53-53: 'questStage' is never reassigned. Use 'const' instead. (prefer-const) </details> </details> <!-- This is an auto-generated comment by CodeRabbit -->
OrdisPrime marked this conversation as resolved
coderabbitai[bot] (Migrated from github.com) commented 2025-01-31 14:04:17 -08:00

🛠️ Refactor suggestion

Add input validation and improve error messages.

The function should validate input parameters and provide more descriptive error messages.

 export const updateQuestStage = (
     inventory: TInventoryDatabaseDocument,
     { KeyChain, ChainStage }: IKeyChainRequest,
     questStageUpdate: IQuestStage
 ): void => {
+    if (!inventory || !KeyChain || ChainStage < 0 || !questStageUpdate) {
+        throw new Error('Invalid input parameters for updateQuestStage');
+    }
+
     const quest = inventory.QuestKeys.find(quest => quest.ItemType === KeyChain);

     if (!quest) {
-        throw new Error(`Quest ${KeyChain} not found in QuestKeys`);
+        throw new Error(`Quest with ItemType "${KeyChain}" not found in QuestKeys`);
     }
📝 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 updateQuestStage = (
    inventory: TInventoryDatabaseDocument,
    { KeyChain, ChainStage }: IKeyChainRequest,
    questStageUpdate: IQuestStage
): void => {
    if (!inventory || !KeyChain || ChainStage < 0 || !questStageUpdate) {
        throw new Error('Invalid input parameters for updateQuestStage');
    }

    const quest = inventory.QuestKeys.find(quest => quest.ItemType === KeyChain);

    if (!quest) {
        throw new Error(`Quest with ItemType "${KeyChain}" not found in QuestKeys`);
    }

    if (!quest.Progress) {
        throw new Error(`Progress should always exist when giving keychain triggered items or messages`);
    }

    let questStage = quest.Progress[ChainStage];
    console.log("questStage", questStage);

    if (!questStage) {
        const questStageIndex = quest.Progress.push(questStageUpdate) - 1;
        if (questStageIndex !== ChainStage) {
            throw new Error(`Quest stage index mismatch: ${questStageIndex} !== ${ChainStage}`);
        }
        return;
    }

    Object.assign(questStage, questStageUpdate);
};
🧰 Tools
🪛 GitHub Check: build (22)

[failure] 53-53:
'questStage' is never reassigned. Use 'const' instead

🪛 GitHub Check: build (20)

[failure] 53-53:
'questStage' is never reassigned. Use 'const' instead

🪛 GitHub Check: build (18)

[failure] 53-53:
'questStage' is never reassigned. Use 'const' instead

🪛 ESLint

[error] 53-53: 'questStage' is never reassigned. Use 'const' instead.

(prefer-const)

_:hammer_and_wrench: Refactor suggestion_ **Add input validation and improve error messages.** The function should validate input parameters and provide more descriptive error messages. ```diff export const updateQuestStage = ( inventory: TInventoryDatabaseDocument, { KeyChain, ChainStage }: IKeyChainRequest, questStageUpdate: IQuestStage ): void => { + if (!inventory || !KeyChain || ChainStage < 0 || !questStageUpdate) { + throw new Error('Invalid input parameters for updateQuestStage'); + } + const quest = inventory.QuestKeys.find(quest => quest.ItemType === KeyChain); if (!quest) { - throw new Error(`Quest ${KeyChain} not found in QuestKeys`); + throw new Error(`Quest with ItemType "${KeyChain}" not found in QuestKeys`); } ``` <!-- 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 updateQuestStage = ( inventory: TInventoryDatabaseDocument, { KeyChain, ChainStage }: IKeyChainRequest, questStageUpdate: IQuestStage ): void => { if (!inventory || !KeyChain || ChainStage < 0 || !questStageUpdate) { throw new Error('Invalid input parameters for updateQuestStage'); } const quest = inventory.QuestKeys.find(quest => quest.ItemType === KeyChain); if (!quest) { throw new Error(`Quest with ItemType "${KeyChain}" not found in QuestKeys`); } if (!quest.Progress) { throw new Error(`Progress should always exist when giving keychain triggered items or messages`); } let questStage = quest.Progress[ChainStage]; console.log("questStage", questStage); if (!questStage) { const questStageIndex = quest.Progress.push(questStageUpdate) - 1; if (questStageIndex !== ChainStage) { throw new Error(`Quest stage index mismatch: ${questStageIndex} !== ${ChainStage}`); } return; } Object.assign(questStage, questStageUpdate); }; ````` </details> <!-- suggestion_end --> <details> <summary>🧰 Tools</summary> <details> <summary>🪛 GitHub Check: build (22)</summary> [failure] 53-53: 'questStage' is never reassigned. Use 'const' instead </details> <details> <summary>🪛 GitHub Check: build (20)</summary> [failure] 53-53: 'questStage' is never reassigned. Use 'const' instead </details> <details> <summary>🪛 GitHub Check: build (18)</summary> [failure] 53-53: 'questStage' is never reassigned. Use 'const' instead </details> <details> <summary>🪛 ESLint</summary> [error] 53-53: 'questStage' is never reassigned. Use 'const' instead. (prefer-const) </details> </details> <!-- This is an auto-generated comment by CodeRabbit -->
OrdisPrime marked this conversation as resolved
OrdisPrime force-pushed Quests2 from 1ba870da3f to ef9dab75f9 2025-02-01 05:23:24 -08:00 Compare
OrdisPrime added 1 commit 2025-02-01 05:25:41 -08:00
fix build
All checks were successful
Build / build (18) (push) Successful in 44s
Build / build (20) (push) Successful in 48s
Build / build (22) (push) Successful in 1m5s
Build / build (20) (pull_request) Successful in 1m18s
Build / build (18) (pull_request) Successful in 1m22s
Build / build (22) (pull_request) Successful in 52s
6f8cf74add
OrdisPrime added 1 commit 2025-02-01 06:34:00 -08:00
add giveQuestKey
All checks were successful
Build / build (22) (push) Successful in 1m22s
Build / build (20) (push) Successful in 1m23s
Build / build (18) (pull_request) Successful in 1m26s
Build / build (22) (pull_request) Successful in 52s
Build / build (20) (pull_request) Successful in 54s
Build / build (18) (push) Successful in 35s
af6a466948
OrdisPrime added 1 commit 2025-02-01 07:19:01 -08:00
fix some stuff
All checks were successful
Build / build (18) (push) Successful in 35s
Build / build (20) (push) Successful in 49s
Build / build (18) (pull_request) Successful in 36s
Build / build (20) (pull_request) Successful in 51s
Build / build (22) (pull_request) Successful in 26s
Build / build (22) (push) Successful in 27s
49b702df2e
OrdisPrime merged commit 8d66ba42b7 into main 2025-02-01 07:26:02 -08:00
Sainan referenced this issue from a commit 2025-02-01 07:31:11 -08:00
Sign in to join this conversation.
No description provided.