Refine 'createOrUpdateLocations' call and import

This commit is contained in:
Wolfgang Huß 2022-09-17 08:32:11 +02:00
parent a4575f3ad0
commit 728eac98ac
3 changed files with 6 additions and 8 deletions

View File

@ -9,7 +9,7 @@ import Resolver, {
convertObjectToCypherMapLiteral,
} from './helpers/Resolver'
import { mergeImage } from './images/images'
import createOrUpdateLocations from './users/location'
import { createOrUpdateLocations } from './users/location'
export default {
Query: {
@ -137,7 +137,7 @@ export default {
})
try {
const group = await writeTxResultPromise
await createOrUpdateLocations(params.id, 'Group', params.locationName, session)
await createOrUpdateLocations('Group', params.id, params.locationName, session)
return group
} catch (error) {
if (error.code === 'Neo.ClientError.Schema.ConstraintValidationFailed')
@ -210,7 +210,7 @@ export default {
})
try {
const group = await writeTxResultPromise
await createOrUpdateLocations(params.id, 'Group', params.locationName, session)
await createOrUpdateLocations('Group', params.id, params.locationName, session)
return group
} catch (error) {
if (error.code === 'Neo.ClientError.Schema.ConstraintValidationFailed')

View File

@ -4,7 +4,7 @@ import { UserInputError, ForbiddenError } from 'apollo-server'
import { mergeImage, deleteImage } from './images/images'
import Resolver from './helpers/Resolver'
import log from './helpers/databaseLogger'
import createOrUpdateLocations from './users/location'
import { createOrUpdateLocations } from './users/location'
const neode = getNeode()
@ -169,7 +169,7 @@ export default {
})
try {
const user = await writeTxResultPromise
await createOrUpdateLocations(params.id, 'User', params.locationName, session)
await createOrUpdateLocations('User', params.id, params.locationName, session)
return user
} catch (error) {
throw new UserInputError(error.message)

View File

@ -62,7 +62,7 @@ const createLocation = async (session, mapboxData) => {
})
}
const createOrUpdateLocations = async (nodeId, nodeLabel, locationName, session) => {
export const createOrUpdateLocations = async (nodeLabel, nodeId, locationName, session) => {
if (isEmpty(locationName)) {
return
}
@ -148,5 +148,3 @@ export const queryLocations = async ({ place, lang }) => {
}
return res.features
}
export default createOrUpdateLocations