-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.graphql
55 lines (47 loc) · 941 Bytes
/
schema.graphql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
type Message {
id: ID!
content: String!
owner: String!
createdAt: AWSDateTime
roomId: ID!
}
type Room {
id: ID!
name: String
messages(
sortDirection: Order
limit: Int
nextToken: String
): MessageConnection
createdAt: AWSDateTime
}
enum Order {
ASC
DESC
}
type MessageConnection {
items: [Message]
nextToken: String
}
type RoomConnection {
items: [Room]
nextToken: String
}
type Query {
listMessagesForRoom(roomId: ID, sortDirection: Order): MessageConnection
listRooms(limit: Int): RoomConnection
}
type Mutation {
createMessage(input: MessageInput): Message
createRoom(name: String!): Room
deleteMessage(id: ID!): Message
}
input MessageInput {
content: String!
roomId: ID!
}
type Subscription {
onCreateRoom: Room @aws_subscribe(mutations: ["createRoom"])
onCreateMessageByRoomId(roomId: ID): Message
@aws_subscribe(mutations: ["createMessage", "deleteMessage"])
}