core/schema.graphql

168 lines
3.3 KiB
GraphQL
Raw Normal View History

2021-07-13 10:14:48 +00:00
scalar DateTime
input registerUserInput {
email: String!
username: String!
password: String!
}
type signInPayload {
status: Boolean!
error: String
token: String
}
type ResultPayload {
status: Boolean!
error: String
}
type Like {
author: Int!
id: Int!
shout: Int
user: Int
value: Int!
}
type createMessagePayload {
status: Boolean!
error: String
message: Message
}
input MessageInput {
body: String!
replyTo: Int
}
input updateMessageInput {
id: Int!
body: String!
}
type Message {
author: Int!
body: String!
createdAt: DateTime!
id: Int!
replyTo: Int
updatedAt: DateTime!
visibleForUsers: [Int]
}
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
createShout(body: String!, replyTo: [Int], title: String, versionOf: [Int], visibleForRoles: [Int], visibleForUsers: [Int]): Message!
deleteShout(shoutId: Int!): Message!
rateShout(value: Int!): Boolean!
# profile
rateUser(value: Int!): Boolean!
updateOnlineStatus: Boolean!
updateUsername(username: String!): User!
}
type Query {
# auth / user
signIn(id: Int!, password: String!): signInPayload!
signOut: ResultPayload!
getCurrentUser: User!
getTokens: [Token!]!
isUsernameFree(username: String!): Boolean!
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]!
}
type Role {
id: Int!
name: String!
}
type Shout {
author: Int!
body: String!
createdAt: DateTime!
deletedAt: DateTime
deletedBy: Int
id: Int!
rating: Int
published: DateTime! # if there is no published field - it is not published
replyTo: Int # another shout
tags: [String]
title: String
updatedAt: DateTime!
versionOf: Int
visibleForRoles: [Role]!
visibleForUsers: [Int]
}
type Proposal {
body: String!
shout: Int!
range: String # full / 0:2340
author: Int!
createdAt: DateTime!
}
type Subscription {
messageCreated: Message!
messageUpdated: Message!
messageDeleted: Message!
onlineUpdated: [User!]!
shoutUpdated: Shout!
userUpdated: User!
}
type Token {
createdAt: DateTime!
expiresAt: DateTime
id: Int!
ownerId: Int!
usedAt: DateTime
value: String!
}
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
}