core/schema.graphql

207 lines
4.1 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
2021-08-04 13:38:56 +00:00
type Result {
error: String
2021-08-01 11:40:24 +00:00
}
2021-08-09 05:49:31 +00:00
type AuthResult {
2021-08-04 13:38:56 +00:00
error: String
token: String
user: User
2021-08-01 11:40:24 +00:00
}
2021-08-04 13:38:56 +00:00
type UserResult {
error: String
user: User
2021-08-01 11:40:24 +00:00
}
2021-08-04 13:38:56 +00:00
type MessageResult {
error: String
message: Message
2021-08-01 11:40:24 +00:00
}
2021-08-08 12:23:12 +00:00
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]
}
2021-08-09 05:49:31 +00:00
input ProfileInput {
email: String
username: String
userpic: String
}
2021-08-04 13:38:56 +00:00
type ShoutResult {
2021-07-13 10:14:48 +00:00
error: String
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-08-04 13:38:56 +00:00
createMessage(body: String!, replyTo: Int): MessageResult!
updateMessage(id: Int!, body: String!): MessageResult!
deleteMessage(messageId: Int!): Result!
2021-07-13 10:14:48 +00:00
# auth
2021-07-30 12:53:22 +00:00
# resetPassword(password: String!, token: String!): Token!
2021-08-09 05:49:31 +00:00
confirmEmail(token: String!): AuthResult!
2021-07-30 12:53:22 +00:00
# invalidateAllTokens: Boolean!
# invalidateTokenById(id: Int!): Boolean!
# requestEmailConfirmation: User!
# requestPasswordReset(email: String!): Boolean!
2021-08-09 05:49:31 +00:00
registerUser(email: String!, password: String!): AuthResult!
2021-07-13 10:14:48 +00:00
# shout
2021-08-08 12:23:12 +00:00
createShout(input: ShoutInput!): ShoutResult!
deleteShout(slug: String!): Result!
rateShout(slug: String!, value: Int!): Result!
2021-07-13 10:14:48 +00:00
2021-08-09 05:49:31 +00:00
# user profile
2021-07-30 12:53:22 +00:00
# rateUser(value: Int!): ResultPayload!
# updateOnlineStatus: ResultPayload!
2021-08-09 05:54:44 +00:00
updateProfile(profile: ProfileInput!): Result!
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 {
2021-08-09 05:49:31 +00:00
# auth
isEmailFree(email: String!): Result!
signIn(email: String!, password: String!): AuthResult!
2021-08-04 13:38:56 +00:00
signOut: Result!
2021-08-09 05:49:31 +00:00
# user profile
2021-08-04 13:38:56 +00:00
getCurrentUser: UserResult!
2021-08-09 05:49:31 +00:00
getUserById(id: Int!): UserResult!
2021-07-30 12:53:22 +00:00
# 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!]!
2021-08-07 16:14:20 +00:00
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
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-08-08 10:33:33 +00:00
replyTo: String # 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
2021-08-08 10:33:33 +00:00
versionOf: String
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
}