apps/web: add proxy admin urls
This commit is contained in:
parent
6ef2c7ea0f
commit
b6512e702f
@ -97,7 +97,7 @@ export class ProxyController {
|
||||
@Delete('flush-all')
|
||||
public async flushAll(@Res() reply: FastifyReply) {
|
||||
try {
|
||||
await this.cacheManager.store.reset();
|
||||
await this.cacheManager.reset();
|
||||
|
||||
return reply.send('ok');
|
||||
} catch (error) {
|
||||
|
||||
24
apps/web/api/cache/query.ts
vendored
Normal file
24
apps/web/api/cache/query.ts
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
import getUrls from '@/config/urls';
|
||||
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();
|
||||
|
||||
export function getQueries({ signal }: QueryFunctionContext) {
|
||||
return withHandleError(axios.get(URL_CACHE_GET_QUERIES, { signal })).then(({ data }) => data);
|
||||
}
|
||||
|
||||
export function deleteQuery(queryName: string) {
|
||||
return withHandleError(
|
||||
axios.delete(URL_CACHE_DELETE_QUERY, {
|
||||
params: {
|
||||
queryName,
|
||||
},
|
||||
})
|
||||
).then(({ data }) => data);
|
||||
}
|
||||
|
||||
export function flushAll() {
|
||||
return withHandleError(axios.delete(URL_CACHE_FLUSH_ALL)).then(({ data }) => data);
|
||||
}
|
||||
@ -7,6 +7,9 @@ const envSchema = z.object({
|
||||
SENTRY_DSN: z.string(),
|
||||
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_GET_QUERIES_DIRECT: z.string(),
|
||||
URL_CORE_CALCULATE_DIRECT: z.string(),
|
||||
URL_CORE_FINGAP_DIRECT: z.string(),
|
||||
URL_CRM_CREATEKP_DIRECT: z.string(),
|
||||
|
||||
@ -13,6 +13,9 @@ const serverRuntimeConfigSchema = envSchema.pick({
|
||||
SENTRY_DSN: true,
|
||||
SENTRY_ENVIRONMENT: true,
|
||||
URL_1C_TRANSTAX_DIRECT: true,
|
||||
URL_CACHE_DELETE_QUERY_DIRECT: true,
|
||||
URL_CACHE_FLUSH_ALL_DIRECT: true,
|
||||
URL_CACHE_GET_QUERIES_DIRECT: true,
|
||||
URL_CORE_CALCULATE_DIRECT: true,
|
||||
URL_CORE_FINGAP_DIRECT: true,
|
||||
URL_CRM_CREATEKP_DIRECT: true,
|
||||
|
||||
@ -22,6 +22,9 @@ function getUrls() {
|
||||
URL_ELT_KASKO_DIRECT,
|
||||
URL_ELT_OSAGO_DIRECT,
|
||||
URL_CRM_GRAPHQL_PROXY,
|
||||
URL_CACHE_GET_QUERIES_DIRECT,
|
||||
URL_CACHE_DELETE_QUERY_DIRECT,
|
||||
URL_CACHE_FLUSH_ALL_DIRECT,
|
||||
} = serverRuntimeConfigSchema.parse(serverRuntimeConfig);
|
||||
|
||||
return {
|
||||
@ -29,6 +32,9 @@ function getUrls() {
|
||||
PORT,
|
||||
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_CORE_CALCULATE: URL_CORE_CALCULATE_DIRECT,
|
||||
URL_CORE_FINGAP: URL_CORE_FINGAP_DIRECT,
|
||||
URL_CRM_CREATEKP: URL_CRM_CREATEKP_DIRECT,
|
||||
@ -44,6 +50,9 @@ function getUrls() {
|
||||
BASE_PATH,
|
||||
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_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),
|
||||
|
||||
@ -1,5 +1,8 @@
|
||||
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_GET_QUERIES_PROXY: '/api/admin/cache/queries',
|
||||
URL_CORE_CALCULATE_PROXY: '/api/core/calculate',
|
||||
URL_CORE_FINGAP_PROXY: '/api/core/fingap',
|
||||
URL_CRM_CREATEKP_PROXY: '/api/crm/create-kp',
|
||||
|
||||
@ -66,6 +66,19 @@ module.exports = withSentryConfig(
|
||||
destination: env.URL_ELT_OSAGO_DIRECT,
|
||||
source: urls.URL_ELT_OSAGO_PROXY,
|
||||
},
|
||||
{
|
||||
destination: env.URL_CACHE_GET_QUERIES_DIRECT,
|
||||
source: urls.URL_CACHE_GET_QUERIES_PROXY,
|
||||
},
|
||||
{
|
||||
destination: env.URL_CACHE_DELETE_QUERY_DIRECT + '/:path*',
|
||||
source: urls.URL_CACHE_DELETE_QUERY_PROXY + '/:path*',
|
||||
},
|
||||
{
|
||||
destination: env.URL_CACHE_FLUSH_ALL_DIRECT,
|
||||
source: urls.URL_CACHE_FLUSH_ALL_PROXY,
|
||||
},
|
||||
|
||||
...favicons.map((fileName) => buildFaviconRewrite(`/${fileName}`)),
|
||||
];
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user