fix: resolver returned undefined for nameRU

This registers the language Russian in the backend. Unfortunately, the
locations seem to be implemented with a hard coded attribute for each
language. 😞

We should refactor this.
This commit is contained in:
roschaefer 2019-11-04 18:52:34 +01:00
parent 60c2bba271
commit a704709ba3
4 changed files with 10 additions and 1 deletions

View File

@ -19,7 +19,7 @@ const fetch = url => {
})
}
const locales = ['en', 'de', 'fr', 'nl', 'it', 'es', 'pt', 'pl']
const locales = ['en', 'de', 'fr', 'nl', 'it', 'es', 'pt', 'pl', 'ru']
const createLocation = async (session, mapboxData) => {
const data = {
@ -32,6 +32,7 @@ const createLocation = async (session, mapboxData) => {
nameES: mapboxData.text_es,
namePT: mapboxData.text_pt,
namePL: mapboxData.text_pl,
nameRU: mapboxData.text_ru,
type: mapboxData.id.split('.')[0].toLowerCase(),
lat: mapboxData.center && mapboxData.center.length ? mapboxData.center[0] : null,
lng: mapboxData.center && mapboxData.center.length ? mapboxData.center[1] : null,
@ -48,6 +49,7 @@ const createLocation = async (session, mapboxData) => {
'l.nameES = $nameES, ' +
'l.namePT = $namePT, ' +
'l.namePL = $namePL, ' +
'l.nameRU = $nameRU, ' +
'l.type = $type'
if (data.lat && data.lng) {

View File

@ -12,6 +12,7 @@ module.exports = {
nameDE: { type: 'string' },
nameNL: { type: 'string' },
namePL: { type: 'string' },
nameRU: { type: 'string' },
isIn: {
type: 'relationship',
relationship: 'IS_IN',

View File

@ -9,6 +9,7 @@ type Location {
nameES: String
namePT: String
namePL: String
nameRU: String
type: String!
lat: Float
lng: Float

View File

@ -39,6 +39,7 @@ import { gql } from '../jest/helpers'
nameDE: 'Hamburg',
nameNL: 'Hamburg',
namePL: 'Hamburg',
nameRU: 'Гамбург',
}),
factory.create('Location', {
id: 'region.14880313158564380',
@ -54,6 +55,7 @@ import { gql } from '../jest/helpers'
nameDE: 'Berlin',
nameNL: 'Berlijn',
namePL: 'Berlin',
nameRU: 'Берлин',
}),
factory.create('Location', {
id: 'country.10743216036480410',
@ -67,6 +69,7 @@ import { gql } from '../jest/helpers'
nameFR: 'Allemagne',
nameIT: 'Germania',
nameEN: 'Germany',
nameRU: 'Германия',
}),
factory.create('Location', {
id: 'region.9397217726497330',
@ -82,6 +85,7 @@ import { gql } from '../jest/helpers'
nameDE: 'Paris',
nameNL: 'Parijs',
namePL: 'Paryż',
nameRU: 'Париж',
}),
factory.create('Location', {
id: 'country.9759535382641660',
@ -95,6 +99,7 @@ import { gql } from '../jest/helpers'
nameFR: 'France',
nameIT: 'Francia',
nameEN: 'France',
nameRU: 'Франция',
}),
])
await Promise.all([