mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Implement 'locationName', 'location' in 'CreateGroup', 'UpdateGroup', and 'Group' resolvers
This commit is contained in:
parent
9396a61ec0
commit
d32c137cff
@ -9,6 +9,7 @@ import Resolver, {
|
||||
convertObjectToCypherMapLiteral,
|
||||
} from './helpers/Resolver'
|
||||
import { mergeImage } from './images/images'
|
||||
import createOrUpdateLocations from './users/location'
|
||||
|
||||
export default {
|
||||
Query: {
|
||||
@ -135,7 +136,9 @@ export default {
|
||||
return group
|
||||
})
|
||||
try {
|
||||
return await writeTxResultPromise
|
||||
const group = await writeTxResultPromise
|
||||
await createOrUpdateLocations(params.id, params.locationName, session)
|
||||
return group
|
||||
} catch (error) {
|
||||
if (error.code === 'Neo.ClientError.Schema.ConstraintValidationFailed')
|
||||
throw new UserInputError('Group with this slug already exists!')
|
||||
@ -206,7 +209,9 @@ export default {
|
||||
return group
|
||||
})
|
||||
try {
|
||||
return await writeTxResultPromise
|
||||
const group = await writeTxResultPromise
|
||||
await createOrUpdateLocations(params.id, params.locationName, session)
|
||||
return group
|
||||
} catch (error) {
|
||||
if (error.code === 'Neo.ClientError.Schema.ConstraintValidationFailed')
|
||||
throw new UserInputError('Group with this slug already exists!')
|
||||
@ -300,11 +305,13 @@ export default {
|
||||
},
|
||||
Group: {
|
||||
...Resolver('Group', {
|
||||
undefinedToNull: ['deleted', 'disabled', 'locationName', 'about'],
|
||||
hasMany: {
|
||||
categories: '-[:CATEGORIZED]->(related:Category)',
|
||||
},
|
||||
hasOne: {
|
||||
avatar: '-[:AVATAR_IMAGE]->(related:Image)',
|
||||
location: '-[:IS_IN]->(related:Location)',
|
||||
},
|
||||
}),
|
||||
},
|
||||
|
||||
@ -42,7 +42,7 @@ export const createGroupMutation = gql`
|
||||
name
|
||||
icon
|
||||
}
|
||||
# locationName # test this as result
|
||||
locationName # test this as result
|
||||
myRole
|
||||
}
|
||||
}
|
||||
@ -90,7 +90,7 @@ export const updateGroupMutation = gql`
|
||||
icon
|
||||
}
|
||||
# avatar # test this as result
|
||||
# locationName # test this as result
|
||||
locationName # test this as result
|
||||
myRole
|
||||
}
|
||||
}
|
||||
@ -155,7 +155,7 @@ export const groupQuery = gql`
|
||||
avatar {
|
||||
url
|
||||
}
|
||||
# locationName # test this as result
|
||||
locationName # test this as result
|
||||
myRole
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user