File size: 469 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//@flow
const { db } = require('shared/db');
import type { DBCommunity } from 'shared/types';
import { getCommunitiesBySlug } from './community';

// prettier-ignore
export const getCuratedCommunities = (type: string): Promise<Array<DBCommunity>> => {
  return db
    .table('curatedContent')
    .filter({ type })
    .run()
    .then(results => (results && results.length > 0 ? results[0] : null))
    .then(result => result && getCommunitiesBySlug(result.data));
};