Added rudimentary API documentation to README.

This commit is contained in:
DebaucheryLibrarian
2020-10-17 22:54:00 +02:00
parent e6c52002f0
commit ca22aedaaa
3 changed files with 20 additions and 4 deletions

View File

@@ -166,7 +166,7 @@ async function fetchEntities(type, limit) {
}
async function searchEntities(query, type, limit) {
const entities = await knex
const entities = knex
.select(knex.raw(`
entities.*,
COALESCE(json_agg(tags) FILTER (WHERE tags.id IS NOT NULL), '[]') as tags,
@@ -184,9 +184,10 @@ async function searchEntities(query, type, limit) {
.groupBy('entities.id', 'parents.id')
.limit(limit || 100);
return curateEntities(entities);
}
console.log(entities.toString());
return curateEntities(await entities);
}
module.exports = {
curateEntity,

View File

@@ -19,7 +19,6 @@ async function fetchTagsApi(req, res) {
res.send({ tags });
}
module.exports = {
fetchTag: fetchTagApi,
fetchTags: fetchTagsApi,