Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add media wiki platform and hivemind support #169

Merged
merged 6 commits into from
May 14, 2024

Conversation

Behzad-rabiei
Copy link
Member

@Behzad-rabiei Behzad-rabiei commented May 14, 2024

Summary by CodeRabbit

  • New Features

    • Introduced enums for platform names, module names, hivemind platform names, and token type names for better type safety and consistency.
  • Bug Fixes

    • Replaced hardcoded strings with enum values across various models, interfaces, and schemas to prevent errors and improve maintainability.
  • Chores

    • Updated the application version to 3.0.60 in package.json.

Copy link

coderabbitai bot commented May 14, 2024

Walkthrough

The changes involve transitioning from hardcoded string literals to enum values across various test files, interfaces, and schemas. This ensures improved type safety and consistency in the codebase. Enum values from the src/config/enums.ts file are now used for name and type properties, enhancing the maintainability of the code. Additionally, the version number in package.json has been updated to reflect these modifications.

Changes

Files Change Summaries
__tests__/unit/models/module.model.test.ts, __tests__/unit/models/platform.model.test.ts Replaced name properties with enum values from ModuleNames and PlatformNames.
__tests__/unit/models/token.model.test.ts Updated type property to use TokenTypeNames enum for improved type safety.
package.json Version incremented from 3.0.55 to 3.0.60.
src/config/enums.ts Introduced enums for platform names, module names, hivemind platform names, and token type names.
src/index.ts Added export statement for enums from src/config/enums.ts.
src/interfaces/Module.interface.ts, src/interfaces/Platfrom.interface.ts, src/interfaces/Token.interface.ts Replaced hardcoded strings with enum types for name and type fields.
src/models/schemas/Module.schema.ts, src/models/schemas/Platform.schema.ts, src/models/schemas/Token.schema.ts Updated enum values usage in schemas for name and type fields.

🐇 In the land of code, enums now reign,
Strings replaced, consistency gain.
Platforms, modules, tokens too,
Type-safe paths for me and you.
Version bumped, the changes flow,
Hopping forward, off we go! 🚀


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 0e9e11b and 374882b.
Files selected for processing (12)
  • tests/unit/models/module.model.test.ts (3 hunks)
  • tests/unit/models/platform.model.test.ts (2 hunks)
  • tests/unit/models/token.model.test.ts (3 hunks)
  • package.json (1 hunks)
  • src/config/enums.ts (1 hunks)
  • src/index.ts (1 hunks)
  • src/interfaces/Module.interface.ts (2 hunks)
  • src/interfaces/Platfrom.interface.ts (1 hunks)
  • src/interfaces/Token.interface.ts (1 hunks)
  • src/models/schemas/Module.schema.ts (2 hunks)
  • src/models/schemas/Platform.schema.ts (1 hunks)
  • src/models/schemas/Token.schema.ts (2 hunks)
Files skipped from review due to trivial changes (2)
  • package.json
  • src/index.ts
Additional comments not posted (27)
src/interfaces/Token.interface.ts (2)

2-2: The import statement correctly imports TokenTypeNames from the enums file.


7-7: The type property in the IToken interface is updated to use TokenTypeNames, enhancing type safety.

src/interfaces/Platfrom.interface.ts (3)

2-2: The import statement correctly imports PlatformNames from the enums file.


5-5: The name property in the IPlatform interface is updated to use PlatformNames, enhancing type safety.


13-13: The name property in the IPlatformUpdateBody interface is updated to use PlatformNames, enhancing type safety.

src/models/schemas/Token.schema.ts (2)

4-4: The import statement correctly imports TokenTypeNames from the enums file.


20-20: The type field in the schema is updated to use Object.values(TokenTypeNames), enhancing type safety.

src/interfaces/Module.interface.ts (4)

2-2: The import statement correctly imports ModuleNames and PlatformNames from the enums file.


5-5: The name property in the IModule interface is updated to use ModuleNames, enhancing type safety.


10-10: The name property in the options.platforms array is updated to use PlatformNames, enhancing type safety.


19-19: The name property in the options.platforms array in the IModuleUpdateBody interface is updated to use PlatformNames, enhancing type safety.

src/config/enums.ts (3)

1-8: The PlatformNames enum is defined correctly, providing a clear and type-safe way to handle platform names.


10-12: The ModuleNames enum is defined correctly, providing a clear and type-safe way to handle module names.


22-32: The TokenTypeNames enum is defined correctly, providing a clear and type-safe way to handle token types.

__tests__/unit/models/module.model.test.ts (3)

4-4: The import statement correctly imports ModuleNames and PlatformNames from the enums file.


15-15: The name property in the test case is updated to use ModuleNames.Hivemind, enhancing type safety.


24-24: The name property in the options.platforms array in the test case is updated to use PlatformNames.Discord, enhancing type safety.

src/models/schemas/Module.schema.ts (3)

4-4: The import statement correctly imports ModuleNames and PlatformNames from the enums file.


11-11: The name field in the schema is updated to use Object.values(ModuleNames), enhancing type safety.


32-32: The name field in the options.platforms array in the schema is updated to use Object.values(PlatformNames), enhancing type safety.

__tests__/unit/models/token.model.test.ts (3)

5-5: The import statement correctly imports TokenTypeNames from the enums file.


14-14: The type property in the test case is updated to use TokenTypeNames.GOOGLE_REFRESH, enhancing type safety.


24-30: The test case correctly validates an invalid token type, ensuring robustness.

src/models/schemas/Platform.schema.ts (2)

5-5: Import statement looks good.


12-12: Using Object.values(PlatformNames) for the name field enum improves type safety and consistency.

__tests__/unit/models/platform.model.test.ts (2)

4-4: Import statement looks good.


14-14: Using PlatformNames.Google for the name property in the test setup improves type safety and consistency.

Comment on lines 14 to 20
export enum HivemindPlatforNames {
Discord = 'discord',
Google = 'google',
GitHub = 'github',
Notion = 'notion',
MediaWiki = 'mediaWiki',
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a typo in the enum name HivemindPlatforNames. It should be HivemindPlatformNames.

- export enum HivemindPlatforNames {
+ export enum HivemindPlatformNames {

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.

Suggested change
export enum HivemindPlatforNames {
Discord = 'discord',
Google = 'google',
GitHub = 'github',
Notion = 'notion',
MediaWiki = 'mediaWiki',
}
export enum HivemindPlatformNames {
Discord = 'discord',
Google = 'google',
GitHub = 'github',
Notion = 'notion',
MediaWiki = 'mediaWiki',
}

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 374882b and 72792f0.
Files selected for processing (1)
  • src/config/enums.ts (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • src/config/enums.ts

@cyri113 cyri113 merged commit f0c6f3d into main May 14, 2024
11 checks passed
@Behzad-rabiei Behzad-rabiei deleted the add-mediaWiki-platform-and-hivemind-support branch September 6, 2024 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants