diff --git a/apps/server/src/api/v2/currency/index.ts b/apps/server/src/api/v2/currency/index.ts deleted file mode 100644 index b431ef09b..000000000 --- a/apps/server/src/api/v2/currency/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -import type { Currency, CurrencyResponse } from '@buster/server-shared/currency'; -import { Hono } from 'hono'; -import { requireAuth } from '../../../middleware/auth'; -import { CURRENCIES_MAP } from './config'; - -const app = new Hono(); - -app.use('*', requireAuth).get('/', async (c) => { - return c.json(CURRENCIES_MAP); -}); - -export default app; diff --git a/apps/server/src/api/v2/currency/config.ts b/apps/server/src/api/v2/dictionaries/currency/config.ts similarity index 100% rename from apps/server/src/api/v2/currency/config.ts rename to apps/server/src/api/v2/dictionaries/currency/config.ts diff --git a/apps/server/src/api/v2/dictionaries/currency/index.ts b/apps/server/src/api/v2/dictionaries/currency/index.ts new file mode 100644 index 000000000..362e70599 --- /dev/null +++ b/apps/server/src/api/v2/dictionaries/currency/index.ts @@ -0,0 +1,12 @@ +import type { CurrencyResponse } from '@buster/server-shared/currency'; +import { Hono } from 'hono'; +import { CURRENCIES_MAP } from './config'; + +const app = new Hono(); + +app.get('/', async (c) => { + const response: CurrencyResponse = CURRENCIES_MAP; + return c.json(response); +}); + +export default app; diff --git a/apps/server/src/api/v2/dictionaries/index.ts b/apps/server/src/api/v2/dictionaries/index.ts index 48bf4be39..0b0522415 100644 --- a/apps/server/src/api/v2/dictionaries/index.ts +++ b/apps/server/src/api/v2/dictionaries/index.ts @@ -1,7 +1,10 @@ import { Hono } from 'hono'; import { requireAuth } from '../../../middleware/auth'; import colorThemesRoutes from './color-themes'; +import currencyRoutes from './currency'; const app = new Hono(); -export default app.use('*', requireAuth).route('/color-themes', colorThemesRoutes); +export default app.use('*', requireAuth) + .route('/color-themes', colorThemesRoutes) + .route('/currency', currencyRoutes); diff --git a/apps/server/src/api/v2/index.ts b/apps/server/src/api/v2/index.ts index 10c139882..c73a3a3e7 100644 --- a/apps/server/src/api/v2/index.ts +++ b/apps/server/src/api/v2/index.ts @@ -2,7 +2,6 @@ import { Hono } from 'hono'; import healthcheckRoutes from '../healthcheck'; import chatsRoutes from './chats'; -import currencyRoutes from './currency'; import dictionariesRoutes from './dictionaries'; import electricShapeRoutes from './electric-shape'; import organizationRoutes from './organization'; @@ -17,7 +16,6 @@ const app = new Hono() .route('/healthcheck', healthcheckRoutes) .route('/chats', chatsRoutes) .route('/slack', slackRoutes) - .route('/currency', currencyRoutes) .route('/support', supportRoutes) .route('/security', securityRoutes) .route('/organizations', organizationRoutes) diff --git a/apps/web/src/api/buster_rest/currency/queryRequests.ts b/apps/web/src/api/buster_rest/currency/queryRequests.ts index b88e9a84f..d50739d4a 100644 --- a/apps/web/src/api/buster_rest/currency/queryRequests.ts +++ b/apps/web/src/api/buster_rest/currency/queryRequests.ts @@ -7,7 +7,7 @@ export const useGetCurrencies = () => { return useQuery({ ...queryKeys.getCurrencies, queryFn: async () => { - return mainApiV2.get('/currency').then(async (res) => res.data); + return mainApiV2.get('/dictionaries/currency').then(async (res) => res.data); } }); }; @@ -18,7 +18,7 @@ export const prefetchGetCurrencies = async (queryClientProp?: QueryClient) => { await queryClient.prefetchQuery({ ...queryKeys.getCurrencies, queryFn: async () => { - return mainApiV2.get('/currency').then(async (res) => res.data); + return mainApiV2.get('/dictionaries/currency').then(async (res) => res.data); } });