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

feat: marketing mutation + query #331

Merged
merged 1 commit into from
Mar 6, 2024

Conversation

cgilbe27
Copy link
Contributor

@cgilbe27 cgilbe27 commented Mar 6, 2024

Adds accountLinksInfo mutation and query

Summary by CodeRabbit

  • New Features

    • Added support for linking accounts in marketing mutations, including Twitter and Discord.
    • Introduced new fields for account linking information and last updated timestamp in marketing queries.
  • Refactor

    • Updated types and arguments in marketing mutations and queries for clarity and efficiency.
    • Enhanced code readability by adjusting function parameters and fixing formatting in utility files.
  • Tests

    • Expanded test coverage to include new fields and functionalities related to account linking in marketing mutations and queries.

@cgilbe27 cgilbe27 requested a review from CalicoNino March 6, 2024 15:20
@cgilbe27 cgilbe27 self-assigned this Mar 6, 2024
Copy link
Contributor

coderabbitai bot commented Mar 6, 2024

Walkthrough

The recent updates focus on refining the GraphQL schema and functions related to marketing mutations and queries within a heart-monitoring application. Key changes include renaming types for clarity, adding new fields to support account linking, and improving test and utility functions for better consistency and readability. These modifications aim to enhance the application's ability to handle marketing-related data more efficiently and with greater flexibility.

Changes

Files Summary
.../heart-monitor/heart-monitor.test.ts
.../heart-monitor/heart-monitor.ts
Renamed types for clarity and updated functions to support new fields related to account linking.
.../mutation/marketing.ts
.../query/marketing.ts
Introduced new types and fields to handle account linking and updated mutation and query functions accordingly.
.../utils/consts.ts
.../utils/defaultObjects.ts
Adjusted function parameters and formatting; added defaultAccountLinksInfo.

🐰✨
In the garden of code, under the moon's soft glow,
Changes bloom, as fresh as the driven snow.
Renaming, linking, a dance of files and fields,
A rabbit hops through, its mission never yields.
With every leap, improvements take flight,
Crafting a future, oh so bright.
🌟🐾

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-tests 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 tests 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 tests.
    • @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.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

Copy link
Contributor

@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.

Review Status

Actionable comments generated: 2

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 26176e3 and 33cae43.
Files selected for processing (6)
  • src/gql/heart-monitor/heart-monitor.test.ts (5 hunks)
  • src/gql/heart-monitor/heart-monitor.ts (3 hunks)
  • src/gql/mutation/marketing.ts (2 hunks)
  • src/gql/query/marketing.ts (5 hunks)
  • src/gql/utils/consts.ts (5 hunks)
  • src/gql/utils/defaultObjects.ts (3 hunks)
Files skipped from review due to trivial changes (1)
  • src/gql/utils/consts.ts
Additional comments: 15
src/gql/mutation/marketing.ts (5)
  • 10-12: The addition of GQLMarketingMutationGqlLinkAccountsArgs, GQLAccountLinksInfo, and defaultAccountLinksInfo is aligned with the PR objectives to enhance account linking functionalities. Ensure that these types are thoroughly documented to facilitate future development and maintenance.
  • 15-18: The QueryMarketingMutationArgs type has been updated to include linkAccounts. This change is crucial for supporting the new account linking functionality. It's important to verify that all usages of this type across the codebase have been updated to reflect this change.
  • 24-27: The introduction of GQLMarketingMutationFields with linkAccounts field is a good practice for encapsulating the fields related to marketing mutations. This approach enhances modularity and maintainability of the code.
  • 34-82: The marketingMutationString function has been updated to handle linkAccounts and default objects. This change is consistent with the PR's objectives. However, ensure that the handling of default objects is consistent and that there are no edge cases where the default values might lead to unexpected behavior.
  • 97-100: The marketingMutation async function correctly utilizes the updated marketingMutationString to perform GraphQL mutations. It's important to ensure that the error handling mechanism is robust, especially for external calls like doGqlQuery, to gracefully handle any failures.
src/gql/query/marketing.ts (4)
  • 4-12: The addition of defaultAccountLinksInfo and GQLAccountLinksInfo types, along with the query argument type GQLMarketingQueryGqlAccountLinksInfoArgs, is crucial for supporting the new accountLinksInfo query functionality. Ensure these types are well-documented for clarity and maintainability.
  • 29-29: The update to QueryMarketingArgs to include accountLinksInfo is necessary for the new account linking query functionality. Verify that all usages of this type have been updated accordingly across the codebase.
Verification successful

To further verify the update's integration, we need to inspect the specific files mentioned for references to accountLinksInfo or indications that the update to QueryMarketingArgs has been properly integrated. This involves checking for the usage or acknowledgment of the new field in the context of the files where QueryMarketingArgs is used.


The verification process has revealed that accountLinksInfo is referenced in heart-monitor.test.ts, indicating that the update to QueryMarketingArgs to include accountLinksInfo for the new account linking query functionality has been acknowledged and utilized in the test cases. Although there's no direct evidence from heart-monitor.ts in the provided output, the integration in the test file suggests that necessary updates have likely been made where required. Therefore, it seems that all usages of this type have been updated accordingly across the codebase where necessary.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Search for files that might use QueryMarketingArgs. Expecting list of dependent files.
rg --type ts "QueryMarketingArgs"

Length of output: 542



Script:

#!/bin/bash
# Inspect heart-monitor.ts, heart-monitor.test.ts for references to accountLinksInfo
rg --type ts "accountLinksInfo" src/gql/heart-monitor/heart-monitor.ts src/gql/heart-monitor/heart-monitor.test.ts

Length of output: 510

* 41-42: The inclusion of `accountLinksInfo` and `lastUpdatedTimestamp` in `MarketingFields` type is a good practice for encapsulating the fields related to marketing queries. This enhances the code's modularity and maintainability. * 149-170: > 📝 **NOTE** > This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [95-166]

The marketingQueryString function has been updated to handle the accountLinksInfo query and the lastUpdatedTimestamp field. This change aligns with the PR's objectives. However, ensure that the handling of default objects and the addition of lastUpdatedTimestamp are consistent and thoroughly tested to avoid unexpected behavior.

src/gql/utils/defaultObjects.ts (1)
  • 506-510: The addition of defaultAccountLinksInfo with fields nibiAddress, discordId, and twitterUser is essential for supporting the new account linking functionality. Ensure that this default object is used consistently across the codebase where GQLAccountLinksInfo is required.
src/gql/heart-monitor/heart-monitor.ts (2)
  • 159-161: The updates to the marketingMutation method in the IHeartMonitor interface, using QueryMarketingMutationArgs and GQLMarketingMutationFields, align well with the PR objectives. This change enhances the clarity and specificity of the method's purpose in the context of marketing functionalities.
  • 343-345: The updates to the marketingMutation method in the HeartMonitor class, using QueryMarketingMutationArgs and GQLMarketingMutationFields, are consistent with the PR's objectives to enhance marketing functionalities. This ensures that the method's signature is more aligned with its intended use case.
src/gql/heart-monitor/heart-monitor.test.ts (3)
  • 101-103: The renaming of types and introduction of defaultAccountLinksInfo align with the PR's objectives to enhance marketing functionalities. It's crucial to ensure that these new types and defaults are correctly utilized in the tests and implementation to support the account linking feature.
  • 440-449: The addition of linkAccounts field in the testMarketingMutation function is a direct implementation of the PR's objective to support account linking. It's important to verify that the test covers all relevant scenarios for account linking, including success and failure cases, to ensure robustness.
  • 488-496: The addition of accountLinksInfo and lastUpdatedTimestamp fields in the testMarketingQuery function aligns with the PR's objectives. It's important to ensure that these fields are correctly tested, including their presence, types, and any expected values, to validate the functionality of account linking queries.

src/gql/heart-monitor/heart-monitor.test.ts Show resolved Hide resolved
src/gql/heart-monitor/heart-monitor.test.ts Show resolved Hide resolved
Copy link

github-actions bot commented Mar 6, 2024

Lines Statements Branches Functions
Coverage: 88%
90.23% (1266/1403) 79.55% (541/680) 78.28% (310/396)

@cgilbe27 cgilbe27 merged commit 61c7fe8 into develop Mar 6, 2024
3 checks passed
@cgilbe27 cgilbe27 deleted the feat/new-marketing-mutation-query branch March 6, 2024 16:01
nibibot pushed a commit that referenced this pull request Mar 6, 2024
## [3.3.0](v3.2.0...v3.3.0) (2024-03-06)

### Features

* deepPartial ([#329](#329)) ([89f2504](89f2504))
* marketing mutation + query ([#331](#331)) ([61c7fe8](61c7fe8))

### Bug Fixes

* fix barrel ([599041f](599041f))
* merge ([4e1144d](4e1144d))

### Documentation

* **gql:** add JSDoc comment for DeepPartial ([26176e3](26176e3))

 [skip ci]
@nibibot
Copy link

nibibot commented Mar 6, 2024

🎉 This PR is included in version 3.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants