mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
141 lines
3.9 KiB
GraphQL
141 lines
3.9 KiB
GraphQL
enum VisibilityEnum {
|
|
Public
|
|
Friends
|
|
Private
|
|
}
|
|
|
|
enum UserGroupEnum {
|
|
Admin
|
|
Moderator
|
|
User
|
|
}
|
|
|
|
type WrittenPost @relation(name: "WROTE") {
|
|
from: User
|
|
to: Post
|
|
timestamp: Int # TODO: change that to custom Date Type
|
|
}
|
|
type WrittenComment @relation(name: "WROTE") {
|
|
from: User
|
|
to: Comment
|
|
timestamp: Int # TODO: change that to custom Date Type
|
|
}
|
|
|
|
type User {
|
|
id: ID!
|
|
name: String!
|
|
email: String
|
|
slug: String
|
|
password: String!
|
|
avatar: String
|
|
disabled: Boolean @default(to: false)
|
|
role: UserGroupEnum
|
|
|
|
friends: [User]! @relation(name: "FRIENDS", direction: "BOTH")
|
|
friendsCount: Int! @cypher(statement: "MATCH (this)<-[:FRIENDS]->(r:User) RETURN COUNT(r)")
|
|
|
|
following: [User]! @relation(name: "FOLLOWING", direction: "OUT")
|
|
followingCount: Int! @cypher(statement: "MATCH (this)-[:FOLLOWING]->(r:User) RETURN COUNT(r)")
|
|
|
|
followedBy: [User]! @relation(name: "FOLLOWING", direction: "IN")
|
|
followedByCount: Int! @cypher(statement: "MATCH (this)<-[:FOLLOWING]-(r:User) RETURN COUNT(r)")
|
|
|
|
contributions: [WrittenPost]!
|
|
contributionsCount: Int! @cypher(statement: "MATCH (this)-[:WROTE]->(r:Post) RETURN COUNT(r)")
|
|
|
|
comments: [WrittenComment]!
|
|
commentsCount: Int! @cypher(statement: "MATCH (this)-[:WROTE]->(r:Comment) RETURN COUNT(r)")
|
|
|
|
shouted: [Post]! @relation(name: "SHOUTED", direction: "OUT")
|
|
|
|
organizationsCreated: [Organization] @relation(name: "CREATED_ORGA", direction: "OUT")
|
|
organizationsOwned: [Organization] @relation(name: "OWNING_ORGA", direction: "OUT")
|
|
|
|
blacklisted: [User]! @relation(name: "BLACKLISTED", 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!
|
|
author: WrittenPost
|
|
title: String!
|
|
slug: String
|
|
content: String!
|
|
contentExcerpt: String
|
|
image: String
|
|
visibility: VisibilityEnum
|
|
disabled: Boolean @default(to: false)
|
|
|
|
# relatedContributions: [Post]! @cypher(statement: "MATCH (this)-[:TAGGED]->(t:Tag)<-[:TAGGED]-(p1:Post) MATCH (this)-[:CATEGORIZED]->(t:Category)<-[:CATEGORIZED]-(p2:Post) RETURN collect(distinct p2) + p1")
|
|
relatedContributions: [Post]! @cypher(statement: "MATCH (this)-[:TAGGED]->(t:Tag)<-[:TAGGED]-(p:Post) return p")
|
|
|
|
tags: [Tag]! @relation(name: "TAGGED", direction: "OUT")
|
|
categories: [Category]! @relation(name: "CATEGORIZED", direction: "OUT")
|
|
|
|
comments: [Comment]! @relation(name: "COMMENT", direction: "IN")
|
|
commentsCount: Int! @cypher(statement: "MATCH (this)<-[:COMMENT]-(r:Comment) RETURN COUNT(r)")
|
|
|
|
shoutedBy: [User]! @relation(name: "SHOUTED", direction: "IN")
|
|
shoutedCount: Int! @cypher(statement: "MATCH (this)<-[:SHOUTED]-(r:User) RETURN COUNT(r)")
|
|
}
|
|
|
|
type Comment {
|
|
id: ID!
|
|
author: WrittenComment
|
|
content: String!
|
|
contentExcerpt: String
|
|
post: Post @relation(name: "COMMENT", direction: "OUT")
|
|
disabled: Boolean @default(to: false)
|
|
}
|
|
|
|
type Category {
|
|
id: ID!
|
|
name: String!
|
|
slug: String
|
|
icon: String!
|
|
}
|
|
|
|
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
|
|
Temorary
|
|
}
|
|
|
|
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
|
|
disabled: Boolean @default(to: false)
|
|
|
|
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]-(r) RETURN COUNT(r)")
|
|
disabled: Boolean @default(to: false)
|
|
}
|