-
Notifications
You must be signed in to change notification settings - Fork 201
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
fix: better violation names on statistics page (BAL-3294) #2932
Conversation
|
WalkthroughThis pull request introduces a significant change to the structure of Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (2)
apps/backoffice-v2/src/pages/Statistics/components/PortfolioRiskStatistics/hooks/usePortfolioRiskStatisticsLogic/usePortfolioRiskStatisticsLogic.tsx (1)
26-26
: Consider avoiding in-place sorting to prevent mutating the array.Using
.sort()
directly mutatesviolationCounts
. For immutability (and fewer potential surprises in React), consider copying first:- violationCounts - .sort((a, b) => ...) + [...violationCounts] + .sort((a, b) => ...)apps/backoffice-v2/src/pages/Statistics/components/PortfolioRiskStatistics/PortfolioRiskStatistics.tsx (1)
175-179
: Use the unique ID as the component key.While the new
id
parameter is used in the URL, thekey
is still tied toname
. For better React rendering stability and uniqueness guarantees, consider switching tokey={id}
.- <TableRow key={name} className={'border-b-0 hover:bg-[unset]'}> + <TableRow key={id} className={'border-b-0 hover:bg-[unset]'}>
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
apps/backoffice-v2/src/domains/business-reports/hooks/queries/useBusinessReportMetricsQuery/useBusinessReportMetricsQuery.ts
(1 hunks)apps/backoffice-v2/src/pages/Statistics/components/PortfolioRiskStatistics/PortfolioRiskStatistics.tsx
(1 hunks)apps/backoffice-v2/src/pages/Statistics/components/PortfolioRiskStatistics/hooks/usePortfolioRiskStatisticsLogic/usePortfolioRiskStatisticsLogic.tsx
(1 hunks)services/workflows-service/src/business-report/dtos/business-report-metrics-dto.ts
(1 hunks)services/workflows-service/src/business-report/merchant-monitoring-client.ts
(1 hunks)
🔇 Additional comments (3)
apps/backoffice-v2/src/domains/business-reports/hooks/queries/useBusinessReportMetricsQuery/useBusinessReportMetricsQuery.ts (1)
15-21
: Looks good and consistent with the new format.Your Zod schema accurately reflects the array structure of violations.
apps/backoffice-v2/src/pages/Statistics/components/PortfolioRiskStatistics/hooks/usePortfolioRiskStatisticsLogic/usePortfolioRiskStatisticsLogic.tsx (1)
23-23
: Accurate summation logic.Summing all
count
properties correctly computes the total risk indicators.services/workflows-service/src/business-report/merchant-monitoring-client.ts (1)
67-73
: Schema alignment looks great.Switching from a record to an array aligns well with the rest of the code changes and maintains consistency across the application.
services/workflows-service/src/business-report/dtos/business-report-metrics-dto.ts
Outdated
Show resolved
Hide resolved
services/workflows-service/src/business-report/dtos/business-report-metrics-dto.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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
🧹 Nitpick comments (1)
services/workflows-service/src/business-report/dtos/business-report-metrics-dto.ts (1)
60-71
: Enhance API documentation for ViolationCountDto properties.While the implementation is correct, consider adding more descriptive API documentation for better OpenAPI/Swagger documentation.
Apply this diff to improve the documentation:
export class ViolationCountDto { @ApiProperty({ + description: 'Unique identifier of the violation type', + example: 'PROHIBITED_CONTENT' }) @IsString() id!: string; @ApiProperty({ + description: 'Human-readable name of the violation', + example: 'Prohibited content' }) @IsString() name!: string; @ApiProperty({ + description: 'Number of occurrences of this violation', + example: 2 }) @IsNumber() count!: number; }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
services/workflows-service/src/business-report/dtos/business-report-metrics-dto.ts
(2 hunks)
🔇 Additional comments (2)
services/workflows-service/src/business-report/dtos/business-report-metrics-dto.ts (2)
2-2
: LGTM! Appropriate validation decorators imported.The added imports from class-validator are correctly chosen for validating the new array structure and its nested objects.
50-57
: Well-structured implementation with proper validation!The changes to
violationCounts
property are well-implemented:
- Clear description and example
- Proper validation using
@IsArray()
and@ValidateNested()
- Type safety with
@Type(() => ViolationCountDto)
* feat: better violation names on statistics page * fix: CodeRabbit comments --------- Co-authored-by: Alon Peretz <[email protected]>
* feat: added initial validator boilerplate & utilities & tests * feat: implmeneted validate method & tests * fix: test * feat: implemented conditional validation rule apply & custom validators * feat: implemented useValidate & tests * feat: finalized validator component * feat: added story for validator * feat: added renderer & tests & dynamic form boilerplate * feat: added rule engine * feat: implemented dynamic form context logic & tests & types * feat: finalized core form logic & finalized field list & tests * fix: tests * fix: build * feat: added input boilerplates(unfinished) & field layout & tests * feat: added fields (wip) * fix: fixed build & tests * feat: implemented events & fixed tests * feat: implemented fields extend & removed elementsMap * feat: added select field & fixed types & tests * feat: added initial demo & bugfixes & updated tests * feat: added phone field & tests & updated storybook * feat: added file field & added tests & minor fixes * feat: added clear value on input hide & updates tests * feat: fixed onMount & onUnmount events & updated tests * feat: added configurable file upload * feat: added task runner & tests * feat: implemented file upload on submit & tests * feat: added more form stories & tests update * feat: added custom validators & custom inputs examples * feat: added radio field & tests * feat: added tags input & tests & config fixes * feat: added v2 adapters for custom fields & updated exports from ui & added tests (#2913) * feat: added field descriptions & updated tests (#2914) * feat: reworked ui elements for v2 & added tests (#2930) * feat: reworked ui elements for v2 & added tests * feat: added validate on blur * feat: added initial rendering of UI V2 * feat: updated exports * feat: implemented events provider * feat: updated exports * fix: listeners reinitialize * feat: implemented document field * feat: added document validator * fix: fixed types * fix: fixed tests & typo * fix: fixed touched issue with non field definitions in form * fix: updated validation params & cleanup * fix: better violation names on statistics page (BAL-3294) (#2932) * feat: better violation names on statistics page * fix: CodeRabbit comments --------- Co-authored-by: Alon Peretz <[email protected]> * fix: renamed property in applyWhen rule * feat: added url format & refactor * Bal 3242 (#2939) * feat: fixed types & exports & verbose logging & submit event * feat: implemented plugins runner * feat: updated types & minor adjustments to format string * fix: document validator fixes & updated metadata * feat: added submit button lock while tasks running * feat: added metadata to useField & useElement & added missing format validator * feat: added ref to form & fixed types & tests * fix: fixed plugins context update & added plugin listeners * feat: updated en translations * fix: fixed kyb tests * Bal 2977 (#2942) * fix: css fixes & rule engine fixes * feat: implemented sync * feat: added classnames to row & column * fix: submit button styles * Bal 3330 (#2949) * feat: added formatting for rules & updated tests * feat: added transformer plugin * fix: lock file * feat: implemented priority fields & bug fixes & tests (#2950) * fix: fixed build * feat: implemented default data insertion on field list (#2951) * feat: added support of html tags in descriptions * feat: added useControl hook * fix: reworked revision * fix: fixed renderer stories * Bal 3356 (WIP) (#2967) * feat: implemented document field in ui package * feat: finalized documentfield * fix: fixed build * fix: cleanup * fix: fixed fieldlist * feat: updated tests * feat: added clear value for edge cases as documents * fix: fixed tests & plugins * fix: fixed fields extraction from definition * fix: fixed infinite call of useRules due to default array value * feat: enabled sync rules execution for controls disable and elements hiding * feat: reworked cleanup * feat: updated tests * fix: added handling of dynamic indexes for useRquired & bugfixes * fix: fixed types * feat: added version to ui definition & added version resolving to kyb * feat: reorganize * feat: removed v1 * fix: post merge fixes & tests & reorganized folders * fix: fixed state step tracking on submit * fix: state sync fix * fix: fixed tests * feat: ui bump * fix: fixed bug where dynamic indexes was not resolved in validation * fix: bugfixes * fix: cleanup --------- Co-authored-by: Alon Peretz <[email protected]> Co-authored-by: Sasha <[email protected]>
Changes
Note
This PR must be reviewed in conjunction with another PR opened against our private repository with Unified API.
Summary by CodeRabbit
New Features
Bug Fixes
Refactor