2021-08-20 23:17:15 +00:00
|
|
|
scalar DateTime
|
|
|
|
|
|
|
|
################################### Payload
|
|
|
|
|
|
|
|
type Result {
|
2021-08-21 00:40:41 +00:00
|
|
|
error: String
|
2021-08-20 23:17:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type AuthResult {
|
2021-08-21 00:40:41 +00:00
|
|
|
error: String
|
|
|
|
token: String
|
|
|
|
user: User
|
2021-08-20 23:17:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type UserResult {
|
2021-08-21 00:40:41 +00:00
|
|
|
error: String
|
|
|
|
user: User
|
2021-08-20 23:17:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type MessageResult {
|
2021-08-21 00:40:41 +00:00
|
|
|
error: String
|
|
|
|
message: Message
|
2021-08-20 23:17:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
input ShoutInput {
|
2021-08-21 00:40:41 +00:00
|
|
|
slug: String!
|
|
|
|
body: String!
|
|
|
|
replyTo: String # another shout
|
|
|
|
tags: [String] # actual values
|
2021-08-28 15:12:13 +00:00
|
|
|
topics: [Int]
|
2021-08-21 00:40:41 +00:00
|
|
|
title: String
|
2021-08-28 10:13:50 +00:00
|
|
|
subtitle: String
|
2021-08-21 00:40:41 +00:00
|
|
|
versionOf: String
|
|
|
|
visibleForRoles: [String] # role ids are strings
|
|
|
|
visibleForUsers: [Int]
|
|
|
|
}
|
|
|
|
|
|
|
|
input ProfileInput {
|
2021-08-20 23:17:15 +00:00
|
|
|
email: String
|
|
|
|
username: String
|
|
|
|
userpic: String
|
|
|
|
}
|
|
|
|
|
|
|
|
type ShoutResult {
|
2021-08-21 00:40:41 +00:00
|
|
|
error: String
|
|
|
|
shout: Shout
|
2021-08-20 23:17:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
################################### Mutation
|
|
|
|
|
|
|
|
type Mutation {
|
|
|
|
# message
|
2021-08-21 00:40:41 +00:00
|
|
|
createMessage(body: String!, replyTo: Int): MessageResult!
|
|
|
|
updateMessage(id: Int!, body: String!): MessageResult!
|
|
|
|
deleteMessage(messageId: Int!): Result!
|
2021-08-20 23:17:15 +00:00
|
|
|
|
|
|
|
# auth
|
|
|
|
confirmEmail(token: String!): AuthResult!
|
|
|
|
requestPasswordReset(email: String!): Boolean!
|
|
|
|
confirmPasswordReset(token: String!): Boolean!
|
2021-08-25 08:31:51 +00:00
|
|
|
registerUser(email: String!, password: String): AuthResult!
|
2021-08-20 23:17:15 +00:00
|
|
|
# updatePassword(password: String!, token: String!): Token!
|
|
|
|
# invalidateAllTokens: Boolean!
|
|
|
|
# invalidateTokenById(id: Int!): Boolean!
|
|
|
|
# requestEmailConfirmation: User!
|
|
|
|
|
|
|
|
# shout
|
2021-08-21 00:40:41 +00:00
|
|
|
createShout(input: ShoutInput!): ShoutResult!
|
2021-08-28 10:13:50 +00:00
|
|
|
updateShout(id: Int!, input: ShoutInput!): ShoutResult!
|
|
|
|
deleteShout(id: Int!): Result!
|
|
|
|
rateShout(id: Int!, value: Int!): Result!
|
2021-08-20 23:17:15 +00:00
|
|
|
|
|
|
|
# user profile
|
|
|
|
# rateUser(value: Int!): Result!
|
|
|
|
# updateOnlineStatus: Result!
|
|
|
|
updateProfile(profile: ProfileInput!): Result!
|
|
|
|
}
|
|
|
|
|
|
|
|
################################### Query
|
|
|
|
|
|
|
|
type Query {
|
|
|
|
# auth
|
2021-08-21 00:40:41 +00:00
|
|
|
isEmailFree(email: String!): Result!
|
2021-08-25 17:12:01 +00:00
|
|
|
signIn(email: String!, password: String): AuthResult!
|
2021-08-21 00:40:41 +00:00
|
|
|
signOut: Result!
|
2021-09-05 07:16:28 +00:00
|
|
|
|
|
|
|
# profile
|
2021-08-21 00:40:41 +00:00
|
|
|
getCurrentUser: UserResult!
|
2021-09-05 07:16:28 +00:00
|
|
|
getUserBySlug(slug: String!): UserResult!
|
|
|
|
# rateUser(shout: Int): Int!
|
2021-08-20 23:17:15 +00:00
|
|
|
|
|
|
|
# messages
|
|
|
|
getMessages(count: Int = 100, page: Int = 1): [Message!]!
|
|
|
|
|
|
|
|
# shouts
|
2021-09-05 07:16:28 +00:00
|
|
|
getShoutBySlug(slug: String!): Shout! # NOTE: with .comments: Comments[]
|
2021-08-20 23:17:15 +00:00
|
|
|
# getShoutRating(shout: Int): Int!
|
|
|
|
# shoutsByAuthor(author: Int): [Shout]!
|
|
|
|
# shoutsByReplyTo(shout: Int): [Shout]!
|
|
|
|
# shoutsByTags(tags: [String]): [Shout]!
|
|
|
|
# shoutsByTime(time: DateTime): [Shout]!
|
|
|
|
|
2021-09-05 07:16:28 +00:00
|
|
|
# mainpage
|
2021-08-30 07:41:59 +00:00
|
|
|
topShoutsByView(limit: Int): [Shout]!
|
|
|
|
topShoutsByRating(limit: Int): [Shout]!
|
2021-09-01 16:03:00 +00:00
|
|
|
favoritesShouts(limit: Int): [Shout]!
|
2021-09-02 11:04:58 +00:00
|
|
|
topAuthors(limit: Int): [User]!
|
2021-08-30 07:41:59 +00:00
|
|
|
|
2021-08-20 23:17:15 +00:00
|
|
|
# getOnlineUsers: [User!]!
|
|
|
|
}
|
|
|
|
|
|
|
|
############################################ Subscription
|
|
|
|
|
|
|
|
type Subscription {
|
|
|
|
messageCreated: Message!
|
|
|
|
messageUpdated: Message!
|
|
|
|
messageDeleted: Message!
|
2021-08-21 00:40:41 +00:00
|
|
|
|
2021-08-20 23:17:15 +00:00
|
|
|
onlineUpdated: [User!]!
|
|
|
|
shoutUpdated: Shout!
|
|
|
|
userUpdated: User!
|
|
|
|
}
|
|
|
|
|
|
|
|
############################################ Entities
|
|
|
|
|
|
|
|
type Role {
|
|
|
|
id: Int!
|
|
|
|
name: String!
|
2021-08-26 21:14:20 +00:00
|
|
|
community: Int!
|
2021-08-20 23:17:15 +00:00
|
|
|
desc: String
|
|
|
|
permissions: [Int!]!
|
|
|
|
}
|
|
|
|
|
|
|
|
type Rating {
|
2021-08-20 23:18:10 +00:00
|
|
|
createdBy: Int!
|
2021-08-20 23:17:15 +00:00
|
|
|
value: Int!
|
|
|
|
}
|
|
|
|
|
|
|
|
type Notification {
|
|
|
|
kind: String! # unique primary key
|
|
|
|
template: String!
|
|
|
|
variables: [String]
|
|
|
|
}
|
|
|
|
|
|
|
|
type UserNotification {
|
|
|
|
id: Int! # primary key
|
|
|
|
user: Int!
|
|
|
|
kind: String! # NotificationTemplate.name
|
|
|
|
values: [String]
|
|
|
|
}
|
|
|
|
|
|
|
|
type User {
|
2021-08-23 08:44:46 +00:00
|
|
|
id: Int!
|
2021-08-20 23:17:15 +00:00
|
|
|
username: String! # email
|
|
|
|
createdAt: DateTime!
|
2021-08-23 08:44:46 +00:00
|
|
|
slug: String!
|
|
|
|
viewname: String # to display
|
2021-08-20 23:17:15 +00:00
|
|
|
email: String
|
|
|
|
password: String
|
|
|
|
oauth: String # provider:token
|
|
|
|
userpic: String
|
|
|
|
links: [String]
|
|
|
|
emailConfirmed: Boolean # should contain all emails too # TODO: pagination here
|
|
|
|
muted: Boolean
|
|
|
|
roles: [Role]
|
|
|
|
updatedAt: DateTime
|
|
|
|
wasOnlineAt: DateTime
|
2021-09-01 13:55:42 +00:00
|
|
|
rating: Int
|
2021-08-20 23:17:15 +00:00
|
|
|
ratings: [Rating]
|
|
|
|
bio: String
|
2021-08-21 00:40:41 +00:00
|
|
|
notifications: [Int]
|
2021-08-26 21:14:20 +00:00
|
|
|
topics: [String] # user subscribed topics
|
|
|
|
communities: [Int] # user participating communities
|
2021-08-20 23:17:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type Message {
|
|
|
|
author: Int!
|
|
|
|
body: String!
|
|
|
|
createdAt: DateTime!
|
|
|
|
id: Int!
|
|
|
|
replyTo: Int
|
|
|
|
updatedAt: DateTime!
|
|
|
|
visibleForUsers: [Int]!
|
|
|
|
}
|
|
|
|
|
2021-09-03 16:01:31 +00:00
|
|
|
type Comment {
|
|
|
|
id: Int!
|
|
|
|
author: Int!
|
|
|
|
body: String!
|
2021-09-05 07:16:28 +00:00
|
|
|
replyTo: Int!
|
2021-09-03 16:01:31 +00:00
|
|
|
createdAt: DateTime!
|
|
|
|
updatedAt: DateTime!
|
|
|
|
shout: Int!
|
|
|
|
deletedAt: DateTime
|
|
|
|
deletedBy: Int
|
|
|
|
rating: Int
|
|
|
|
ratigns: [Rating]
|
|
|
|
views: Int
|
|
|
|
old_id: String
|
|
|
|
}
|
|
|
|
|
2021-08-20 23:17:15 +00:00
|
|
|
# is publication
|
|
|
|
type Shout {
|
2021-08-28 10:13:50 +00:00
|
|
|
id: Int!
|
2021-08-26 21:14:20 +00:00
|
|
|
slug: String!
|
2021-08-20 23:18:10 +00:00
|
|
|
body: String!
|
2021-08-20 23:17:15 +00:00
|
|
|
createdAt: DateTime!
|
2021-09-05 07:16:28 +00:00
|
|
|
authors: [User!]!
|
|
|
|
comments: [Comment]
|
|
|
|
ratigns: [Rating]
|
|
|
|
visibleFor: [User]
|
|
|
|
community: Community
|
2021-08-26 21:14:20 +00:00
|
|
|
cover: String
|
|
|
|
layout: String
|
2021-08-20 23:17:15 +00:00
|
|
|
rating: Int
|
2021-09-05 07:16:28 +00:00
|
|
|
views: Int
|
|
|
|
replyTo: Shout
|
|
|
|
versionOf: Shout
|
2021-08-20 23:17:15 +00:00
|
|
|
tags: [String] # actual values
|
|
|
|
topics: [String] # topic-slugs, order has matter
|
|
|
|
title: String
|
2021-08-25 21:20:53 +00:00
|
|
|
subtitle: String
|
2021-09-05 07:16:28 +00:00
|
|
|
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-08-25 21:20:53 +00:00
|
|
|
old_id: String
|
2021-08-20 23:17:15 +00:00
|
|
|
}
|
|
|
|
|
2021-08-26 21:14:20 +00:00
|
|
|
type Community {
|
|
|
|
slug: String!
|
|
|
|
name: String!
|
|
|
|
desc: String
|
|
|
|
pic: String!
|
|
|
|
}
|
|
|
|
|
2021-08-20 23:17:15 +00:00
|
|
|
type Topic {
|
|
|
|
slug: String! # ID
|
|
|
|
createdBy: Int! # User
|
|
|
|
createdAt: DateTime!
|
|
|
|
value: String
|
|
|
|
desc: String
|
|
|
|
parents: [String] # NOTE: topic can have parent topics
|
|
|
|
children: [String] # and children
|
|
|
|
}
|
|
|
|
|
|
|
|
# TODO: resolvers to add/remove topics from publication
|
|
|
|
|
|
|
|
type Proposal {
|
|
|
|
body: String!
|
|
|
|
shout: Int!
|
|
|
|
range: String # full / 0:2340
|
|
|
|
author: Int!
|
|
|
|
createdAt: DateTime!
|
|
|
|
}
|
|
|
|
|
|
|
|
type Token {
|
|
|
|
createdAt: DateTime!
|
|
|
|
expiresAt: DateTime
|
|
|
|
id: Int!
|
|
|
|
ownerId: Int!
|
|
|
|
usedAt: DateTime
|
|
|
|
value: String!
|
2021-08-28 10:13:50 +00:00
|
|
|
}
|