Added prefixes for studio and info types, fixing studio identified as channel from URL.
This commit is contained in:
parent
0fdb9559f9
commit
38c7487ccc
|
@ -4,6 +4,13 @@ import initLogger from './logger.js';
|
|||
|
||||
const logger = initLogger();
|
||||
|
||||
const entityPrefixes = {
|
||||
channel: '',
|
||||
network: '_',
|
||||
studio: '*',
|
||||
info: '@',
|
||||
};
|
||||
|
||||
export function curateEntity(entity, context) {
|
||||
if (!entity) {
|
||||
return null;
|
||||
|
@ -136,7 +143,7 @@ export async function cacheEntityIds() {
|
|||
const entities = await knex('entities').select('id', 'slug', 'type');
|
||||
|
||||
await redis.del('traxxx:entities:id_by_slug');
|
||||
await redis.hSet('traxxx:entities:id_by_slug', entities.map((entity) => [entity.type === 'network' ? `_${entity.slug}` : entity.slug, entity.id]));
|
||||
await redis.hSet('traxxx:entities:id_by_slug', entities.map((entity) => [`${entityPrefixes[entity.type]}${entity.slug}`, entity.id]));
|
||||
|
||||
logger.info('Cached entity IDs by slug');
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue