core/schema.graphql

172 lines
3.6 KiB
GraphQL
Raw Normal View History

2021-07-13 10:14:48 +00:00
scalar DateTime
2021-07-29 20:49:17 +00:00
################################### Payload
2021-07-13 10:14:48 +00:00
type ResultPayload {
status: Boolean!
error: String
2021-07-29 20:50:31 +00:00
token: String
2021-07-29 20:49:17 +00:00
user: User
2021-07-13 10:14:48 +00:00
message: Message
2021-07-27 04:58:06 +00:00
shout: Shout
}
2021-07-27 04:51:16 +00:00
################################### Mutation
2021-07-13 10:14:48 +00:00
type Mutation {
# message
2021-07-29 20:49:17 +00:00
createMessage(body: String!, replyTo: Int): ResultPayload!
updateMessage(id: Int!, body: String!): ResultPayload!
2021-07-13 10:14:48 +00:00
deleteMessage(messageId: Int!): ResultPayload!
# auth
2021-07-30 12:53:22 +00:00
# resetPassword(password: String!, token: String!): Token!
confirmEmail(token: String!): ResultPayload!
# invalidateAllTokens: Boolean!
# invalidateTokenById(id: Int!): Boolean!
# requestEmailConfirmation: User!
# requestPasswordReset(email: String!): Boolean!
2021-07-29 20:55:55 +00:00
registerUser(email: String!, password: String!): ResultPayload!
2021-07-13 10:14:48 +00:00
# shout
2021-07-29 20:49:17 +00:00
createShout: ResultPayload!
deleteShout(shoutId: Int!): ResultPayload!
rateShout(value: Int!): ResultPayload!
2021-07-13 10:14:48 +00:00
# profile
2021-07-30 12:53:22 +00:00
# rateUser(value: Int!): ResultPayload!
# updateOnlineStatus: ResultPayload!
# updateUsername(username: String!): ResultPayload!
2021-07-13 10:14:48 +00:00
}
2021-07-27 04:51:16 +00:00
################################### Query
2021-07-13 10:14:48 +00:00
type Query {
# auth / user
2021-07-29 20:49:17 +00:00
isEmailFree(email: String!): ResultPayload!
2021-07-29 20:55:55 +00:00
signIn(email: String!, password: String!): ResultPayload!
2021-07-13 10:14:48 +00:00
signOut: ResultPayload!
2021-07-29 20:49:17 +00:00
getCurrentUser: ResultPayload!
2021-07-30 12:53:22 +00:00
# getUserById(id: Int!): ResultPayload!
# getUserRating(shout: Int): Int!
2021-07-13 10:14:48 +00:00
# messages
getMessages(count: Int = 100, page: Int = 1): [Message!]!
# shouts
2021-07-30 12:53:22 +00:00
# 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]!
2021-07-13 10:14:48 +00:00
}
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
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
}