mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-09-30 00:28:02 -04:00
[bug] fix cache - don't use for admins
This commit is contained in:
parent
413237152a
commit
9566eee609
@ -32,7 +32,7 @@ router.get('/inclusive', handleErrorAsync(async (req, res) => {
|
|||||||
AND i.approved >= ${req.isGranted('inclusive') ? 0 : 1}
|
AND i.approved >= ${req.isGranted('inclusive') ? 0 : 1}
|
||||||
AND i.deleted = 0
|
AND i.deleted = 0
|
||||||
`), 'insteadOf');
|
`), 'insteadOf');
|
||||||
}));
|
}, !req.isGranted('inclusive')));
|
||||||
}));
|
}));
|
||||||
|
|
||||||
router.get('/inclusive/search/:term', handleErrorAsync(async (req, res) => {
|
router.get('/inclusive/search/:term', handleErrorAsync(async (req, res) => {
|
||||||
|
@ -80,7 +80,7 @@ router.get('/nouns', handleErrorAsync(async (req, res) => {
|
|||||||
AND n.approved >= ${req.isGranted('nouns') ? 0 : 1}
|
AND n.approved >= ${req.isGranted('nouns') ? 0 : 1}
|
||||||
ORDER BY n.approved, n.masc
|
ORDER BY n.approved, n.masc
|
||||||
`))
|
`))
|
||||||
}));
|
}, !req.isGranted('nouns')));
|
||||||
}));
|
}));
|
||||||
|
|
||||||
router.get('/nouns/search/:term', handleErrorAsync(async (req, res) => {
|
router.get('/nouns/search/:term', handleErrorAsync(async (req, res) => {
|
||||||
|
@ -32,7 +32,7 @@ router.get('/terms', handleErrorAsync(async (req, res) => {
|
|||||||
AND i.approved >= ${req.isGranted('terms') ? 0 : 1}
|
AND i.approved >= ${req.isGranted('terms') ? 0 : 1}
|
||||||
AND i.deleted = 0
|
AND i.deleted = 0
|
||||||
`), 'term');
|
`), 'term');
|
||||||
}));
|
}, !req.isGranted('terms')));
|
||||||
}));
|
}));
|
||||||
|
|
||||||
router.get('/terms/search/:term', handleErrorAsync(async (req, res) => {
|
router.get('/terms/search/:term', handleErrorAsync(async (req, res) => {
|
||||||
|
@ -8,8 +8,8 @@ export class CacheObject {
|
|||||||
this.maxAgeMinutes = maxAgeMinutes;
|
this.maxAgeMinutes = maxAgeMinutes;
|
||||||
}
|
}
|
||||||
|
|
||||||
async fetch(generator) {
|
async fetch(generator, enabled = true) {
|
||||||
if (process.env.NODE_ENV === 'development') {
|
if (process.env.NODE_ENV === 'development' || !enabled) {
|
||||||
return await generator();
|
return await generator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user