From 97aa6892885469bdf05752d812e83b67cd121e58 Mon Sep 17 00:00:00 2001 From: Inokentii Mazhara Date: Wed, 21 Feb 2024 10:01:16 +0200 Subject: [PATCH] [Hotfix] Restore ads with already implemented Cache-Control --- src/routers/slise-ad-rules/providers.ts | 7 +++---- src/utils/express-helpers.ts | 8 +++----- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/routers/slise-ad-rules/providers.ts b/src/routers/slise-ad-rules/providers.ts index f5fe297..19f8978 100644 --- a/src/routers/slise-ad-rules/providers.ts +++ b/src/routers/slise-ad-rules/providers.ts @@ -6,7 +6,7 @@ import { getAllSliseAdProvidersBySites, getSelectorsByProviderId, getSliseAdProvidersByDomain, - // getSliseAdProvidersForAllSites, + getSliseAdProvidersForAllSites, removeProviders, removeSliseAdProvidersBySites, removeSliseAdProvidersForAllSites, @@ -157,10 +157,9 @@ sliseAdProvidersRouter .route('/all-sites') .get( withExceptionHandler(async (_req, res) => { - // const providers = await getSliseAdProvidersForAllSites(); + const providers = await getSliseAdProvidersForAllSites(); - // res.status(200).send(providers); - res.status(200).header('Cache-Control', 'public, max-age=300').send([]); + res.status(200).header('Cache-Control', 'public, max-age=300').send(providers); }) ) .post( diff --git a/src/utils/express-helpers.ts b/src/utils/express-helpers.ts index 34f1745..7d39b6a 100644 --- a/src/utils/express-helpers.ts +++ b/src/utils/express-helpers.ts @@ -56,10 +56,9 @@ export const addObjectStorageMethodsToRouter = ( router.get( path === '/' ? `/:${keyName}` : `${path}/:${keyName}`, withExceptionHandler(async (req, res) => { - // const { [keyName]: key } = req.params; + const { [keyName]: key } = req.params; - // const value = await methods.getByKey(key); - const value = []; + const value = await methods.getByKey(key); res.status(200).header('Cache-Control', 'public, max-age=300').send(value); }) @@ -69,8 +68,7 @@ export const addObjectStorageMethodsToRouter = ( .route(path) .get( withExceptionHandler(async (_req, res) => { - // const values = await methods.getAllValues(); - const values = {}; + const values = await methods.getAllValues(); res.status(200).header('Cache-Control', 'public, max-age=300').send(values); })