Allowing entity to be fetched by alias.
This commit is contained in:
@@ -20,6 +20,7 @@ function curateEntity(entity, includeParameters = false) {
|
||||
description: entity.description,
|
||||
slug: entity.slug,
|
||||
type: entity.type,
|
||||
aliases: entity.alias,
|
||||
parent: curateEntity(entity.parent, includeParameters),
|
||||
} : {};
|
||||
|
||||
@@ -132,8 +133,9 @@ async function fetchEntity(entityId, type) {
|
||||
|
||||
if (type) {
|
||||
queryBuilder
|
||||
.where('entities.type', type)
|
||||
.where('entities.slug', entityId)
|
||||
.where('entities.type', type);
|
||||
.orWhere(knex.raw(':entityId = ANY(entities.alias)', { entityId }));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user