Skip to content

Latest commit

 

History

History
76 lines (61 loc) · 1.32 KB

teams.adoc

File metadata and controls

76 lines (61 loc) · 1.32 KB

Teams

Create a team

: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

Assign an admin

MATCH (u:User {email: $admin})
MATCH (t:Team {id: $id})
MERGE (u)-[r:MEMBER_OF]->(t)
SET r.createdAt = datetime(),
  r.role = 'admin'

Add courses to learning path

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 *