Improved site and network pages. Fixed various issues.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
const knex = require('./knex');
|
||||
const whereOr = require('./utils/where-or');
|
||||
|
||||
async function curateSite(site) {
|
||||
return {
|
||||
@@ -22,10 +23,9 @@ function curateSites(sites) {
|
||||
return Promise.all(sites.map(async site => curateSite(site)));
|
||||
}
|
||||
|
||||
async function fetchSites(siteId, siteSlug) {
|
||||
async function fetchSites(query) {
|
||||
const sites = await knex('sites')
|
||||
.where({ 'sites.id': siteId })
|
||||
.orWhere({ 'sites.slug': siteSlug })
|
||||
.where(builder => whereOr(query, builder))
|
||||
.select(
|
||||
'sites.*',
|
||||
'networks.name as network_name', 'networks.slug as network_slug', 'networks.url as network_url',
|
||||
|
||||
Reference in New Issue
Block a user