mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Refine 'createOrUpdateLocations' call and import
This commit is contained in:
parent
a4575f3ad0
commit
728eac98ac
@ -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')
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user