type Query { isLoggedIn: Boolean! "Get the currently logged in User based on the given JWT Token" currentUser: User "Get the latest Network Statistics" statistics: Statistics! } type Mutation { "Get a JWT Token for the given Email and password" login(email: String!, password: String!): String! signup(email: String!, password: String!): Boolean! report(id: ID!, description: String): Report disable(id: ID!): ID enable(id: ID!): ID "Shout the given Type and ID" shout(id: ID!, type: ShoutTypeEnum): Boolean! @cypher(statement: """ MATCH (n {id: $id})<-[:WROTE]-(wu:User), (u:User {id: $cypherParams.currentUserId}) WHERE $type IN labels(n) AND NOT wu.id = $cypherParams.currentUserId MERGE (u)-[r:SHOUTED]->(n) RETURN COUNT(r) > 0 """) "Unshout the given Type and ID" unshout(id: ID!, type: ShoutTypeEnum): Boolean! @cypher(statement: """ MATCH (:User {id: $cypherParams.currentUserId})-[r:SHOUTED]->(n {id: $id}) WHERE $type IN labels(n) DELETE r RETURN COUNT(r) > 0 """) "Follow the given Type and ID" follow(id: ID!, type: FollowTypeEnum): Boolean! @cypher(statement: """ MATCH (n {id: $id}), (u:User {id: $cypherParams.currentUserId}) WHERE $type IN labels(n) AND NOT $id = $cypherParams.currentUserId MERGE (u)-[r:FOLLOWS]->(n) RETURN COUNT(r) > 0 """) "Unfollow the given Type and ID" unfollow(id: ID!, type: FollowTypeEnum): Boolean! @cypher(statement: """ MATCH (:User {id: $cypherParams.currentUserId})-[r:FOLLOWS]->(n {id: $id}) WHERE $type IN labels(n) DELETE r RETURN COUNT(r) > 0 """) } type Statistics { countUsers: Int! countPosts: Int! countComments: Int! countNotifications: Int! countOrganizations: Int! countProjects: Int! countInvites: Int! countFollows: Int! countShouts: Int! } scalar Date scalar Time scalar DateTime enum VisibilityEnum { public friends private } enum UserGroupEnum { admin moderator user } type Location { id: ID! name: String! nameEN: String nameDE: String nameFR: String nameNL: String nameIT: String nameES: String namePT: String namePL: String type: String! lat: Float lng: Float parent: Location @cypher(statement: "MATCH (this)-[:IS_IN]->(l:Location) RETURN l") } type User { id: ID! actorId: String name: String email: String slug: String password: String! avatar: String deleted: Boolean disabled: Boolean disabledBy: User @relation(name: "DISABLED", direction: "IN") role: UserGroupEnum publicKey: String privateKey: String location: Location @cypher(statement: "MATCH (this)-[:IS_IN]->(l:Location) RETURN l") locationName: String about: String createdAt: String updatedAt: String friends: [User]! @relation(name: "FRIENDS", direction: "BOTH") friendsCount: Int! @cypher(statement: "MATCH (this)<-[:FRIENDS]->(r:User) RETURN COUNT(DISTINCT r)") following: [User]! @relation(name: "FOLLOWS", direction: "OUT") followingCount: Int! @cypher(statement: "MATCH (this)-[:FOLLOWS]->(r:User) RETURN COUNT(DISTINCT r)") followedBy: [User]! @relation(name: "FOLLOWS", direction: "IN") followedByCount: Int! @cypher(statement: "MATCH (this)<-[:FOLLOWS]-(r:User) RETURN COUNT(DISTINCT r)") "Is the currently logged in user following that user?" followedByCurrentUser: Boolean! @cypher(statement: """ MATCH (this)<-[:FOLLOWS]-(u:User {id: $cypherParams.currentUserId}) RETURN COUNT(u) >= 1 """) #contributions: [WrittenPost]! #contributions2(first: Int = 10, offset: Int = 0): [WrittenPost2]! # @cypher( # statement: "MATCH (this)-[w:WROTE]->(p:Post) RETURN p as Post, w.timestamp as timestamp" # ) contributions: [Post]! @relation(name: "WROTE", direction: "OUT") contributionsCount: Int! @cypher(statement: """ MATCH (this)-[:WROTE]->(r:Post) WHERE (NOT exists(r.deleted) OR r.deleted = false) AND (NOT exists(r.disabled) OR r.disabled = false) RETURN COUNT(r)""" ) comments: [Comment]! @relation(name: "WROTE", direction: "OUT") commentsCount: Int! @cypher(statement: "MATCH (this)-[:WROTE]->(r:Comment) WHERE NOT r.deleted = true RETURN COUNT(r)") shouted: [Post]! @relation(name: "SHOUTED", direction: "OUT") shoutedCount: Int! @cypher(statement: "MATCH (this)-[:SHOUTED]->(r:Post) WHERE NOT r.deleted = true AND NOT r.disabled = true RETURN COUNT(DISTINCT r)") organizationsCreated: [Organization] @relation(name: "CREATED_ORGA", direction: "OUT") organizationsOwned: [Organization] @relation(name: "OWNING_ORGA", direction: "OUT") blacklisted: [User]! @relation(name: "BLACKLISTED", direction: "OUT") categories: [Category]! @relation(name: "CATEGORIZED", direction: "OUT") badges: [Badge]! @relation(name: "REWARDED", direction: "IN") badgesCount: Int! @cypher(statement: "MATCH (this)<-[:REWARDED]-(r:Badge) RETURN COUNT(r)") } type Post { id: ID! activityId: String author: User @relation(name: "WROTE", direction: "IN") title: String! slug: String content: String! contentExcerpt: String image: String visibility: VisibilityEnum deleted: Boolean disabled: Boolean disabledBy: User @relation(name: "DISABLED", direction: "IN") createdAt: String updatedAt: String relatedContributions: [Post]! @cypher(statement: """ MATCH (this)-[:TAGGED|CATEGORIZED]->(categoryOrTag)<-[:TAGGED|CATEGORIZED]-(post:Post) RETURN DISTINCT post LIMIT 10 """) tags: [Tag]! @relation(name: "TAGGED", direction: "OUT") categories: [Category]! @relation(name: "CATEGORIZED", direction: "OUT") comments: [Comment]! @relation(name: "COMMENTS", direction: "IN") commentsCount: Int! @cypher(statement: "MATCH (this)<-[:COMMENTS]-(r:Comment) RETURN COUNT(r)") shoutedBy: [User]! @relation(name: "SHOUTED", direction: "IN") shoutedCount: Int! @cypher(statement: "MATCH (this)<-[:SHOUTED]-(r:User) WHERE NOT r.deleted = true AND NOT r.disabled = true RETURN COUNT(DISTINCT r)") "Has the currently logged in user shouted that post?" shoutedByCurrentUser: Boolean! @cypher(statement: """ MATCH (this)<-[:SHOUTED]-(u:User {id: $cypherParams.currentUserId}) RETURN COUNT(u) >= 1 """) } type Comment { id: ID! activityId: String author: User @relation(name: "WROTE", direction: "IN") content: String! contentExcerpt: String post: Post @relation(name: "COMMENTS", direction: "OUT") createdAt: String updatedAt: String deleted: Boolean disabled: Boolean disabledBy: User @relation(name: "DISABLED", direction: "IN") } type Report { id: ID! submitter: User @relation(name: "REPORTED", direction: "IN") description: String type: String! @cypher(statement: "MATCH (resource)<-[:REPORTED]-(this) RETURN labels(resource)[0]") createdAt: String comment: Comment @relation(name: "REPORTED", direction: "OUT") post: Post @relation(name: "REPORTED", direction: "OUT") user: User @relation(name: "REPORTED", direction: "OUT") } type Category { id: ID! name: String! slug: String icon: String! posts: [Post]! @relation(name: "CATEGORIZED", direction: "IN") postCount: Int! @cypher(statement: "MATCH (this)<-[:CATEGORIZED]-(r:Post) RETURN COUNT(r)") } type Badge { id: ID! key: String! type: BadgeTypeEnum! status: BadgeStatusEnum! icon: String! rewarded: [User]! @relation(name: "REWARDED", direction: "OUT") } enum BadgeTypeEnum { role crowdfunding } enum BadgeStatusEnum { permanent temporary } enum ShoutTypeEnum { Post Organization Project } enum FollowTypeEnum { User Organization Project } type Organization { id: ID! createdBy: User @relation(name: "CREATED_ORGA", direction: "IN") ownedBy: [User] @relation(name: "OWNING_ORGA", direction: "IN") name: String! slug: String description: String! descriptionExcerpt: String deleted: Boolean disabled: Boolean tags: [Tag]! @relation(name: "TAGGED", direction: "OUT") categories: [Category]! @relation(name: "CATEGORIZED", direction: "OUT") } type Tag { id: ID! name: String! taggedPosts: [Post]! @relation(name: "TAGGED", direction: "IN") taggedOrganizations: [Organization]! @relation(name: "TAGGED", direction: "IN") taggedCount: Int! @cypher(statement: "MATCH (this)<-[:TAGGED]-(p) RETURN COUNT(DISTINCT p)") taggedCountUnique: Int! @cypher(statement: "MATCH (this)<-[:TAGGED]-(p)<-[:WROTE]-(u:User) RETURN COUNT(DISTINCT u)") deleted: Boolean disabled: Boolean } type SharedInboxEndpoint { id: ID! uri: String }