Skip to content

Commit

Permalink
Notify Clients on Credit Limit Reached (#2997)
Browse files Browse the repository at this point in the history
* chore: error message change

* fix: use displayDate instead of createdAt
  • Loading branch information
MatanYadaev authored Jan 28, 2025
1 parent 0e018fe commit 4121a89
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export const BusinessReportSchema = z
reportType: z.enum([MERCHANT_REPORT_TYPES[0]!, ...MERCHANT_REPORT_TYPES.slice(1)]),
createdAt: z.string().datetime(),
updatedAt: z.string().datetime(),
displayDate: z.string().datetime(),
riskScore: z.number().nullable(),
status: z.enum([MERCHANT_REPORT_STATUSES[0]!, ...MERCHANT_REPORT_STATUSES.slice(1)]),
parentCompanyName: z.string().nullable(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,16 +153,12 @@ export const columns = [
},
header: 'Alert',
}),
columnHelper.accessor('createdAt', {
columnHelper.accessor('displayDate', {
cell: info => {
const createdAt = info.getValue();

if (!createdAt) {
return <TextWithNAFallback>{createdAt}</TextWithNAFallback>;
}
const displayDate = info.getValue();

// Convert UTC time to local browser time
const localDateTime = dayjs.utc(createdAt).local();
const localDateTime = dayjs.utc(displayDate).local();

const date = localDateTime.format('MMM DD, YYYY');
const time = localDateTime.format('HH:mm');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,8 @@ export const MerchantMonitoringBusinessReport: FunctionComponent = () => {
</div>
<div className={`text-sm`}>
<span className={`me-2 leading-6 text-slate-400`}>Created at</span>
{businessReport?.createdAt &&
dayjs(new Date(businessReport?.createdAt)).format('HH:mm MMM Do, YYYY')}
{businessReport?.displayDate &&
dayjs(new Date(businessReport?.displayDate)).format('HH:mm MMM Do, YYYY')}
</div>
<div className={`flex items-center space-x-2 text-sm`}>
<span className={`text-slate-400`}>Monitoring Status</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class BusinessReportService {

if (businessReportsCount >= maxBusinessReports) {
throw new BadRequestException(
`You have reached the maximum number of business reports allowed (${maxBusinessReports}).`,
`You've hit your reports limit. Talk to us to unlock additional features and continue effective risk management with Ballerine.`,
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ const ReportSchema = z.object({
.string()
.datetime()
.transform(value => new Date(value)),
displayDate: z
.string()
.datetime()
.transform(value => new Date(value)),
data: z.record(z.string(), z.unknown()).nullish(),
});

Expand Down

0 comments on commit 4121a89

Please sign in to comment.