Added boob and country aggregation to actors page.
This commit is contained in:
15
src/countries.js
Normal file
15
src/countries.js
Normal file
@@ -0,0 +1,15 @@
|
||||
import knex from './knex.js';
|
||||
|
||||
function curateCountry(countryEntry) {
|
||||
return {
|
||||
name: countryEntry.name,
|
||||
alpha2: countryEntry.alpha2,
|
||||
code: countryEntry.code,
|
||||
};
|
||||
}
|
||||
|
||||
export async function fetchCountriesByAlpha2(alpha2s) {
|
||||
const entries = await knex('countries').whereIn('alpha2', alpha2s);
|
||||
|
||||
return entries.map((entry) => curateCountry(entry));
|
||||
}
|
||||
Reference in New Issue
Block a user