2021-08-20 23:17:15 +00:00
|
|
|
scalar DateTime
|
|
|
|
|
|
|
|
################################### Payload
|
|
|
|
|
|
|
|
type Result {
|
2021-10-30 19:37:57 +00:00
|
|
|
error: String
|
2021-08-20 23:17:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type AuthResult {
|
2021-10-30 19:37:57 +00:00
|
|
|
error: String
|
|
|
|
token: String
|
|
|
|
user: User
|
2021-08-20 23:17:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type UserResult {
|
2021-10-30 19:37:57 +00:00
|
|
|
error: String
|
|
|
|
user: User
|
2021-08-20 23:17:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type MessageResult {
|
2021-10-30 19:37:57 +00:00
|
|
|
error: String
|
|
|
|
message: Message
|
2021-08-20 23:17:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
input ShoutInput {
|
2021-10-30 19:37:57 +00:00
|
|
|
slug: String!
|
|
|
|
body: String!
|
2021-12-17 16:14:08 +00:00
|
|
|
community: Int!
|
|
|
|
mainTopic: String
|
2021-12-12 15:29:51 +00:00
|
|
|
topic_slugs: [String]
|
2021-10-30 19:37:57 +00:00
|
|
|
title: String
|
|
|
|
subtitle: String
|
|
|
|
versionOf: String
|
|
|
|
visibleForRoles: [String] # role ids are strings
|
|
|
|
visibleForUsers: [Int]
|
2021-08-21 00:40:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
input ProfileInput {
|
2021-12-08 12:51:30 +00:00
|
|
|
name: String
|
2021-10-30 19:37:57 +00:00
|
|
|
userpic: String
|
2021-12-08 12:51:30 +00:00
|
|
|
links: [String]
|
|
|
|
bio: String
|
2021-08-20 23:17:15 +00:00
|
|
|
}
|
|
|
|
|
2021-11-26 00:41:20 +00:00
|
|
|
input CommunityInput {
|
2021-11-27 07:09:34 +00:00
|
|
|
title: String!
|
|
|
|
desc: String
|
|
|
|
pic: String
|
2021-11-26 00:41:20 +00:00
|
|
|
}
|
|
|
|
|
2021-08-20 23:17:15 +00:00
|
|
|
type ShoutResult {
|
2021-10-30 19:37:57 +00:00
|
|
|
error: String
|
|
|
|
shout: Shout
|
2021-08-20 23:17:15 +00:00
|
|
|
}
|
|
|
|
|
2021-11-21 11:04:38 +00:00
|
|
|
type CommentResult {
|
|
|
|
error: String
|
|
|
|
comment: Comment
|
|
|
|
}
|
|
|
|
|
2021-11-24 07:36:06 +00:00
|
|
|
enum MessageStatus {
|
|
|
|
NEW
|
|
|
|
UPDATED
|
|
|
|
DELETED
|
|
|
|
}
|
|
|
|
|
|
|
|
type MessageWithStatus {
|
|
|
|
status: MessageStatus!
|
|
|
|
message: Message!
|
|
|
|
}
|
|
|
|
|
2022-01-23 11:02:57 +00:00
|
|
|
type CreateChatResult {
|
|
|
|
chatId: String
|
|
|
|
error: String
|
|
|
|
}
|
|
|
|
|
|
|
|
type EnterChatResult {
|
|
|
|
chat: Chat
|
|
|
|
messages: [Message]
|
|
|
|
error: String
|
2021-12-05 20:23:48 +00:00
|
|
|
}
|
|
|
|
|
2021-12-12 15:29:51 +00:00
|
|
|
input TopicInput {
|
|
|
|
slug: String!
|
|
|
|
title: String
|
|
|
|
body: String
|
|
|
|
pic: String
|
|
|
|
children: [String]
|
|
|
|
community: String!
|
|
|
|
}
|
|
|
|
|
|
|
|
type TopicResult {
|
|
|
|
error: String
|
|
|
|
topic: Topic
|
|
|
|
}
|
|
|
|
|
2021-08-20 23:17:15 +00:00
|
|
|
################################### Mutation
|
|
|
|
|
|
|
|
type Mutation {
|
2021-10-30 19:37:57 +00:00
|
|
|
# message
|
2022-01-23 11:02:57 +00:00
|
|
|
createChat(description: String): CreateChatResult!
|
|
|
|
createMessage(chatId: String!, body: String!, replyTo: Int): MessageResult!
|
|
|
|
updateMessage(chatId: String!, id: Int!, body: String!): MessageResult!
|
2022-01-24 11:56:55 +00:00
|
|
|
deleteMessage(chatId: String!, id: Int!): Result!
|
2021-10-30 19:37:57 +00:00
|
|
|
|
|
|
|
# auth
|
|
|
|
confirmEmail(token: String!): AuthResult!
|
|
|
|
registerUser(email: String!, password: String): AuthResult!
|
2022-01-13 12:16:35 +00:00
|
|
|
requestPasswordUpdate(email: String!): Result!
|
|
|
|
updatePassword(password: String!, token: String!): Result!
|
2021-10-30 19:37:57 +00:00
|
|
|
# requestEmailConfirmation: User!
|
|
|
|
|
|
|
|
# shout
|
|
|
|
createShout(input: ShoutInput!): ShoutResult!
|
2021-12-13 07:50:33 +00:00
|
|
|
updateShout(input: ShoutInput!): ShoutResult!
|
|
|
|
deleteShout(slug: String!): Result!
|
|
|
|
rateShout(slug: String!, value: Int!): Result!
|
|
|
|
viewShout(slug: String!): Result!
|
2021-10-30 19:37:57 +00:00
|
|
|
|
|
|
|
# user profile
|
|
|
|
# rateUser(value: Int!): Result!
|
|
|
|
# updateOnlineStatus: Result!
|
|
|
|
updateProfile(profile: ProfileInput!): Result!
|
|
|
|
|
|
|
|
# topics
|
2021-12-12 15:29:51 +00:00
|
|
|
createTopic(input: TopicInput!): TopicResult!
|
|
|
|
updateTopic(input: TopicInput!): TopicResult!
|
2021-10-30 19:37:57 +00:00
|
|
|
topicSubscribe(slug: String!): Result!
|
|
|
|
topicUnsubscribe(slug: String!): Result!
|
2021-11-26 00:41:20 +00:00
|
|
|
|
2021-12-13 07:50:33 +00:00
|
|
|
createComment(body: String!, shout: String!, replyTo: Int): CommentResult!
|
2021-11-21 11:04:38 +00:00
|
|
|
updateComment(id: Int!, body: String!): CommentResult!
|
|
|
|
deleteComment(id: Int!): Result!
|
2021-11-24 06:23:48 +00:00
|
|
|
rateComment(id: Int!, value: Int!): Result!
|
2021-11-26 00:41:20 +00:00
|
|
|
|
2021-11-24 15:53:01 +00:00
|
|
|
createCommunity(title: String!, desc: String!): Community!
|
2021-11-26 00:41:20 +00:00
|
|
|
updateCommunity(community: CommunityInput!): Community!
|
2021-11-24 15:53:01 +00:00
|
|
|
deleteCommunity(id: Int!): Result!
|
2021-08-20 23:17:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
################################### Query
|
|
|
|
|
|
|
|
type Query {
|
2021-10-30 19:37:57 +00:00
|
|
|
# auth
|
|
|
|
isEmailFree(email: String!): Result!
|
|
|
|
signIn(email: String!, password: String): AuthResult!
|
|
|
|
signOut: Result!
|
|
|
|
|
|
|
|
# profile
|
|
|
|
getCurrentUser: UserResult!
|
2021-12-11 16:38:54 +00:00
|
|
|
getUsersBySlugs(slugs: [String]!): [User]!
|
2021-10-30 19:37:57 +00:00
|
|
|
# rateUser(shout: Int): Int!
|
2021-12-11 13:18:40 +00:00
|
|
|
getUserRoles(slug: String!): [Role]!
|
2021-10-30 19:37:57 +00:00
|
|
|
|
|
|
|
# messages
|
|
|
|
getMessages(count: Int = 100, page: Int = 1): [Message!]!
|
|
|
|
|
|
|
|
# shouts
|
2021-12-06 14:50:49 +00:00
|
|
|
getShoutBySlug(slug: String!): Shout!
|
2022-01-08 09:04:45 +00:00
|
|
|
shoutsByTopic(topic: String!, page: Int!, size: Int!): [Shout]!
|
|
|
|
shoutsByAuthor(author: String!, page: Int!, size: Int!): [Shout]!
|
|
|
|
shoutsByCommunity(community: String!, page: Int!, size: Int!): [Shout]!
|
2021-12-13 07:50:33 +00:00
|
|
|
getShoutComments(slug: String!): [Comment]!
|
2021-10-30 19:37:57 +00:00
|
|
|
|
|
|
|
# mainpage
|
2021-12-17 18:14:31 +00:00
|
|
|
topViewed(page: Int!, size: Int!): [Shout]!
|
|
|
|
topMonth(page: Int!, size: Int!): [Shout]!
|
|
|
|
topOverall(page: Int!, size: Int!): [Shout]!
|
|
|
|
recents(page: Int!, size: Int!): [Shout]!
|
2021-10-30 19:37:57 +00:00
|
|
|
|
|
|
|
# topics
|
2021-12-12 13:00:38 +00:00
|
|
|
topicsBySlugs(slugs: [String]): [Topic]!
|
2021-10-30 19:37:57 +00:00
|
|
|
topicsByCommunity(community: String!): [Topic]!
|
|
|
|
topicsByAuthor(author: String!): [Topic]!
|
|
|
|
|
|
|
|
# getOnlineUsers: [User!]!
|
2021-11-26 00:41:20 +00:00
|
|
|
|
2021-11-24 12:11:59 +00:00
|
|
|
# communities
|
|
|
|
getCommunity(slug: String): Community!
|
|
|
|
getCommunities: [Community]!
|
2022-01-23 11:02:57 +00:00
|
|
|
|
|
|
|
#messages
|
|
|
|
enterChat(chatId: String!): EnterChatResult!
|
2021-08-20 23:17:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
############################################ Subscription
|
|
|
|
|
|
|
|
type Subscription {
|
2022-01-24 14:02:44 +00:00
|
|
|
chatUpdated(chatId: String!): MessageWithStatus!
|
2021-10-30 19:37:57 +00:00
|
|
|
onlineUpdated: [User!]!
|
|
|
|
shoutUpdated: Shout!
|
|
|
|
userUpdated: User!
|
2021-11-04 16:37:41 +00:00
|
|
|
topicUpdated(user_id: Int!): Shout!
|
2021-08-20 23:17:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
############################################ Entities
|
|
|
|
|
2021-11-24 09:09:47 +00:00
|
|
|
type Resource {
|
|
|
|
id: Int!
|
|
|
|
name: String!
|
|
|
|
}
|
|
|
|
|
|
|
|
type Operation {
|
|
|
|
id: Int!
|
|
|
|
name: String!
|
|
|
|
}
|
|
|
|
|
|
|
|
type Permission {
|
|
|
|
operation_id: Int!
|
|
|
|
resource_id: Int!
|
|
|
|
}
|
|
|
|
|
2021-08-20 23:17:15 +00:00
|
|
|
type Role {
|
2021-10-30 19:37:57 +00:00
|
|
|
id: Int!
|
|
|
|
name: String!
|
|
|
|
community: Int!
|
|
|
|
desc: String
|
2021-11-24 09:09:47 +00:00
|
|
|
permissions: [Permission!]!
|
2021-08-20 23:17:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type Rating {
|
2022-01-11 13:33:25 +00:00
|
|
|
rater: String!
|
|
|
|
value: Int!
|
|
|
|
}
|
|
|
|
|
2021-08-20 23:17:15 +00:00
|
|
|
type Notification {
|
2021-10-30 19:37:57 +00:00
|
|
|
kind: String! # unique primary key
|
|
|
|
template: String!
|
|
|
|
variables: [String]
|
2021-08-20 23:17:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type UserNotification {
|
2021-10-30 19:37:57 +00:00
|
|
|
id: Int! # primary key
|
|
|
|
user: Int!
|
|
|
|
kind: String! # NotificationTemplate.name
|
|
|
|
values: [String]
|
2021-08-20 23:17:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type User {
|
2021-10-30 19:37:57 +00:00
|
|
|
id: Int!
|
|
|
|
username: String! # to login, ex. email
|
|
|
|
createdAt: DateTime!
|
|
|
|
slug: String!
|
|
|
|
name: String # to display
|
|
|
|
email: String
|
|
|
|
password: String
|
|
|
|
oauth: String # provider:token
|
|
|
|
userpic: String
|
|
|
|
links: [String]
|
|
|
|
emailConfirmed: Boolean # should contain all emails too
|
|
|
|
muted: Boolean
|
|
|
|
updatedAt: DateTime
|
|
|
|
wasOnlineAt: DateTime
|
2021-12-11 16:38:54 +00:00
|
|
|
ratings: [Rating]
|
2021-10-30 19:37:57 +00:00
|
|
|
bio: String
|
|
|
|
notifications: [Int]
|
|
|
|
communities: [Int] # user participating communities
|
|
|
|
old_id: String
|
2021-08-20 23:17:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type Message {
|
2021-10-30 19:37:57 +00:00
|
|
|
author: Int!
|
2021-12-05 20:23:48 +00:00
|
|
|
chatRoom: Int!
|
2021-10-30 19:37:57 +00:00
|
|
|
body: String!
|
|
|
|
createdAt: DateTime!
|
|
|
|
id: Int!
|
|
|
|
replyTo: Int
|
|
|
|
updatedAt: DateTime!
|
|
|
|
visibleForUsers: [Int]!
|
2021-08-20 23:17:15 +00:00
|
|
|
}
|
|
|
|
|
2022-01-23 11:02:57 +00:00
|
|
|
type Chat {
|
2021-12-05 20:23:48 +00:00
|
|
|
id: Int!
|
|
|
|
createdAt: DateTime!
|
|
|
|
updatedAt: DateTime!
|
2022-01-23 11:02:57 +00:00
|
|
|
description: String
|
2021-12-05 20:23:48 +00:00
|
|
|
}
|
|
|
|
|
2021-09-03 16:01:31 +00:00
|
|
|
type Comment {
|
2021-10-30 19:37:57 +00:00
|
|
|
id: Int!
|
2021-12-02 13:06:22 +00:00
|
|
|
author: User!
|
2021-10-30 19:37:57 +00:00
|
|
|
body: String!
|
2021-11-21 11:04:38 +00:00
|
|
|
replyTo: Int
|
2021-10-30 19:37:57 +00:00
|
|
|
createdAt: DateTime!
|
|
|
|
updatedAt: DateTime
|
|
|
|
updatedBy: Int
|
|
|
|
shout: Int!
|
|
|
|
deletedAt: DateTime
|
|
|
|
deletedBy: Int
|
2021-11-22 06:38:14 +00:00
|
|
|
ratings: [CommentRating]
|
2021-10-30 19:37:57 +00:00
|
|
|
views: Int
|
|
|
|
old_id: String
|
|
|
|
old_thread: String
|
2021-10-13 17:46:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type CommentRating {
|
2021-10-30 19:37:57 +00:00
|
|
|
id: Int!
|
|
|
|
comment_id: Int!
|
2022-01-14 12:19:57 +00:00
|
|
|
createdBy: String!
|
2021-10-30 19:37:57 +00:00
|
|
|
createdAt: DateTime!
|
|
|
|
value: Int!
|
2021-09-03 16:01:31 +00:00
|
|
|
}
|
|
|
|
|
2021-08-20 23:17:15 +00:00
|
|
|
# is publication
|
|
|
|
type Shout {
|
2021-10-30 19:37:57 +00:00
|
|
|
slug: String!
|
|
|
|
body: String!
|
|
|
|
createdAt: DateTime!
|
|
|
|
authors: [User!]!
|
2022-01-14 12:19:57 +00:00
|
|
|
ratings: [Rating]
|
2021-10-30 19:37:57 +00:00
|
|
|
visibleFor: [User]
|
|
|
|
community: Int
|
|
|
|
cover: String
|
|
|
|
layout: String
|
2021-11-04 00:21:25 +00:00
|
|
|
# replyTo: Shout
|
2021-10-30 19:37:57 +00:00
|
|
|
versionOf: Shout
|
|
|
|
tags: [String] # actual values
|
2021-11-10 08:42:29 +00:00
|
|
|
topics: [Topic]
|
2021-12-15 17:35:25 +00:00
|
|
|
mainTopic: String
|
2021-10-30 19:37:57 +00:00
|
|
|
title: String
|
|
|
|
subtitle: String
|
|
|
|
updatedAt: DateTime
|
|
|
|
updatedBy: Int # can be user id?
|
|
|
|
deletedAt: DateTime
|
|
|
|
deletedBy: Int
|
|
|
|
publishedBy: Int # if there is no published field - it is not published
|
|
|
|
publishedAt: DateTime
|
2021-12-17 10:22:31 +00:00
|
|
|
|
|
|
|
stat: ShoutStat
|
|
|
|
}
|
|
|
|
|
|
|
|
type ShoutStat {
|
|
|
|
views: Int!
|
|
|
|
comments: Int!
|
|
|
|
ratings: Int!
|
2021-08-20 23:17:15 +00:00
|
|
|
}
|
|
|
|
|
2021-08-26 21:14:20 +00:00
|
|
|
type Community {
|
2021-10-30 19:37:57 +00:00
|
|
|
slug: String!
|
|
|
|
name: String!
|
|
|
|
desc: String
|
|
|
|
pic: String!
|
2021-08-26 21:14:20 +00:00
|
|
|
}
|
|
|
|
|
2021-12-13 16:51:01 +00:00
|
|
|
type TopicStat {
|
2021-12-15 01:25:11 +00:00
|
|
|
shouts: Int!
|
|
|
|
views: Int!
|
2021-12-15 09:17:16 +00:00
|
|
|
subscriptions: Int!
|
|
|
|
authors: Int!
|
2021-12-13 16:51:01 +00:00
|
|
|
}
|
|
|
|
|
2021-08-20 23:17:15 +00:00
|
|
|
type Topic {
|
2021-10-30 19:37:57 +00:00
|
|
|
slug: String! # ID
|
|
|
|
title: String
|
|
|
|
body: String
|
|
|
|
pic: String
|
|
|
|
parents: [String] # NOTE: topic can have parent topics
|
|
|
|
children: [String] # and children
|
2021-12-12 15:29:51 +00:00
|
|
|
community: String!
|
2021-12-13 16:51:01 +00:00
|
|
|
topicStat: TopicStat
|
2021-08-20 23:17:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# TODO: resolvers to add/remove topics from publication
|
|
|
|
|
|
|
|
type Proposal {
|
2021-10-30 19:37:57 +00:00
|
|
|
body: String!
|
|
|
|
shout: Int!
|
|
|
|
range: String # full / 0:2340
|
|
|
|
author: Int!
|
|
|
|
createdAt: DateTime!
|
2021-08-20 23:17:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type Token {
|
2021-10-30 19:37:57 +00:00
|
|
|
createdAt: DateTime!
|
|
|
|
expiresAt: DateTime
|
|
|
|
id: Int!
|
|
|
|
ownerId: Int!
|
|
|
|
usedAt: DateTime
|
|
|
|
value: String!
|
2021-08-28 10:13:50 +00:00
|
|
|
}
|