core/schema.graphql

206 lines
4.0 KiB
GraphQL
Raw Normal View History

2021-07-13 10:14:48 +00:00
scalar DateTime
2021-07-27 04:51:16 +00:00
################################### Inputs
2021-07-13 10:14:48 +00:00
input registerUserInput {
email: String!
2021-07-29 17:26:15 +00:00
username: String
2021-07-13 10:14:48 +00:00
password: String!
}
2021-07-27 04:51:16 +00:00
input MessageInput {
body: String!
replyTo: Int
}
input updateMessageInput {
id: Int!
body: String!
}
################################### Payloads
2021-07-13 10:14:48 +00:00
type signInPayload {
status: Boolean!
error: String
token: String
}
type ResultPayload {
status: Boolean!
error: String
}
type createMessagePayload {
status: Boolean!
error: String
message: Message
}
2021-07-27 04:58:06 +00:00
type createShoutPayload {
status: Boolean!
error: String
shout: Shout
}
2021-07-27 04:51:16 +00:00
################################### Mutation
2021-07-13 10:14:48 +00:00
type Mutation {
# message
createMessage(input: MessageInput!): createMessagePayload!
updateMessage(input: updateMessageInput!): createMessagePayload!
deleteMessage(messageId: Int!): ResultPayload!
# auth
confirmEmail(token: String!): Token!
invalidateAllTokens: Boolean!
invalidateTokenById(id: Int!): Boolean!
requestEmailConfirmation: User!
requestPasswordReset(email: String!): Boolean!
resetPassword(password: String!, token: String!): Token!
registerUser(input: registerUserInput!): User!
# shout
2021-07-29 14:54:21 +00:00
createShout: Shout!
2021-07-27 04:58:06 +00:00
deleteShout(shoutId: Int!): Boolean!
2021-07-13 10:14:48 +00:00
rateShout(value: Int!): Boolean!
# profile
rateUser(value: Int!): Boolean!
updateOnlineStatus: Boolean!
updateUsername(username: String!): User!
}
2021-07-27 04:51:16 +00:00
################################### Query
2021-07-13 10:14:48 +00:00
type Query {
# auth / user
2021-07-14 14:45:31 +00:00
signIn(email: String!, password: String!): signInPayload!
2021-07-13 10:14:48 +00:00
signOut: ResultPayload!
2021-07-14 14:45:31 +00:00
getCurrentUser: User!
isEmailFree(email: String!): Boolean!
2021-07-13 10:14:48 +00:00
getOnline: [User!]!
getUserById(id: Int!): User!
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]!
topAuthors: [User]!
topShouts: [Shout]!
}
2021-07-27 04:51:16 +00:00
############################################ Subscription
type Subscription {
messageCreated: Message!
messageUpdated: Message!
messageDeleted: Message!
onlineUpdated: [User!]!
shoutUpdated: Shout!
userUpdated: User!
}
############################################ Entities
2021-07-13 10:14:48 +00:00
type Role {
2021-07-29 17:26:15 +00:00
id: Int!
2021-07-13 10:14:48 +00:00
name: String!
2021-07-29 17:26:15 +00:00
org: String!
level: Int! # 1-8
2021-07-28 17:29:51 +00:00
desc: String
2021-07-13 10:14:48 +00:00
}
2021-07-27 04:51:16 +00:00
type User {
createdAt: DateTime!
email: String
emailConfirmed: Boolean
id: Int!
muted: Boolean
rating: Int
roles: [Role!]!
updatedAt: DateTime!
username: String
userpic: String
userpicId: String
wasOnlineAt: DateTime
}
type Message {
author: Int!
body: String!
createdAt: DateTime!
id: Int!
replyTo: Int
updatedAt: DateTime!
2021-07-29 17:26:15 +00:00
visibleForUsers: [Int]!
2021-07-27 04:51:16 +00:00
}
# is publication
2021-07-13 10:14:48 +00:00
type Shout {
2021-07-28 17:29:51 +00:00
id: Int!
org: String!
slug: String!
2021-07-13 10:14:48 +00:00
author: Int!
body: String!
createdAt: DateTime!
2021-07-28 17:29:51 +00:00
updatedAt: DateTime!
2021-07-13 10:14:48 +00:00
deletedAt: DateTime
deletedBy: Int
rating: Int
2021-07-28 17:29:51 +00:00
published: DateTime # if there is no published field - it is not published
2021-07-13 10:14:48 +00:00
replyTo: Int # another shout
2021-07-27 04:51:16 +00:00
tags: [String] # actual values
2021-07-28 17:29:51 +00:00
topics: [String] # topic-slugs
2021-07-13 10:14:48 +00:00
title: String
versionOf: Int
2021-07-29 17:26:15 +00:00
visibleForRoles: [String] # role ids are strings
2021-07-13 10:14:48 +00:00
visibleForUsers: [Int]
}
2021-07-27 04:51:16 +00:00
type Topic {
2021-07-27 06:50:52 +00:00
slug: String! # ID
createdBy: Int! # User
2021-07-29 17:26:15 +00:00
createdAt: DateTime!
value: String
2021-07-27 04:51:16 +00:00
parents: [String] # NOTE: topic can have parent topics
children: [String] # and children
}
# TODO: resolvers to add/remove topics from publication
2021-07-13 10:14:48 +00:00
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-07-27 04:51:16 +00:00
type Like {
author: Int!
2021-07-13 10:14:48 +00:00
id: Int!
2021-07-29 17:26:15 +00:00
value: Int!
2021-07-27 04:51:16 +00:00
shout: Int
user: Int
2021-07-13 10:14:48 +00:00
}