Last active
August 19, 2020 12:58
-
-
Save dabit3/6762eed3f7ac098756e67abdc74cfdb2 to your computer and use it in GitHub Desktop.
AppSync Chat Schema
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Message { | |
id: ID! | |
content: String! | |
owner: String | |
createdAt: String | |
roomId: ID | |
} | |
type Room { | |
id: ID! | |
name: String | |
messages( | |
sortDirection: ModelSortDirection, | |
limit: Int, | |
nextToken: String | |
): MessageConnection | |
createdAt: AWSDateTime | |
updatedAt: AWSDateTime | |
} | |
enum ModelSortDirection { | |
ASC | |
DESC | |
} | |
type MessageConnection { | |
items: [Message] | |
nextToken: String | |
} | |
type RoomConnection { | |
items: [Room] | |
nextToken: String | |
} | |
type Query { | |
getRoom(id: ID): Room | |
listMessagesForRoom(roomId: ID, sortDirection: ModelSortDirection): MessageConnection | |
listRooms(limit: Int): RoomConnection | |
} | |
type Mutation { | |
createMessage(input: MessageInput): Message | |
createRoom(input: RoomInput): Room | |
} | |
input MessageInput { | |
id: ID | |
content: String! | |
owner: String | |
createdAt: String | |
roomId: ID | |
} | |
input RoomInput { | |
id: ID | |
name: String | |
} | |
type Subscription { | |
onCreateRoom: Room | |
@aws_subscribe(mutations: ["createRoom"]) | |
onCreateMessageByRoomId(roomId: ID): Message | |
@aws_subscribe(mutations: ["createMessage"]) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment