Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Gerelsukh
Copy link
Collaborator

@Gerelsukh Gerelsukh commented Jun 2, 2025

ISSUE

Context

Your context here. Additionally, any screenshots. Delete this line.

// Delete the below section once completed

PR Checklist

  • Description is clearly stated under Context section
  • Screenshots and the additional verifications are attached

Important

Enhances loan and savings transaction management by adding synchronization with Polaris, including new models, RPC consumers, GraphQL mutations, and UI components.

  • Behavior:
    • Adds isSyncedTransaction field to transaction models in transactions.ts for both loans and savings to track synchronization status.
    • Implements new RPC queue consumers in messageBroker.ts for handling transaction updates and synchronization.
    • Introduces new GraphQL mutations in mutations.ts for sending and syncing transactions with Polaris.
    • Adds new GraphQL queries in queries.ts for retrieving transaction and contract details.
  • Models:
    • Updates ITransaction and ITransactionDoc interfaces in transactions.ts to include isSyncedTransaction.
    • Modifies transactionSchema in transactions.ts to include new fields for transaction synchronization.
  • UI Components:
    • Adds new components in Transaction.tsx and TransactionHistories.tsx for displaying transaction details and sync histories.
    • Updates ContractDetails.tsx and ScheduleSection.tsx to integrate transaction history display.
    • Introduces new styles in styles.ts for transaction components.
  • Utilities:
    • Implements fetchPolaris and updateTransaction functions in utils.ts for handling API requests and transaction updates.
    • Adds utility functions for managing transaction synchronization logs.

This description was created by Ellipsis for dd986c0. You can customize this summary. It will automatically update as commits are pushed.

@sourcery-ai
Copy link

sourcery-ai bot commented Jun 2, 2025

Reviewer's Guide

This PR overhauls the Polaris sync implementation for savings and loans by refactoring backend utilities to standardize model resolution and sync logging, introducing strict payload validation, exposing new transaction endpoints in the GraphQL API, updating CLI commands, and enhancing the UI with dedicated transaction tabs and details.

Sequence Diagram for new 'sendSavingAmount' GraphQL Mutation

sequenceDiagram
    actor User
    participant GraphQLServer as GraphQL Server
    participant sendSavingAmountResolver as sendSavingAmount Resolver
    participant getConfig as getConfig
    participant incomeSavingFunc as incomeSaving()

    User->>GraphQLServer: Mutation: sendSavingAmount(data)
    GraphQLServer->>sendSavingAmountResolver: resolve(data)
    sendSavingAmountResolver->>getConfig: getConfig(subdomain, "POLARIS", {})
    getConfig-->>sendSavingAmountResolver: polarisConfig
    alt polarisConfig.token exists
        sendSavingAmountResolver->>incomeSavingFunc: incomeSaving(subdomain, polarisConfig, data)
        incomeSavingFunc-->>sendSavingAmountResolver: undefined (No Polaris call made)
    else Token not found
        sendSavingAmountResolver-->>GraphQLServer: Error: POLARIS config not found
    end
    sendSavingAmountResolver-->>GraphQLServer: "success" / Error
Loading

Sequence Diagram for Refactored 'incomeSaving' Utility

sequenceDiagram
    participant Client
    participant IS as incomeSaving()
    participant GM as generateModels()
    participant SL as SyncLogs.syncLogsAdd()
    participant GC as getContract()
    participant GetCust as getCustomer()
    participant CFO as customFieldToObject()
    participant GDA as getDepositAccount()

    Client->>IS: incomeSaving(subdomain, polarisConfig, params)
    IS->>GM: generateModels(subdomain)
    GM-->>IS: models
    IS->>IS: Create syncLogDoc
    IS->>SL: models.SyncLogs.syncLogsAdd(syncLogDoc)
    SL-->>IS: syncLog
    IS->>GC: getContract(subdomain, params.contractId, 'savings')
    GC-->>IS: savingContract
    alt savingContract.forDefPos == '1'
        IS->>Client: return incomeDeposit(...)
    end
    IS->>GetCust: getCustomer(subdomain, params.customerId)
    GetCust-->>IS: customer
    IS->>CFO: customFieldToObject(subdomain, 'core:customer', customer)
    CFO-->>IS: customerData
    IS->>GDA: getDepositAccount(subdomain, params.customerId)
    GDA-->>IS: depositAccount
    IS->>IS: Prepare sendData payload
    Note right of IS: sendData includes hardcoded txnAcntCode='300021000045', txnAmount=6500.
    Note right of IS: fetchPolaris() call is commented out in the PR.
    IS-->>Client: undefined (transaction not returned as fetchPolaris is out)
Loading

Sequence Diagram for new 'sendLoanAmount' GraphQL Mutation

sequenceDiagram
    actor User
    participant GraphQLServer as GraphQL Server
    participant sendLoanAmountResolver as sendLoanAmount Resolver
    participant getConfig as getConfig
    participant createLoanGiveFunc as createLoanGive()
    participant FP as fetchPolaris() 

    User->>GraphQLServer: Mutation: sendLoanAmount(data)
    GraphQLServer->>sendLoanAmountResolver: resolve(data)
    sendLoanAmountResolver->>getConfig: getConfig(subdomain, "POLARIS", {})
    getConfig-->>sendLoanAmountResolver: polarisConfig
    alt polarisConfig.token exists
        sendLoanAmountResolver->>createLoanGiveFunc: createLoanGive(subdomain, polarisConfig, data)
        createLoanGiveFunc->>FP: fetchPolaris(op: '13610262', ...)
        FP-->>createLoanGiveFunc: polarisResponse
        createLoanGiveFunc-->>sendLoanAmountResolver: polarisResponse
    else Token not found
        sendLoanAmountResolver-->>GraphQLServer: Error: POLARIS config not found
    end
    sendLoanAmountResolver-->>GraphQLServer: "success" / Error
Loading

Sequence Diagram for Refactored 'createLoanGive' Utility

sequenceDiagram
    participant Client
    participant CLG as createLoanGive()
    participant GM as generateModels()
    participant SL as SyncLogs.syncLogsAdd()
    participant GC as getContract()
    participant GetCust as getCustomer()
    participant CFO as customFieldToObject()
    participant GDA as getDepositAccount()
    participant FP as fetchPolaris()

    Client->>CLG: createLoanGive(subdomain, polarisConfig, transaction)
    CLG->>GM: generateModels(subdomain)
    GM-->>CLG: models
    CLG->>CLG: Create syncLogDoc
    CLG->>SL: models.SyncLogs.syncLogsAdd(syncLogDoc)
    SL-->>CLG: syncLog
    CLG->>GC: getContract(subdomain, { _id: transaction.contractId }, 'loans')
    GC-->>CLG: loanContract
    CLG->>GetCust: getCustomer(subdomain, loanContract.customerId)
    GetCust-->>CLG: customer
    CLG->>CFO: customFieldToObject(subdomain, 'core:customer', customer)
    CFO-->>CLG: customerData
    CLG->>GDA: getDepositAccount(subdomain, loanContract.customerId)
    GDA-->>CLG: depositAccount
    CLG->>CLG: Prepare loanGive payload (IPolarisLoanGive)
    CLG->>FP: fetchPolaris(op: '13610262', data: [loanGive], ...)
    FP-->>CLG: loanGiveResponse
    CLG-->>Client: loanGiveResponse
Loading

Class Diagram for Updated Polaris Backend Data Types

classDiagram
    class IPolarisSaving {
        +prodCode: string
        +slevel: number
        +capMethod: string
        +acntCode: string
        +startDate: string
        +maturityOption: string
        +brchCode: string
        +curCode: string
        +name: string
        +name2: string
        +termLen: number
        +tenor: number
        +custCode: string
        +jointOrSingle: string
        +openDateOrg: string
        +maturityDate: Date
    }
    note for IPolarisSaving "Renamed from IPolarisDeposit, fields adjusted."

    class IPolarisUpdateSaving {
        +operCode: string
        +acntCode: string
        +name: string
        +prodCode: string
        +brchCode: string
        +curCode: string
        +custCode: string
        +startDate: string
        +maturityDate: Date
        +tenor: number
        +capMethod: string
        +slevel: number
        +termLen: number
        +maturityOption: string
    }
    note for IPolarisUpdateSaving "Renamed from IPolarisUpdateDeposit, fields significantly changed."

    class IPolarisLoan {
      +custCode: string
      +name: string
      +prodCode: string
      +purpose: string
      +subPurpose: string
      +curCode: string
      +approvAmount: number
      +approvDate: Date
      +startDate: Date
      +endDate: Date
      +termLen: number
    }
    note for IPolarisLoan "Field types for approvDate, startDate, endDate changed to Date. termLen type to number. loanDestination removed."

    class IPolarisUpdateLoan {
      <<New>>
      +acntCode: string
      +custCode: string
      +name: string
      +prodCode: string
      +purpose: string
      +subPurpose: string
      +approvAmount: number
      +approvDate: Date
      +startDate: Date
      +endDate: Date
      +termLen: number
      +repayAcntSysNo: number
    }

    class IPolarisLoanGive{
      +txnAcntCode: string
      +txnAmount: number
      +contAcntCode: string
      +contAmount: number
      +txnDesc: string
      +tcustName: string
      +tcustRegister: string
    }
Loading

Class Diagram for GraphQL Schema Changes (Mutations and Queries)

classDiagram
  class GraphQLMutations {
    <<New>> +sendSavingAmount(data: JSON): String
    <<New>> +sendLoanAmount(data: JSON): String
  }
  GraphQLMutations ..> incomeSaving : calls 
  GraphQLMutations ..> createLoanGive : calls 

  class GraphQLQueries {
    +getPolarisData(method: String, data: JSON): JSON
    note "A new 'method' option 'getSavingDetail' is now supported."
  }
  GraphQLQueries ..> getSavingDetail_utility : calls when method is 'getSavingDetail'

  class incomeSaving {
    note "Called by sendSavingAmount mutation"
  }
  class createLoanGive {
    note "Called by sendLoanAmount mutation"
  }
  class getSavingDetail_utility {
    note "Utility function to fetch saving details from Polaris (op: getSavingDetail)"
  }
Loading

File-Level Changes

Change Details Files
Refactored savings transaction flow in syncpolaris-api
  • Unified function signature to generate models and log sync operations
  • Expanded and reshaped sendData fields with hard-coded test values and placeholders
  • Introduced IPolarisSaving/IPolarisUpdateSaving types and validator enforcement
  • Commented out live fetchPolaris call pending real-data integration
src/utils/saving/incomeSaving.ts
src/utils/saving/createSavingMessage.ts
src/utils/saving/updateSaving.ts
src/utils/saving/types.ts
src/utils/saving/validator.ts
Refactored loan transaction flow and validation
  • Switched createLoanGive and updateLoan to use generateModels and syncLogs
  • Defined and applied IPolarisUpdateLoan/IPolarisLoanGive types with validateLoanObject/validateUpdateLoanObject
  • Moved system date fetch into createLoanMessage and enforced payload validation
  • Added getDate util to retrieve Polaris system date
src/utils/loan/loanGive.ts
src/utils/loan/updateLoan.ts
src/utils/loan/types.ts
src/utils/loan/validator.ts
src/utils/loan/createLoanMessage.ts
src/utils/loan/getDate.ts
Enhanced CLI sync script for loans
  • Restored general customerFilter ({ code: {$exists:true} })
  • Uncommented and re-enabled fetchPolaris calls for loan transactions
  • Removed leftover console logs and commented blocks
src/commands/syncLoansPolaris.js
Extended GraphQL API with transaction mutations
  • Added sendSavingAmount and sendLoanAmount mutations
  • Wired new mutations to incomeSaving and createLoanGive handlers
  • Exposed getSavingDetail in syncHistoriesPolaris query resolver
src/graphql/resolvers/mutations/savings.ts
src/graphql/resolvers/mutations/loans.ts
src/graphql/resolvers/queries/syncHistoriesPolaris.ts
src/graphql/schema/mutations.ts
Revamped UI to surface saving transactions
  • Changed SchedulesContainer and ScheduleSection to accept pre-fetched transactions
  • Introduced Transaction and TransactionHistories components and containers
  • Added SavingInfo component and new GraphQL queries/mutations
  • Updated styles with ExtraRow and DidAmount
packages/plugin-savings-ui/src/contracts/containers/Schedules.tsx
packages/plugin-savings-ui/src/contracts/components/schedules/ScheduleSection.tsx
packages/plugin-syncpolaris-ui/src/savingPolaris/components/Transaction/**
packages/plugin-syncpolaris-ui/src/savingPolaris/containers/Transaction.tsx
packages/plugin-syncpolaris-ui/src/savingPolaris/components/SavingInfo.tsx
packages/plugin-syncpolaris-ui/src/savingPolaris/graphql
packages/plugin-syncpolaris-ui/src/savingPolaris/styles.ts

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai
Copy link

coderabbitai bot commented Jun 2, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @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.

CodeRabbit Configuration 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
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Caution

Changes requested ❌

Reviewed everything up to 533b562 in 2 minutes and 16 seconds. Click for details.
  • Reviewed 1953 lines of code in 34 files
  • Skipped 0 files when reviewing.
  • Skipped posting 11 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. packages/plugin-syncpolaris-api/src/utils/saving/types.ts:14
  • Draft comment:
    The interface IPolarisSaving defines 'termLen' as a string, yet in update functions it is used like a number. Ensure type consistency between saving contract duration and its type.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
2. packages/plugin-syncpolaris-api/src/utils/saving/createSavingMessage.ts:159
  • Draft comment:
    Using JSON.parse on 'savingCode' may throw an exception if the response is not valid JSON. Consider adding error handling or validating the format of savingCode.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
3. packages/plugin-syncpolaris-ui/src/savingPolaris/containers/Transaction.tsx:48
  • Draft comment:
    The refetchQueries call uses an 'include' array with 'syncSavingsData'. Ensure the query name matches the one defined in your GraphQL queries to avoid typos and unintended behavior.
  • Reason this comment was not posted:
    Comment looked like it was already resolved.
4. packages/plugin-syncpolaris-api/src/utils/saving/updateSaving.ts:119
  • Draft comment:
    Hard-coded op code '13610286' is used in the fetchPolaris call. Consider defining such op codes as constants for better maintainability and clarity.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
5. packages/plugin-syncpolaris-api/src/utils/loan/createLoanMessage.ts:75
  • Draft comment:
    Consider refactoring and centralizing hard-coded op codes (like '13619000', '13610253', etc.) into constants. This would improve maintainability and readability.
  • Reason this comment was not posted:
    Comment was on unchanged code.
6. packages/plugin-savings-ui/src/contracts/graphql/queries.ts:147
  • Draft comment:
    Typo notice: Please double-check whether 'savingTransactionHistory' should be 'savingsTransactionHistory' to keep naming consistent with the module's context and other fields. If this is intentional, please disregard.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 20% vs. threshold = 50% The field name likely comes from a GraphQL schema that's defined elsewhere. The inconsistency exists but changing it would require schema changes. This seems more like a style preference than a real issue. The code will work fine either way. The comment is asking for verification rather than pointing out a clear problem. The inconsistent naming could indicate an actual schema design issue that should be fixed. Consistent naming can prevent bugs and improve maintainability. While consistency is good, this comment is asking for verification ("Please double-check") rather than definitively pointing out an issue. It's the kind of speculative comment our rules say to avoid. Delete the comment. It's asking for verification rather than pointing out a clear issue, and the inconsistency, while real, isn't severe enough to warrant a comment.
7. packages/plugin-syncpolaris-api/src/utils/loan/createLoanMessage.ts:99
  • Draft comment:
    Typo alert: It looks like in the new code, 'new Date(endDate)' might be a mistake. Should this be 'new Date(loan.endDate)' to match the original intent?
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% The change appears intentional and part of a larger refactor. The code now gets a system date and calculates the end date based on duration, rather than using a predefined end date. This is a valid approach and may be preferred for consistency. The comment seems to misunderstand that this is an intentional change in behavior. I could be wrong about the intentionality - maybe this is actually a bug. The old behavior using loan.endDate might have been correct. The systematic calculation of endDate from systemDate + duration seems more robust than using a predefined endDate. The change is consistent with other changes like using systemDate for startDate and approvDate. The comment should be deleted as it appears to misunderstand an intentional change in how end dates are calculated.
8. packages/plugin-syncpolaris-api/src/utils/loan/createLoanMessage.ts:101
  • Draft comment:
    Typo alert: The property name 'IsGetBrchFromOutside' uses an unexpected uppercase letter. Consider changing it to 'isGetBrchFromOutside' for consistency with the other lowerCamelCase keys.
  • Reason this comment was not posted:
    Comment was on unchanged code.
9. packages/plugin-syncpolaris-api/src/utils/loan/loanGive.ts:72
  • Draft comment:
    Typo: variable name "loanGiveReponse" may be a typographical error. Consider renaming it to "loanGiveResponse".
  • Reason this comment was not posted:
    Comment was on unchanged code.
10. packages/plugin-syncpolaris-api/src/utils/saving/types.ts:5
  • Draft comment:
    The property name 'capAcntCode' on line 5 might be a typographical error. Should it be 'capAcctCode' (with a double 'c') for consistency and clarity? Please double-check.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
11. packages/plugin-syncpolaris-ui/src/savingPolaris/components/Transaction/TransactionHistories.tsx:7
  • Draft comment:
    Potential typo: The import name 'ScrollTableColls' might be intended to be 'ScrollTableCols'. Please verify if this is correct.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% The import comes from a local styles file that we can't see. The component name could be intentionally named with "Colls". Without seeing the source file, we can't verify if this is actually a typo. Making assumptions about naming without full context could lead to unnecessary changes. The name does look unusual and could be a legitimate typo that should be fixed. Not raising potential typos could lead to maintaining incorrect names in the codebase. However, per the rules, we should not make speculative comments or comments that require more context to verify. We would need to see the styles file to confirm if this is actually a typo. Delete the comment since we cannot verify if this is actually a typo without seeing the styles file, and speculative comments should be avoided.

Workflow ID: wflow_M1DjX6DUIzETyKr3

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

`;

const syncSavingTransactions = `
mutation depositContractActive($contractNumber: String!) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The mutation syncSavingTransactions is defined identically to depositContractActive. Verify this is intentional; otherwise, use the correct operation for syncing saving transactions.

}
console.log(sendData, 'sendData');

// if (savingContract?.number && params?.total != null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

There is a block of commented-out code (lines 76-85). Consider removing or clarifying its purpose to improve code clarity.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Caution

Changes requested ❌

Reviewed 23d943a in 2 minutes and 40 seconds. Click for details.
  • Reviewed 522 lines of code in 12 files
  • Skipped 0 files when reviewing.
  • Skipped posting 7 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. packages/plugin-savings-api/src/messageBroker.ts:129
  • Draft comment:
    Consider adding error handling or logging in the 'savings:transactions.update' consumer to handle updateOne failures consistently.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 20% vs. threshold = 50% The comment suggests adding error handling, but this seems inconsistent with the codebase patterns. The RPC queue infrastructure likely handles errors already. Other similar consumers don't have explicit error handling. Adding error handling here would create inconsistency. The comment also doesn't specify what kind of error handling would be useful. Maybe there are specific error cases for transactions that need special handling that don't apply to other entities. The comment could be identifying a real risk. Without specific evidence of transaction-specific error cases, and given the consistent pattern across the codebase, adding error handling here would be an unnecessary deviation. Delete the comment. It suggests deviating from established patterns without clear justification.
2. packages/plugin-savings-ui/src/transactions/types.ts:24
  • Draft comment:
    Use lowercase 'boolean' for the isSyncedTransaction type for consistency across interfaces.
  • Reason this comment was not posted:
    Marked as duplicate.
3. packages/plugin-syncpolaris-api/src/utils/loan/createLoanMessage.ts:141
  • Draft comment:
    Ensure that startDate and endDate are correctly formatted and timezone-adjusted when updating the contract.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% The comment is asking the author to ensure that the startDate and endDate are correctly formatted and timezone-adjusted. This is a general request for confirmation and does not provide a specific suggestion or point out a specific issue in the code. It violates the rule against asking the author to ensure behavior is intended.
4. packages/plugin-syncpolaris-ui/src/savingPolaris/components/Transaction/TransactionHistories.tsx:35
  • Draft comment:
    Table header in TransactionHistories does not match the displayed content; consider updating the header (e.g., use 'Status' instead of 'Date') to reflect sync status.
  • Reason this comment was not posted:
    Comment was on unchanged code.
5. packages/plugin-savings-api/src/models/definitions/transactions.ts:106
  • Draft comment:
    Typo: The label "Is Synced transaction" has inconsistent capitalization compared to the other labels. Consider changing it to "isSyncedTransaction" or "Is Synced Transaction" for consistency.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 20% vs. threshold = 50% While the comment is technically correct about inconsistency, there's already widespread inconsistency throughout the file. Making this single label consistent wouldn't improve the overall situation. This seems like a larger styling issue that would need to be addressed across the entire file, not just for this one new field. The comment doesn't add significant value. The inconsistent capitalization could cause confusion in UI or documentation. Maybe standardizing even one field is a step in the right direction? Fixing just one field when there are many inconsistent ones could actually make the code more confusing by suggesting there is a standard when there isn't. This needs a larger cleanup effort. Delete the comment. While technically correct, fixing this single label's capitalization wouldn't meaningfully improve code quality given the widespread inconsistency throughout the file.
6. packages/plugin-savings-ui/src/transactions/types.ts:24
  • Draft comment:
    In the new property isSyncedTransaction?: Boolean;, consider using the primitive boolean (lowercase) instead of Boolean for consistency with the other primitive types in this file.
  • Reason this comment was not posted:
    Marked as duplicate.
7. packages/plugin-syncpolaris-ui/src/savingPolaris/components/Transaction/TransactionHistories.tsx:30
  • Draft comment:
    Typo notice: 'ScrollTableColls' might be a typographical error. Did you mean 'ScrollTableCols'?
  • Reason this comment was not posted:
    Comment was on unchanged code.

Workflow ID: wflow_15565ip1NvYmwTre

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

externalBankName?: string;
ownBankNumber?: string;
ownBankType?: string;
isSyncedTransaction?: Boolean;
Copy link
Contributor

Choose a reason for hiding this comment

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

Prefer using lowercase boolean instead of Boolean in TypeScript interfaces for isSyncedTransaction for type consistency.

Suggested change
isSyncedTransaction?: Boolean;
isSyncedTransaction?: boolean;

);
}

return transaction;
Copy link
Contributor

Choose a reason for hiding this comment

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

Returning from the loop in incomeSaving may skip processing subsequent transactions; consider processing all items or accumulating results.

const onHandlePolaris = () =>
confirm(__("Are you sure you want to activate Savings?"))
.then(() => {
if (contract.isDeposit) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The if-else block in onHandlePolaris is redundant as both branches call sentTransaction(transactions); simplify the logic.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Caution

Changes requested ❌

Reviewed 5a57ee8 in 1 minute and 39 seconds. Click for details.
  • Reviewed 381 lines of code in 8 files
  • Skipped 0 files when reviewing.
  • Skipped posting 5 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. packages/plugin-syncpolaris-api/src/graphql/resolvers/mutations/savings.ts:57
  • Draft comment:
    Consider adding error handling (e.g., try/catch) in the new sendDepositAmount resolver for consistency and to avoid unhandled promise rejections.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% The comment suggests adding error handling that doesn't exist in any of the other similar methods. This would actually make the new method inconsistent with the established pattern. GraphQL resolvers often let errors propagate up to be handled by the GraphQL error handling middleware. There's no evidence that the current approach is problematic. Maybe there's a good reason to add error handling that I'm not seeing. Perhaps the incomeDeposit function has different error characteristics than the other utility functions. Without seeing evidence that incomeDeposit needs special error handling, we should maintain consistency with the established pattern in the codebase. Delete the comment. Adding try/catch would make this method inconsistent with others, and there's no evidence it's needed.
2. packages/plugin-syncpolaris-api/src/utils/saving/incomeSaving.ts:105
  • Draft comment:
    The 'return transaction' inside the for-loop will exit after processing the first item. If multiple transactions are expected, consider accumulating results or moving the return outside the loop.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
3. packages/plugin-syncpolaris-ui/src/savingPolaris/containers/Transaction.tsx:40
  • Draft comment:
    The mutation hook for depositTransaction is typed as SavingTransactionMutationResponse. To improve type safety, consider using the dedicated DepositTransactionMutationResponse type.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 20% vs. threshold = 50% The comment suggests using a type that isn't visible in the codebase context we have. While it's possible this type exists somewhere else, we don't have strong evidence for that. The existing SavingTransactionMutationResponse type is already being used for a similar mutation (savingTransaction) and could be the correct type to use here. Without seeing the actual types or mutation responses, we can't be confident this suggestion is correct. The comment could be correct - maybe there is a DepositTransactionMutationResponse type defined elsewhere that would be more appropriate. The similar but distinct mutation names (sync[Deposit/Saving]Transactions) hint at potentially different response types. However, without seeing the type definitions or mutation responses, we don't have strong evidence that this change is necessary or correct. The existing code could be intentionally reusing the same response type. Delete this comment since we don't have strong evidence that the suggested type exists or would be more appropriate than the current type.
4. packages/plugin-syncpolaris-ui/src/savingPolaris/containers/Transaction.tsx:61
  • Draft comment:
    Typo: The function name 'sentDepositTransactionHandler' might be a typo. It appears that it was intended to be 'sendDepositTransactionHandler' for clarity.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 20% vs. threshold = 50% The naming pattern is inconsistent (sent vs send), but both names are valid English and convey similar meaning. The function works correctly regardless of its name. This seems like a minor stylistic issue that doesn't impact functionality. The comment is technically about changed code but feels nitpicky. The inconsistency between 'sent' and 'send' could indicate a broader pattern issue in the codebase. The prop name 'sendDepositTr' uses 'send' which could support the comment's suggestion. While there is an inconsistency, the function name is clear enough and the code works correctly. This is a minor stylistic issue that doesn't warrant a comment. Delete the comment. The function name is clear enough and the inconsistency is too minor to require a change.
5. packages/plugin-syncpolaris-ui/src/savingPolaris/containers/Transaction.tsx:85
  • Draft comment:
    Typographical note: The property name 'sendDepositTr' might be inconsistent with the naming convention used for 'sentTransaction'. Consider if it should be 'sentDepositTransaction' (or something similar) for clarity and consistency.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 20% vs. threshold = 50% While the comment identifies a real inconsistency, our rules state we should only keep comments that require clear code changes. Naming inconsistencies, while not ideal, are more of a style/readability issue. The code will function correctly regardless. The comment is also somewhat speculative with "might be" and "consider if". The inconsistent naming could lead to confusion for developers maintaining the code in the future. It violates the principle of least surprise. While naming consistency is good practice, this isn't a critical issue that absolutely requires changing. The code will work correctly either way, and our rules specifically say to avoid purely informative comments. Given our strict rules about only keeping comments that require clear code changes, this style-focused comment should be removed despite being technically correct.

Workflow ID: wflow_CQ4Opmmxiz7eZ7fb

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

'savings'
);

return deposit;
Copy link
Contributor

Choose a reason for hiding this comment

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

Returning inside the for-loop causes early termination; only the first non-synced transaction is processed. Consider processing all transactions or accumulating responses.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed 7ebd3c3 in 1 minute and 21 seconds. Click for details.
  • Reviewed 155 lines of code in 3 files
  • Skipped 0 files when reviewing.
  • Skipped posting 4 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. packages/plugin-savings-api/src/models/definitions/transactions.ts:68
  • Draft comment:
    Consider using a function (e.g. () => new Date()) for the default value of payDate so that each new document gets the current timestamp rather than reusing the same Date instance.
  • Reason this comment was not posted:
    Comment was on unchanged code.
2. packages/plugin-savings-api/src/models/definitions/transactions.ts:95
  • Draft comment:
    The label for storeReaction is identical to contractReaction. Verify if this is intentional or if storeReaction should have a distinct label.
  • Reason this comment was not posted:
    Comment was on unchanged code.
3. packages/plugin-syncpolaris-ui/src/savingPolaris/components/Transaction/Transaction.tsx:24
  • Draft comment:
    The confirmation message was updated to 'Are you sure you want to send transactions?'. Ensure that this change aligns with the intended user action and that any related documentation is updated.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
4. packages/plugin-syncpolaris-ui/src/savingPolaris/components/Transaction/Transaction.tsx:14
  • Draft comment:
    Consider renaming the 'sentTransaction' callback to something like 'sendTransaction' for consistency with 'sendDepositTr' and clearer action semantics.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.

Workflow ID: wflow_LVsxaHiYFg4cO0zq

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed 6395983 in 1 minute and 6 seconds. Click for details.
  • Reviewed 85 lines of code in 4 files
  • Skipped 0 files when reviewing.
  • Skipped posting 5 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. packages/plugin-syncpolaris-ui/src/savingPolaris/components/Transaction/Transaction.tsx:1
  • Draft comment:
    Good update: Import now includes both Box and Table from '@erxes/ui/src', ensuring that the Table component used later is available.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
2. packages/plugin-syncpolaris-ui/src/savingPolaris/components/Transaction/Transaction.tsx:47
  • Draft comment:
    Simplified renderCell by removing the unnecessary React fragment. The direct return of DidAmount improves clarity.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
3. packages/plugin-syncpolaris-ui/src/savingPolaris/components/Transaction/TransactionHistories.tsx:1
  • Draft comment:
    Consolidated style and UI component imports (Box and Table) to reduce redundancy. This streamlines the import section.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
4. packages/plugin-syncpolaris-ui/src/savingPolaris/containers/Transaction.tsx:9
  • Draft comment:
    Apollo hooks imports (useQuery, useMutation) have been consolidated into a single line, removing duplicate imports and improving maintainability.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
5. packages/plugin-syncpolaris-ui/src/savingPolaris/containers/TransactionHistories.tsx:8
  • Draft comment:
    The TransactionHistories container now correctly imports the corresponding component and handles the loading state with a Spinner. The import and prop passing are consistent.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None

Workflow ID: wflow_I7jg8LNTp9Wq5HOZ

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed 3fbb2f2 in 2 minutes and 2 seconds. Click for details.
  • Reviewed 57 lines of code in 3 files
  • Skipped 0 files when reviewing.
  • Skipped posting 3 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. packages/plugin-syncpolaris-api/src/utils/loan/loanGive.ts:55
  • Draft comment:
    Switching from '||' to '??' changes fallback behavior (empty strings won't trigger defaults). Confirm this is intended for fields like txnDesc and tcustName.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% This comment violates several rules. It's asking for confirmation ("Confirm this is intended...") which we explicitly shouldn't do. It's speculative about potential issues rather than pointing out a definite problem. The change from || to ?? is a deliberate change that the author made across multiple fields consistently, suggesting it was intentional. The behavior change is real and could have significant implications if these fields are used in important business logic. Maybe this deserves attention. While the behavior change is real, the consistent application across multiple fields suggests this was a deliberate choice. If it were incorrect, it would likely be caught in testing since these are core loan details. Delete the comment. It violates our rules by asking for confirmation and being speculative, rather than pointing out a definite issue.
2. packages/plugin-syncpolaris-api/src/utils/saving/incomeSaving.ts:66
  • Draft comment:
    Using '??' instead of '||' alters fallback behavior — empty strings are now accepted. Verify that txnAcntCode, txnDesc, and tcustRegister handle falsy values as expected.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% While the comment is technically correct that ?? and || behave differently with empty strings, this appears to be an intentional change to improve the handling of falsy values. The code provides default values ('', 'shiljuuleg', '') which suggests empty strings are acceptable. The API call doesn't show any validation requirements that would make empty strings problematic. The comment raises a valid technical point about different operator behavior. Maybe there are API requirements we can't see that make empty strings invalid? The code's structure and default values strongly suggest empty strings are valid. If empty strings weren't allowed, the defaults themselves would be invalid. This comment should be deleted as it's asking for verification without strong evidence of an actual issue, and appears to be questioning an intentional improvement in null handling.
3. packages/plugin-syncpolaris-ui/src/savingPolaris/components/Transaction/TransactionHistories.tsx:8
  • Draft comment:
    Removed the unused 'contract' prop from the Props type. Ensure no dependent component relies on it.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None

Workflow ID: wflow_aDtou0i2XYEghI7S

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Caution

Changes requested ❌

Reviewed 3569cdd in 1 minute and 48 seconds. Click for details.
  • Reviewed 81 lines of code in 5 files
  • Skipped 0 files when reviewing.
  • Skipped posting 6 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. packages/plugin-syncpolaris-api/src/utils/deposit/createDeposit.ts:48
  • Draft comment:
    Condition updated to include deposit.isSyncedPolaris. Confirm that deposit.isSyncedPolaris is a boolean flag and that this check meets business expectations.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% The comment is asking the PR author to confirm the type and business logic of a condition. This violates the rule against asking the author to confirm their intention or ensure behavior is intended. The comment does not provide a specific code suggestion or ask for a test to be written.
2. packages/plugin-syncpolaris-api/src/utils/loan/createLoanMessage.ts:51
  • Draft comment:
    Condition now checks loan.isSyncedPolaris alongside preSuccessValue. Verify that loan.isSyncedPolaris is consistently defined and used correctly.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% The comment is asking the PR author to verify the consistency and correctness of the usage of loan.isSyncedPolaris. This falls under asking the author to double-check or ensure something, which is against the rules. The comment does not provide a specific suggestion or point out a specific issue, making it not useful according to the guidelines.
3. packages/plugin-syncpolaris-api/src/utils/saving/createSavingMessage.ts:54
  • Draft comment:
    The condition now includes savingContract.isSyncedPolaris. Ensure that this flag is reliably set to a boolean and that its inclusion behaves as expected.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% The comment is asking the PR author to ensure that a flag is reliably set and behaves as expected. This falls under the category of asking the author to double-check or ensure behavior, which is against the rules. Therefore, this comment should be removed.
4. packages/plugin-syncpolaris-ui/src/savingPolaris/components/Transaction/TransactionHistories.tsx:5
  • Draft comment:
    Removed import of IContractDoc for being unused. This is a clean-up and improves code clarity.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
5. packages/plugin-savings-api/src/graphql/resolvers/queries/contracts.ts:351
  • Draft comment:
    Typo: The error message "cant find account" is missing an apostrophe. Consider using "can't find account".
  • Reason this comment was not posted:
    Comment was on unchanged code.
6. packages/plugin-savings-api/src/graphql/resolvers/queries/contracts.ts:355
  • Draft comment:
    Typo: The error message "this account has not customer" is grammatically awkward. Consider rephrasing to "this account does not have a customer".
  • Reason this comment was not posted:
    Comment was on unchanged code.

Workflow ID: wflow_N8m1axLahCQrvLdr

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

return {
list: await paginate(
models.Contracts.find(filter).sort(sortBuilder(params)),
models.Contracts.find(filter).sort(
Copy link
Contributor

Choose a reason for hiding this comment

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

The new sort call passes two objects to .sort(). Mongoose expects a single sort object. Merge the sort criteria (e.g., combine { createdAt: -1 } with sortBuilder(params)) to ensure proper sorting.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Caution

Changes requested ❌

Reviewed bc20ded in 2 minutes and 23 seconds. Click for details.
  • Reviewed 1004 lines of code in 19 files
  • Skipped 0 files when reviewing.
  • Skipped posting 8 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. packages/plugin-syncpolaris-api/src/utils/loan/createLoanMessage.ts:85
  • Draft comment:
    Potential bug: Using 'systemDate.tenor' instead of 'loan.tenor' when setting endDate. Ensure the correct variable is used for month offset.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
2. packages/plugin-syncpolaris-api/src/utils/loan/loanGive.ts:12
  • Draft comment:
    Ensure the 'transaction' parameter is non-empty before accessing transaction[0] to avoid runtime errors.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 0% vs. threshold = 50% This is a valid concern about potential runtime errors. The code makes heavy use of transaction[0] without checks. However, the comment asks to "ensure" something rather than making a clear suggestion. It also doesn't specify what exactly should be done - throw an error? Return early? Additionally, we don't know the contract of this function - maybe transaction is guaranteed to be non-empty by the caller. I might be too harsh on the "ensure" phrasing - the underlying suggestion for validation is sound. Also, even if callers guarantee non-empty arrays, defensive programming could still be valuable. While the core suggestion is valid, the comment's phrasing violates our rules by asking to "ensure" something rather than making a clear, actionable suggestion. A better comment would directly suggest adding specific validation code. Delete this comment because it violates the rule against asking authors to "ensure" things. A better comment would specifically suggest adding if (!transaction?.length) throw new Error('Transaction array cannot be empty'); at the start of the function.
3. packages/plugin-loans-api/src/models/definitions/transactions.ts:218
  • Draft comment:
    Typographical comment: The label 'Is Synced transaction' might be intended to have consistent capitalization, e.g., 'Is Synced Transaction'.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% The comment is about a purely cosmetic issue. While consistency in naming is good, this is a label string that likely only appears in internal/debug contexts. The inconsistency doesn't affect functionality. Looking at other labels in the file, there's no clear standard being followed anyway. This feels like unnecessary nitpicking. The comment does point out a real inconsistency, and consistent naming conventions can make code more maintainable. Maybe establishing a standard here could help future development. While consistency is good, this single label change in isolation won't establish a standard. If capitalization needs to be standardized, it should be done systematically across all labels, not one at a time. Delete the comment. The capitalization issue is too minor to warrant a PR comment, especially given the inconsistent capitalization throughout the rest of the file.
4. packages/plugin-syncpolaris-api/src/utils/loan/loanGive.ts:119
  • Draft comment:
    Typographical error: It appears that 'loanGiveReponse' is misspelled. Consider correcting it to 'loanGiveResponse' for improved clarity and correctness.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
5. packages/plugin-syncpolaris-ui/src/loanPolaris/components/Transaction/TransactionHistories.tsx:5
  • Draft comment:
    Typo: The identifier 'ScrollTableColls' might be a misspelling. Consider using 'ScrollTableCols' if that's the intended name.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% Since this is an imported component, the name must exist in the styles file. If it was actually misspelled, the code wouldn't compile. The author must have intentionally named it 'ScrollTableColls' in the styles file. Making assumptions about naming without seeing the source is risky. The name does look unusual and could be a legitimate typo that exists in both files. Maybe 'Colls' has a specific meaning I'm not aware of. Even if it is a typo, it would need to be fixed in the styles file first. Commenting on it here without that context isn't helpful. Delete the comment. If there's a typo, it would be caught by the build system or should be addressed in the styles file where it's defined.
6. packages/plugin-syncpolaris-ui/src/loanPolaris/types.ts:103
  • Draft comment:
    Typo alert: The property name 'interestEve' appears in both ITransactionDoc and IInvoiceDoc. Please confirm if this is the intended name, or if it should be something like 'interestEver' or another term.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% The term 'interestEve' appears to be a deliberate choice since it's used consistently and paired with 'interestNonce'. This seems like domain-specific terminology rather than a typo. The comment is speculative and asks for confirmation rather than pointing out a clear issue. Without deeper domain knowledge, we can't be certain this is actually a problem. I could be wrong about this being intentional terminology - maybe it really is a typo that was copy-pasted between interfaces. Even if it is a typo, the comment violates our rules by asking for confirmation ("Please confirm if...") rather than making a clear assertion about what needs to be changed. The comment should be removed because it's speculative and asks for confirmation rather than pointing out a clear issue that needs to be fixed.
7. packages/plugin-syncpolaris-ui/src/loanPolaris/types.ts:121
  • Draft comment:
    Typo alert: The property name 'calcedInfo' in ITransaction might be intended to be 'calculatedInfo'. Please verify if this abbreviation is intentional.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% While calcedInfo is indeed an abbreviation, there's no strong evidence that this is incorrect or needs to be changed. The abbreviation might be intentional for brevity, consistent with codebase style, or have specific meaning in the domain. The type is any which suggests it's an internal implementation detail. This seems like a purely stylistic suggestion without clear benefit. The abbreviation could potentially make the code less readable for new developers. There might be a codebase style guide that prefers full words over abbreviations. Without access to style guides or domain knowledge, suggesting a rename based purely on personal preference for full words over abbreviations isn't a strong enough reason for a code change. Delete this comment as it's a purely stylistic suggestion without clear evidence that the current name is problematic or incorrect.
8. packages/plugin-syncpolaris-ui/src/savingPolaris/components/Transaction/TransactionHistories.tsx:25
  • Draft comment:
    Typo Suggestion: The title text 'Saving history' might be intended to be 'Savings History' if referring to the history of savings. Please double-check for consistency.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% This appears to be a purely cosmetic suggestion about text casing. The current "Saving history" matches the prop name convention (savingHistories). The suggestion to change to "Savings History" is subjective and doesn't impact functionality. This kind of minor text suggestion violates the rule about not commenting on UI changes unless there's a clear issue. Perhaps consistency in terminology across the application is important enough to warrant this comment? Maybe "Savings" is the standard term used elsewhere? Without seeing the broader application context, we can't know if this is actually an inconsistency. The current singular form "Saving" matches the component's internal naming convention. This comment should be deleted as it's a subjective UI text suggestion without clear evidence of being incorrect or inconsistent.

Workflow ID: wflow_1QfpnF1DTLzFLDbd

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.


const renderExtraButton = () => {
return (
!transactions[0].isSyncedTransaction && (
Copy link
Contributor

Choose a reason for hiding this comment

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

Guard against an empty transactions array when accessing transactions[0] to prevent potential runtime errors.

Suggested change
!transactions[0].isSyncedTransaction && (
transactions.length > 0 && !transactions[0].isSyncedTransaction && (

const renderRow = (saving) => {
return (
<tr key={saving._id}>
<td>{saving?.responseStr ? 'synced' : 'not synced'}</td>
Copy link
Contributor

Choose a reason for hiding this comment

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

The table header includes 'Date', but the row content does not display any date. Consider adding a date field for clarity.

Suggested change
<td>{saving?.responseStr ? 'synced' : 'not synced'}</td>
<td>{saving?.date}</td>

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed 48e1755 in 52 seconds. Click for details.
  • Reviewed 12 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. packages/plugin-syncpolaris-ui/src/loanPolaris/components/Transaction/Transaction.tsx:36
  • Draft comment:
    Good addition: checking that 'transactions.length > 0' prevents accessing transactions[0] when the array is empty. Consider refactoring the condition into a well-named constant (e.g., const showExtraButton = transactions.length > 0 && !transactions[0].isSyncedTransaction;) for better readability.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None

Workflow ID: wflow_yF4wzoBbupJwUmhP

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Caution

Changes requested ❌

Reviewed dd986c0 in 2 minutes and 3 seconds. Click for details.
  • Reviewed 210 lines of code in 4 files
  • Skipped 0 files when reviewing.
  • Skipped posting 3 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. packages/plugin-syncpolaris-api/src/graphql/schema/mutations.ts:13
  • Draft comment:
    There is a type mismatch for 'loanContractActive': the schema defines its return type as JSON while the resolver returns 'success' (a string). Ensure the schema and resolver are aligned.
  • Reason this comment was not posted:
    Comment was on unchanged code.
2. packages/plugin-syncpolaris-api/src/utils/loan/loanRepayment.ts:78
  • Draft comment:
    Typo detected: 'loanRepaymentReponse' should likely be 'loanRepaymentResponse' for clarity.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% While this is technically correct - there is a typo - fixing variable names is something that would be caught by linters or code review tools. It's a very minor issue that doesn't affect functionality. The rules specifically say not to comment on variable renames or things that would be caught by the build. The typo could potentially make the code slightly less readable. It's a newly introduced variable in this diff. While it's a new variable, this kind of minor naming issue should be caught by automated tools, not manual review comments. The rules are clear about not commenting on variable names. Delete this comment as it violates the rule about not commenting on variable renames or things that would be caught by the build.
3. packages/plugin-syncpolaris-api/src/utils/loan/loanRepayment.ts:78
  • Draft comment:
    Typo: 'loanRepaymentReponse' appears to be misspelled. Consider renaming it to 'loanRepaymentResponse' to ensure clarity and consistency.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% While the typo is real, fixing variable names is a very minor issue that would be caught during normal code review or linting. It doesn't affect functionality and is more of a cosmetic issue. According to the rules, we should not make comments that are obvious or unimportant. Variable naming issues fall into this category. The typo could potentially cause confusion when reading the code, and consistent naming is important for code maintainability. While code consistency is important, this is a trivial issue that doesn't warrant a formal comment. It's the kind of thing that can be mentioned informally or caught by automated tools. The comment should be deleted as it points out a trivial naming issue that doesn't materially impact the code's functionality or understanding.

Workflow ID: wflow_n2xdtrMTpK5YoZkW

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

params.object
);
}
// if (params.object.transactionType === 'give') {
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove the commented out 'give' transaction block if it is no longer needed. Keeping dead code can be confusing.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Jun 3, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
25.3% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@munkhsaikhan munkhsaikhan merged commit 1418b6e into staging Jun 4, 2025
9 of 10 checks passed
@munkhsaikhan munkhsaikhan deleted the loans-improve branch June 4, 2025 03:06
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.

3 participants