From 0fdef002ed9bfa909e6a0401e6e9b92a4efeadba Mon Sep 17 00:00:00 2001 From: vchikalkin Date: Mon, 4 Mar 2024 15:44:43 +0300 Subject: [PATCH] apps: rename flush-all to reset-queries --- apps/api/src/proxy/proxy.controller.ts | 4 ++-- apps/web/api/cache/query.ts | 6 +++--- apps/web/config/schema/env.js | 2 +- apps/web/config/schema/runtime-config.js | 2 +- apps/web/config/urls.ts | 6 +++--- apps/web/constants/urls.js | 2 +- apps/web/next.config.js | 4 ++-- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/apps/api/src/proxy/proxy.controller.ts b/apps/api/src/proxy/proxy.controller.ts index c484806..96ee57f 100644 --- a/apps/api/src/proxy/proxy.controller.ts +++ b/apps/api/src/proxy/proxy.controller.ts @@ -92,8 +92,8 @@ export class ProxyController { } } - @Delete('/flush-all') - public async flushAll(@Res() reply: FastifyReply) { + @Delete('/reset') + public async reset(@Res() reply: FastifyReply) { try { await this.cacheManager.reset(); diff --git a/apps/web/api/cache/query.ts b/apps/web/api/cache/query.ts index 713a1c1..e4d77b9 100644 --- a/apps/web/api/cache/query.ts +++ b/apps/web/api/cache/query.ts @@ -4,7 +4,7 @@ import { withHandleError } from '@/utils/axios'; import type { QueryFunctionContext } from '@tanstack/react-query'; import axios from 'axios'; -const { URL_CACHE_GET_QUERIES, URL_CACHE_DELETE_QUERY, URL_CACHE_FLUSH_ALL } = getUrls(); +const { URL_CACHE_GET_QUERIES, URL_CACHE_DELETE_QUERY, URL_CACHE_RESET_QUERIES } = getUrls(); export function getQueries({ signal }: QueryFunctionContext) { return withHandleError(axios.get(URL_CACHE_GET_QUERIES, { signal })).then( @@ -22,6 +22,6 @@ export function deleteQuery(queryName: string) { ).then(({ data }) => data); } -export function flushAll() { - return withHandleError(axios.delete(URL_CACHE_FLUSH_ALL)).then(({ data }) => data); +export function reset() { + return withHandleError(axios.delete(URL_CACHE_RESET_QUERIES)).then(({ data }) => data); } diff --git a/apps/web/config/schema/env.js b/apps/web/config/schema/env.js index 7f67d98..b97e315 100644 --- a/apps/web/config/schema/env.js +++ b/apps/web/config/schema/env.js @@ -8,7 +8,7 @@ const envSchema = z.object({ SENTRY_ENVIRONMENT: z.string(), URL_1C_TRANSTAX_DIRECT: z.string(), URL_CACHE_DELETE_QUERY_DIRECT: z.string(), - URL_CACHE_FLUSH_ALL_DIRECT: z.string(), + URL_CACHE_RESET_QUERIES_DIRECT: z.string(), URL_CACHE_GET_QUERIES_DIRECT: z.string(), URL_CORE_CALCULATE_DIRECT: z.string(), URL_CORE_FINGAP_DIRECT: z.string(), diff --git a/apps/web/config/schema/runtime-config.js b/apps/web/config/schema/runtime-config.js index 285d1e3..e3bc44b 100644 --- a/apps/web/config/schema/runtime-config.js +++ b/apps/web/config/schema/runtime-config.js @@ -14,7 +14,7 @@ const serverRuntimeConfigSchema = envSchema.pick({ SENTRY_ENVIRONMENT: true, URL_1C_TRANSTAX_DIRECT: true, URL_CACHE_DELETE_QUERY_DIRECT: true, - URL_CACHE_FLUSH_ALL_DIRECT: true, + URL_CACHE_RESET_QUERIES_DIRECT: true, URL_CACHE_GET_QUERIES_DIRECT: true, URL_CORE_CALCULATE_DIRECT: true, URL_CORE_FINGAP_DIRECT: true, diff --git a/apps/web/config/urls.ts b/apps/web/config/urls.ts index 8011969..a30ab0b 100644 --- a/apps/web/config/urls.ts +++ b/apps/web/config/urls.ts @@ -24,7 +24,7 @@ function getUrls() { URL_CRM_GRAPHQL_PROXY, URL_CACHE_GET_QUERIES_DIRECT, URL_CACHE_DELETE_QUERY_DIRECT, - URL_CACHE_FLUSH_ALL_DIRECT, + URL_CACHE_RESET_QUERIES_DIRECT, } = serverRuntimeConfigSchema.parse(serverRuntimeConfig); return { @@ -33,8 +33,8 @@ function getUrls() { SENTRY_DSN, URL_1C_TRANSTAX: URL_1C_TRANSTAX_DIRECT, URL_CACHE_DELETE_QUERY: URL_CACHE_DELETE_QUERY_DIRECT, - URL_CACHE_FLUSH_ALL: URL_CACHE_FLUSH_ALL_DIRECT, URL_CACHE_GET_QUERIES: URL_CACHE_GET_QUERIES_DIRECT, + URL_CACHE_RESET_QUERIES: URL_CACHE_RESET_QUERIES_DIRECT, URL_CORE_CALCULATE: URL_CORE_CALCULATE_DIRECT, URL_CORE_FINGAP: URL_CORE_FINGAP_DIRECT, URL_CRM_CREATEKP: URL_CRM_CREATEKP_DIRECT, @@ -51,8 +51,8 @@ function getUrls() { SENTRY_DSN, URL_1C_TRANSTAX: withBasePath(urls.URL_1C_TRANSTAX_PROXY), URL_CACHE_DELETE_QUERY: withBasePath(urls.URL_CACHE_DELETE_QUERY_PROXY), - URL_CACHE_FLUSH_ALL: withBasePath(urls.URL_CACHE_FLUSH_ALL_PROXY), URL_CACHE_GET_QUERIES: withBasePath(urls.URL_CACHE_GET_QUERIES_PROXY), + URL_CACHE_RESET_QUERIES: withBasePath(urls.URL_CACHE_RESET_QUERIES_PROXY), URL_CORE_CALCULATE: withBasePath(urls.URL_CORE_CALCULATE_PROXY), URL_CORE_FINGAP: withBasePath(urls.URL_CORE_FINGAP_PROXY), URL_CRM_CREATEKP: withBasePath(urls.URL_CRM_CREATEKP_PROXY), diff --git a/apps/web/constants/urls.js b/apps/web/constants/urls.js index 5a849c5..a6ee6a3 100644 --- a/apps/web/constants/urls.js +++ b/apps/web/constants/urls.js @@ -1,7 +1,7 @@ module.exports = { URL_1C_TRANSTAX_PROXY: '/api/1c/transtax', URL_CACHE_DELETE_QUERY_PROXY: '/api/admin/cache/delete', - URL_CACHE_FLUSH_ALL_PROXY: '/api/admin/cache/flush-all', + URL_CACHE_RESET_QUERIES_PROXY: '/api/admin/cache/reset', URL_CACHE_GET_QUERIES_PROXY: '/api/admin/cache/queries', URL_CORE_CALCULATE_PROXY: '/api/core/calculate', URL_CORE_FINGAP_PROXY: '/api/core/fingap', diff --git a/apps/web/next.config.js b/apps/web/next.config.js index 8e7fec3..90fb84c 100644 --- a/apps/web/next.config.js +++ b/apps/web/next.config.js @@ -75,8 +75,8 @@ module.exports = withSentryConfig( source: urls.URL_CACHE_DELETE_QUERY_PROXY + '/:path*', }, { - destination: env.URL_CACHE_FLUSH_ALL_DIRECT, - source: urls.URL_CACHE_FLUSH_ALL_PROXY, + destination: env.URL_CACHE_RESET_QUERIES_DIRECT, + source: urls.URL_CACHE_RESET_QUERIES_PROXY, }, ...favicons.map((fileName) => buildFaviconRewrite(`/${fileName}`)),