From 98298c43670326b4e2300a6bbdeee3daa53f0eb3 Mon Sep 17 00:00:00 2001 From: moonrailgun Date: Sun, 27 Oct 2024 03:16:06 +0800 Subject: [PATCH] refactor: update currency symbols in feed --- pnpm-lock.yaml | 9 +++++++++ src/server/package.json | 1 + src/server/trpc/routers/feed/integration.ts | 5 +++-- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ad3b84c..f3cf54c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -486,6 +486,9 @@ importers: dotenv: specifier: ^16.3.1 version: 16.3.1 + easy-currency-symbol: + specifier: ^1.0.1 + version: 1.0.1 express: specifier: ^4.18.2 version: 4.18.2 @@ -6204,6 +6207,9 @@ packages: eastasianwidth@0.2.0: resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==} + easy-currency-symbol@1.0.1: + resolution: {integrity: sha512-M8ugWXSnV5utVTJd4uLOsXqg/sv8Ca7yrDvbSy01mQ52u2XxNnoJ0+tenh3gYCvcceRRLkG/AzIVP/rdjKGuAg==} + ecdsa-sig-formatter@1.0.11: resolution: {integrity: sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==} @@ -10321,6 +10327,7 @@ packages: react-beautiful-dnd@13.1.1: resolution: {integrity: sha512-0Lvs4tq2VcrEjEgDXHjT98r+63drkKEgqyxdA7qD3mvKwga6a5SscbdLPO2IExotU1jW8L0Ksdl0Cj2AF67nPQ==} + deprecated: 'react-beautiful-dnd is now deprecated. Context and options: https://github.com/atlassian/react-beautiful-dnd/issues/2672' peerDependencies: react: ^16.8.5 || ^17.0.0 || ^18.0.0 react-dom: ^16.8.5 || ^17.0.0 || ^18.0.0 @@ -20325,6 +20332,8 @@ snapshots: eastasianwidth@0.2.0: {} + easy-currency-symbol@1.0.1: {} + ecdsa-sig-formatter@1.0.11: dependencies: safe-buffer: 5.2.1 diff --git a/src/server/package.json b/src/server/package.json index 443a2c4..65317a6 100644 --- a/src/server/package.json +++ b/src/server/package.json @@ -42,6 +42,7 @@ "dayjs": "^1.11.9", "detect-browser": "^5.3.0", "dotenv": "^16.3.1", + "easy-currency-symbol": "^1.0.1", "express": "^4.18.2", "express-async-errors": "^3.1.1", "express-validator": "^7.0.1", diff --git a/src/server/trpc/routers/feed/integration.ts b/src/server/trpc/routers/feed/integration.ts index 90f8514..d8c1b37 100644 --- a/src/server/trpc/routers/feed/integration.ts +++ b/src/server/trpc/routers/feed/integration.ts @@ -8,6 +8,7 @@ import { tencentCloudAlarmSchema } from '../../../model/_schema/feed.js'; import { logger } from '../../../utils/logger.js'; import { compact, fromPairs, get, map, uniqueId } from 'lodash-es'; import { subscribeEventBus } from '../../../ws/shared.js'; +import { currencyToSymbol } from 'easy-currency-symbol'; export const feedIntegrationRouter = router({ playground: publicProcedure @@ -232,7 +233,7 @@ export const feedIntegrationRouter = router({ await createFeedEvent(workspaceId, { channelId: channelId, eventName: type, - eventContent: `You receive a payment of ${currency} **${amount}**`, + eventContent: `You receive a payment of ${currencyToSymbol(currency)}**${amount}**`, tags: [], source: 'stripe', senderId: eventId, @@ -252,7 +253,7 @@ export const feedIntegrationRouter = router({ await createFeedEvent(workspaceId, { channelId: channelId, eventName: type, - eventContent: `A payment has been canceled of ${currency} **${amount}**`, + eventContent: `A payment has been canceled of ${currencyToSymbol(currency)}**${amount}**`, tags: [], source: 'stripe', senderId: eventId,