mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
Tiny performance improvement
This commit is contained in:
parent
f40a67b7a8
commit
8072939458
@ -17,8 +17,8 @@ export default {
|
||||
enable: async (object, params, { user, driver }) => {
|
||||
const { resource: { id } } = params
|
||||
const cypher = `
|
||||
MATCH (p {id: $id})<-[d:DISABLED]-()
|
||||
SET p.disabled = false
|
||||
MATCH (r {id: $id})<-[d:DISABLED]-()
|
||||
SET r.disabled = false
|
||||
DELETE d
|
||||
`
|
||||
const session = driver.session()
|
||||
|
||||
@ -92,12 +92,10 @@ describe('disable', () => {
|
||||
setup.createResource = async () => {
|
||||
await factory.create('User', { id: 'u45', email: 'commenter@example.org', password: '1234' })
|
||||
await factory.authenticateAs({ email: 'commenter@example.org', password: '1234' })
|
||||
await factory.create('Post', {
|
||||
id: 'p3'
|
||||
})
|
||||
await factory.create('Comment', {
|
||||
id: 'c47'
|
||||
})
|
||||
await Promise.all([
|
||||
factory.create('Post', { id: 'p3' }),
|
||||
factory.create('Comment', { id: 'c47' })
|
||||
])
|
||||
await Promise.all([
|
||||
factory.relate('Comment', 'Author', { from: 'u45', to: 'c47' }),
|
||||
factory.relate('Comment', 'Post', { from: 'c47', to: 'p3' })
|
||||
@ -251,13 +249,10 @@ describe('enable', () => {
|
||||
setup.createResource = async () => {
|
||||
await factory.create('User', { id: 'u123', email: 'author@example.org', password: '1234' })
|
||||
await factory.authenticateAs({ email: 'author@example.org', password: '1234' })
|
||||
await factory.create('Post', {
|
||||
id: 'p9' // that's the ID we will look for
|
||||
})
|
||||
|
||||
await factory.create('Comment', {
|
||||
id: 'c456'
|
||||
})
|
||||
await Promise.all([
|
||||
factory.create('Post', { id: 'p9' }),
|
||||
factory.create('Comment', { id: 'c456' })
|
||||
])
|
||||
await Promise.all([
|
||||
factory.relate('Comment', 'Author', { from: 'u123', to: 'c456' }),
|
||||
factory.relate('Comment', 'Post', { from: 'c456', to: 'p9' })
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user