200 lines
4.0 KiB
GraphQL
200 lines
4.0 KiB
GraphQL
scalar DateTime
|
|
|
|
################################### Payload
|
|
|
|
type Result {
|
|
error: String
|
|
}
|
|
|
|
type SignInResult {
|
|
error: String
|
|
token: String
|
|
user: User
|
|
}
|
|
|
|
type UserResult {
|
|
error: String
|
|
user: User
|
|
}
|
|
|
|
type MessageResult {
|
|
error: String
|
|
message: Message
|
|
}
|
|
|
|
input ShoutInput {
|
|
org: String!
|
|
slug: String!
|
|
body: String!
|
|
replyTo: String # another shout
|
|
tags: [String] # actual values
|
|
topics: [String] # topic-slugs
|
|
title: String
|
|
versionOf: String
|
|
visibleForRoles: [String] # role ids are strings
|
|
visibleForUsers: [Int]
|
|
}
|
|
|
|
type ShoutResult {
|
|
error: String
|
|
shout: Shout
|
|
}
|
|
|
|
################################### Mutation
|
|
|
|
type Mutation {
|
|
# message
|
|
createMessage(body: String!, replyTo: Int): MessageResult!
|
|
updateMessage(id: Int!, body: String!): MessageResult!
|
|
deleteMessage(messageId: Int!): Result!
|
|
|
|
# auth
|
|
# resetPassword(password: String!, token: String!): Token!
|
|
confirmEmail(token: String!): SignInResult!
|
|
# invalidateAllTokens: Boolean!
|
|
# invalidateTokenById(id: Int!): Boolean!
|
|
# requestEmailConfirmation: User!
|
|
# requestPasswordReset(email: String!): Boolean!
|
|
registerUser(email: String!, password: String!): SignInResult!
|
|
|
|
# shout
|
|
createShout(input: ShoutInput!): ShoutResult!
|
|
deleteShout(slug: String!): Result!
|
|
rateShout(slug: String!, value: Int!): Result!
|
|
|
|
# profile
|
|
# rateUser(value: Int!): ResultPayload!
|
|
# updateOnlineStatus: ResultPayload!
|
|
# updateUsername(username: String!): ResultPayload!
|
|
}
|
|
|
|
################################### Query
|
|
|
|
type Query {
|
|
# auth / user
|
|
isEmailFree(email: String!): Boolean!
|
|
signIn(email: String!, password: String!): SignInResult!
|
|
signOut: Result!
|
|
getCurrentUser: UserResult!
|
|
# getUserById(id: Int!): ResultPayload!
|
|
# getUserRating(shout: Int): Int!
|
|
|
|
# messages
|
|
getMessages(count: Int = 100, page: Int = 1): [Message!]!
|
|
|
|
# shouts
|
|
# getShoutRating(shout: Int): Int!
|
|
# shoutsByAuthor(author: Int): [Shout]!
|
|
# shoutsByReplyTo(shout: Int): [Shout]!
|
|
# shoutsByTags(tags: [String]): [Shout]!
|
|
# shoutsByTime(time: DateTime): [Shout]!
|
|
|
|
# getOnlineUsers: [User!]!
|
|
topAuthors: [User]!
|
|
topShouts: [Shout]!
|
|
}
|
|
|
|
############################################ Subscription
|
|
|
|
type Subscription {
|
|
messageCreated: Message!
|
|
messageUpdated: Message!
|
|
messageDeleted: Message!
|
|
|
|
onlineUpdated: [User!]!
|
|
shoutUpdated: Shout!
|
|
userUpdated: User!
|
|
}
|
|
|
|
############################################ Entities
|
|
|
|
type Role {
|
|
id: Int!
|
|
name: String!
|
|
org: String!
|
|
level: Int! # 1-8
|
|
desc: String
|
|
}
|
|
|
|
type User {
|
|
createdAt: DateTime!
|
|
email: String
|
|
emailConfirmed: Boolean
|
|
id: Int!
|
|
muted: Boolean
|
|
rating: Int
|
|
roles: [Role!]!
|
|
updatedAt: DateTime!
|
|
username: String
|
|
userpic: String
|
|
wasOnlineAt: DateTime
|
|
}
|
|
|
|
type Message {
|
|
author: Int!
|
|
body: String!
|
|
createdAt: DateTime!
|
|
id: Int!
|
|
replyTo: Int
|
|
updatedAt: DateTime!
|
|
visibleForUsers: [Int]!
|
|
}
|
|
|
|
# is publication
|
|
type Shout {
|
|
org: String!
|
|
slug: String!
|
|
author: Int!
|
|
body: String!
|
|
createdAt: DateTime!
|
|
updatedAt: DateTime!
|
|
deletedAt: DateTime
|
|
deletedBy: Int
|
|
rating: Int
|
|
published: DateTime # if there is no published field - it is not published
|
|
replyTo: String # another shout
|
|
tags: [String] # actual values
|
|
topics: [String] # topic-slugs
|
|
title: String
|
|
versionOf: String
|
|
visibleForRoles: [String] # role ids are strings
|
|
visibleForUsers: [Int]
|
|
}
|
|
|
|
type Topic {
|
|
slug: String! # ID
|
|
createdBy: Int! # User
|
|
createdAt: DateTime!
|
|
value: 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!
|
|
}
|
|
|
|
type Like {
|
|
author: Int!
|
|
id: Int!
|
|
value: Int!
|
|
shout: Int
|
|
user: Int
|
|
}
|