Skip to content

Commit e00faa5

Browse files
authored
[hotfix] Slise ads endpoints enabling (#146)
Merge pull request #146 from madfish-solutions/hotfix-prod-slise
2 parents d42b77e + a16beb0 commit e00faa5

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { getNotifications } from './notifications/utils/get-notifications.util';
2020
import { getParsedContent } from './notifications/utils/get-parsed-content.util';
2121
import { getPlatforms } from './notifications/utils/get-platforms.util';
2222
import { redisClient } from './redis';
23-
// import { sliseRulesRouter } from './routers/slise-ad-rules';
23+
import { sliseRulesRouter } from './routers/slise-ad-rules';
2424
import { getABData } from './utils/ab-test';
2525
import { cancelAliceBobOrder } from './utils/alice-bob/cancel-alice-bob-order';
2626
import { createAliceBobOrder } from './utils/alice-bob/create-alice-bob-order';
@@ -328,7 +328,7 @@ app.get('/api/advertising-info', (_req, res) => {
328328
}
329329
});
330330

331-
// app.use('/api/slise-ad-rules', sliseRulesRouter);
331+
app.use('/api/slise-ad-rules', sliseRulesRouter);
332332

333333
app.post('/api/magic-square-quest/start', async (req, res) => {
334334
try {

src/routers/slise-ad-rules/providers.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
getAllSliseAdProvidersBySites,
77
getSelectorsByProviderId,
88
getSliseAdProvidersByDomain,
9-
getSliseAdProvidersForAllSites,
9+
// getSliseAdProvidersForAllSites,
1010
removeProviders,
1111
removeSliseAdProvidersBySites,
1212
removeSliseAdProvidersForAllSites,
@@ -157,9 +157,10 @@ sliseAdProvidersRouter
157157
.route('/all-sites')
158158
.get(
159159
withExceptionHandler(async (_req, res) => {
160-
const providers = await getSliseAdProvidersForAllSites();
160+
// const providers = await getSliseAdProvidersForAllSites();
161161

162-
res.status(200).send(providers);
162+
// res.status(200).send(providers);
163+
res.status(200).header('Cache-Control', 'public, max-age=300').send([]);
163164
})
164165
)
165166
.post(

src/utils/express-helpers.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export const withExceptionHandler =
4444
}
4545
};
4646

47-
export const addObjectStorageMethodsToRouter = <V>(
47+
export const addObjectStorageMethodsToRouter = <V extends any[]>(
4848
router: Router,
4949
path: string,
5050
methods: ObjectStorageMethods<V>,
@@ -56,21 +56,23 @@ export const addObjectStorageMethodsToRouter = <V>(
5656
router.get(
5757
path === '/' ? `/:${keyName}` : `${path}/:${keyName}`,
5858
withExceptionHandler(async (req, res) => {
59-
const { [keyName]: key } = req.params;
59+
// const { [keyName]: key } = req.params;
6060

61-
const value = await methods.getByKey(key);
61+
// const value = await methods.getByKey(key);
62+
const value = [];
6263

63-
res.status(200).send(value);
64+
res.status(200).header('Cache-Control', 'public, max-age=300').send(value);
6465
})
6566
);
6667

6768
router
6869
.route(path)
6970
.get(
7071
withExceptionHandler(async (_req, res) => {
71-
const values = await methods.getAllValues();
72+
// const values = await methods.getAllValues();
73+
const values = {};
7274

73-
res.status(200).send(values);
75+
res.status(200).header('Cache-Control', 'public, max-age=300').send(values);
7476
})
7577
)
7678
.post(

0 commit comments

Comments
 (0)