Expanded GraphQL API with scenes entities and actors.
This commit is contained in:
@@ -35,7 +35,7 @@ export function curateEntity(entity, context) {
|
||||
};
|
||||
}
|
||||
|
||||
export async function fetchEntities(options) {
|
||||
export async function fetchEntities(options = {}) {
|
||||
const entities = await knex('entities')
|
||||
.select('entities.*', knex.raw('row_to_json(parents) as parent'))
|
||||
.modify((builder) => {
|
||||
@@ -74,6 +74,7 @@ export async function fetchEntities(options) {
|
||||
})
|
||||
.leftJoin('entities as parents', 'parents.id', 'entities.parent_id')
|
||||
.orderBy(...(options.order || ['name', 'asc']))
|
||||
.offset((options.page - 1) * options.limit)
|
||||
.limit(options.limit || 1000);
|
||||
|
||||
return entities.map((entityEntry) => curateEntity(entityEntry));
|
||||
|
||||
Reference in New Issue
Block a user