active categories is array of string (ids of categories), current user query resolves with active categories

This commit is contained in:
Moriz Wahl 2022-09-07 14:09:24 +02:00
parent d05919fddb
commit 18e15be24d
2 changed files with 5 additions and 4 deletions

View File

@ -20,8 +20,9 @@ export default {
const result = await transaction.run(
`
MATCH (user:User {id: $id})
WITH user, [(user)<-[:OWNED_BY]-(medium:SocialMedia) | properties(medium) ] as media
RETURN user {.*, socialMedia: media } as user
MATCH (category:Category) WHERE NOT ((user)-[:NOT_INTERESTED_IN]->(category))
WITH user, [(user)<-[:OWNED_BY]-(medium:SocialMedia) | properties(medium) ] as media, category
RETURN user {.*, socialMedia: media, activeCategories: collect(category.id) } as user
`,
{ id: user.id },
)

View File

@ -115,11 +115,11 @@ type User {
emotions: [EMOTED]
activeCategories: [Category] @cypher(
activeCategories: [String] @cypher(
statement: """
MATCH (category:Category)
WHERE NOT ((this)-[:NOT_INTERESTED_IN]->(category))
RETURN category
RETURN collect(category.id)
"""
)
}