2023-10-03 14:15:17 +00:00
|
|
|
enum MessageStatus {
|
2023-10-06 10:01:47 +00:00
|
|
|
NEW
|
|
|
|
UPDATED
|
|
|
|
DELETED
|
2023-10-03 14:15:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type ChatMember {
|
|
|
|
id: Int!
|
|
|
|
slug: String!
|
|
|
|
name: String!
|
2023-11-24 02:20:16 +00:00
|
|
|
pic: String
|
2023-11-16 14:58:14 +00:00
|
|
|
last_seen: Int!
|
2023-10-03 14:15:17 +00:00
|
|
|
online: Boolean
|
|
|
|
# invitedAt: DateTime
|
|
|
|
# invitedBy: String # user slug
|
|
|
|
# TODO: keep invite databit
|
|
|
|
}
|
|
|
|
|
|
|
|
input ChatInput {
|
|
|
|
id: String!
|
|
|
|
title: String
|
|
|
|
description: String
|
|
|
|
}
|
|
|
|
|
2023-11-17 08:51:15 +00:00
|
|
|
input MessageInput {
|
|
|
|
id: String!
|
|
|
|
chat_id: String!
|
|
|
|
body: String
|
|
|
|
seen: Boolean
|
|
|
|
}
|
|
|
|
|
2023-10-06 10:01:47 +00:00
|
|
|
type ChatResult {
|
2023-10-04 21:32:50 +00:00
|
|
|
error: String
|
|
|
|
chat: Chat
|
|
|
|
chats: [Chat]
|
|
|
|
message: Message
|
|
|
|
messages: [Message]
|
|
|
|
members: [ChatMember]
|
|
|
|
}
|
|
|
|
|
2023-10-03 14:15:17 +00:00
|
|
|
|
|
|
|
type Mutation {
|
2023-10-06 10:01:47 +00:00
|
|
|
# inbox
|
2023-11-28 08:33:50 +00:00
|
|
|
create_chat(title: String, members: [Int]!): ChatResult!
|
|
|
|
update_chat(chat: ChatInput!): ChatResult!
|
|
|
|
delete_chat(chat_id: String!): ChatResult!
|
2023-10-03 14:15:17 +00:00
|
|
|
|
2023-11-28 08:33:50 +00:00
|
|
|
create_message(chat_id: String!, body: String!, reply_to: Int): ChatResult!
|
|
|
|
update_message(message: MessageInput!): ChatResult!
|
|
|
|
delete_message(chat_id: String!, message_id: Int!): ChatResult!
|
|
|
|
mark_as_read(chat_id: String!, message_id: Int!): ChatResult!
|
2023-10-03 14:15:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
input MessagesBy {
|
2023-11-17 09:10:36 +00:00
|
|
|
created_by: String
|
2023-10-03 14:15:17 +00:00
|
|
|
body: String
|
|
|
|
chat: String
|
|
|
|
order: String
|
|
|
|
days: Int
|
|
|
|
stat: String
|
|
|
|
}
|
|
|
|
|
|
|
|
type Query {
|
2023-10-06 03:38:04 +00:00
|
|
|
# inbox
|
2023-11-28 08:33:50 +00:00
|
|
|
load_chats(limit: Int, offset: Int): ChatResult! # your chats
|
|
|
|
load_messages_by(by: MessagesBy!, limit: Int, offset: Int): ChatResult!
|
|
|
|
search_recipients(query: String!, limit: Int, offset: Int): ChatResult!
|
|
|
|
search_messages(by: MessagesBy!, limit: Int, offset: Int): ChatResult!
|
2023-12-02 11:04:04 +00:00
|
|
|
# _service: _Service!
|
2023-10-03 14:15:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type Message {
|
2023-11-17 08:51:15 +00:00
|
|
|
id: Int!
|
2023-11-17 09:10:36 +00:00
|
|
|
created_by: Int!
|
2023-11-17 08:51:15 +00:00
|
|
|
created_at: Int!
|
2023-11-16 15:28:16 +00:00
|
|
|
chat_id: String!
|
2023-10-06 10:01:47 +00:00
|
|
|
body: String!
|
2023-11-16 14:58:14 +00:00
|
|
|
updated_at: Int
|
2023-11-17 08:51:15 +00:00
|
|
|
reply_to: Int
|
2023-10-06 10:01:47 +00:00
|
|
|
seen: Boolean
|
2023-10-03 14:15:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type Chat {
|
2023-10-06 10:01:47 +00:00
|
|
|
id: String!
|
2023-11-17 08:51:15 +00:00
|
|
|
created_by: Int! # member_id
|
2023-11-16 14:58:14 +00:00
|
|
|
created_at: Int!
|
2023-10-06 10:01:47 +00:00
|
|
|
members: [ChatMember]
|
|
|
|
admins: [Int]
|
2023-11-17 08:51:15 +00:00
|
|
|
updated_at: Int
|
|
|
|
title: String
|
|
|
|
description: String
|
2023-10-06 10:01:47 +00:00
|
|
|
messages: [Message]
|
|
|
|
unread: Int
|
2023-10-03 14:15:17 +00:00
|
|
|
}
|