:params {
id: 'zZn839D0QIMG',
name: 'Test Team',
description: 'Employees from Team',
public: true,
open: true,
admin: '[email protected]',
domains: ['neo4j.com']
}
CREATE (t:Team {
id: $id, // a nanoid
name: $name,
description: $description,
public: $public,
open: $open,
pin: left(toString(toInteger(rand()*10000000)), 6)
})
RETURN
'https://graphacademy.neo4j.com/teams/'+ t.id AS link,
t.pin AS pin
MATCH (u:User {email: $admin})
MATCH (t:Team {id: $id})
MERGE (u)-[r:MEMBER_OF]->(t)
SET r.createdAt = datetime(),
r.role = 'admin'
Set the parameters
:param id: abc123
:param courses => 'neo4j-fundamentals,cypher-fundamentals,intermediate-cypher-queries,modeling-fundamentals,importing-cypher,cypher-indexes-constraints,app-dotnet,neo4j-certification'
Check all courses exist
WITH split($courses, ',') AS courses
MATCH (t:Team {id: $id})
UNWIND range(0, size(courses)-1) AS i
MATCH (c:Course {slug: courses[i]})
WITH courses, count(*) AS count
RETURN count = size(courses) AS ok
MATCH (t:Team {id: $id})
UNWIND split($courses, ',') AS slug
MATCH (c:Course {slug: slug})
RETURN *