core/inbox_schema.graphql

88 lines
1.5 KiB
GraphQL
Raw Normal View History

2022-02-22 11:44:01 +00:00
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
}
2022-06-11 14:35:10 +00:00
type UserChatsResult {
error: String
chats: [String]
}
2022-02-22 11:44:01 +00:00
################################### 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!
2022-04-13 11:43:22 +00:00
markAsRead(chatId: String!, ids: [Int]!): Result!
2022-02-22 11:44:01 +00:00
}
################################### Query
type Query {
2022-06-11 14:35:10 +00:00
userChats: UserChatsResult!
2022-02-22 11:44:01 +00:00
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
}