diff --git a/backend/src/middleware/nodes/locations.js b/backend/src/middleware/nodes/locations.js index d7abb90ff..a90d8c0d7 100644 --- a/backend/src/middleware/nodes/locations.js +++ b/backend/src/middleware/nodes/locations.js @@ -1,9 +1,12 @@ import request from 'request' import { UserInputError } from 'apollo-server' import isEmpty from 'lodash/isEmpty' +import Debug from 'debug' import asyncForEach from '../../helpers/asyncForEach' import CONFIG from './../../config' +const debug = Debug('human-connection:location') + const fetch = url => { return new Promise((resolve, reject) => { request(url, function(error, response, body) { @@ -59,6 +62,7 @@ const createOrUpdateLocations = async (userId, locationName, driver) => { if (isEmpty(locationName)) { return } + const res = await fetch( `https://api.mapbox.com/geocoding/v5/mapbox.places/${encodeURIComponent( locationName, @@ -67,6 +71,8 @@ const createOrUpdateLocations = async (userId, locationName, driver) => { )}`, ) + debug(res) + if (!res || !res.features || !res.features[0]) { throw new UserInputError('locationName is invalid') } diff --git a/webapp/graphql/ModerationListQuery.js b/webapp/graphql/ModerationListQuery.js index 940ada6f6..221ec6177 100644 --- a/webapp/graphql/ModerationListQuery.js +++ b/webapp/graphql/ModerationListQuery.js @@ -1,7 +1,7 @@ import gql from 'graphql-tag' export default app => { - return gql(` + return gql` query { Report(first: 20, orderBy: createdAt_desc) { id @@ -30,6 +30,7 @@ export default app => { } } comment { + id contentExcerpt author { id @@ -76,5 +77,5 @@ export default app => { } } } - `) + ` } diff --git a/webapp/pages/moderation/index.vue b/webapp/pages/moderation/index.vue index e6b8532fc..9988ebc7a 100644 --- a/webapp/pages/moderation/index.vue +++ b/webapp/pages/moderation/index.vue @@ -1,8 +1,6 @@