81 lines
1.4 KiB
GraphQL
81 lines
1.4 KiB
GraphQL
![]() |
scalar DateTime
|
||
|
|
||
|
################################### Payload
|
||
|
|
||
|
type Result {
|
||
|
error: String
|
||
|
}
|
||
|
|
||
|
type MessageResult {
|
||
|
error: String
|
||
|
message: Message
|
||
|
}
|
||
|
|
||
|
enum MessageStatus {
|
||
|
NEW
|
||
|
UPDATED
|
||
|
DELETED
|
||
|
}
|
||
|
|
||
|
type ChatUpdatedResult {
|
||
|
error: String
|
||
|
status: MessageStatus
|
||
|
message: Message
|
||
|
}
|
||
|
|
||
|
type CreateChatResult {
|
||
|
chatId: String
|
||
|
error: String
|
||
|
}
|
||
|
|
||
|
type EnterChatResult {
|
||
|
chat: Chat
|
||
|
messages: [Message]
|
||
|
error: String
|
||
|
}
|
||
|
|
||
|
################################### Mutation
|
||
|
|
||
|
type Mutation {
|
||
|
# message
|
||
|
createChat(description: String): CreateChatResult!
|
||
|
createMessage(chatId: String!, body: String!, replyTo: Int): MessageResult!
|
||
|
updateMessage(chatId: String!, id: Int!, body: String!): MessageResult!
|
||
|
deleteMessage(chatId: String!, id: Int!): Result!
|
||
|
}
|
||
|
|
||
|
################################### Query
|
||
|
|
||
|
type Query {
|
||
|
# messages
|
||
|
enterChat(chatId: String!, size: Int = 50): EnterChatResult!
|
||
|
getMessages(chatId: String!, size: Int!, page: Int!): [Message]!
|
||
|
}
|
||
|
|
||
|
############################################ Subscription
|
||
|
|
||
|
type Subscription {
|
||
|
chatUpdated(chatId: String!): ChatUpdatedResult!
|
||
|
}
|
||
|
|
||
|
############################################ Entities
|
||
|
|
||
|
|
||
|
type Message {
|
||
|
author: String!
|
||
|
chatRoom: Int!
|
||
|
body: String!
|
||
|
createdAt: DateTime!
|
||
|
id: Int!
|
||
|
replyTo: Int
|
||
|
updatedAt: DateTime!
|
||
|
visibleForUsers: [Int]!
|
||
|
}
|
||
|
|
||
|
type Chat {
|
||
|
id: Int!
|
||
|
createdAt: DateTime!
|
||
|
updatedAt: DateTime!
|
||
|
description: String
|
||
|
}
|