-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.gql
204 lines (179 loc) · 3.99 KB
/
schema.gql
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
# -----------------------------------------------
# !!! THIS FILE WAS GENERATED BY TYPE-GRAPHQL !!!
# !!! DO NOT MODIFY THIS FILE BY YOURSELF !!!
# -----------------------------------------------
type Author {
books: [Book!]!
id: Float!
name: String!
}
type Book {
author: Author!
cover: String!
createdAt: DateTime!
description: String!
id: Float!
loans: [Loan!]!
owner: Member!
reservations: [Reservation!]!
status: String
subtitle: String
tags: [Tag!]!
textSnippet: String!
thumbnail: String
title: String!
updatedAt: DateTime!
}
type BookResponse {
book: Book
message: String
}
input BookUpdateInput {
author: String!
description: String!
id: Int!
subtitle: String
title: String!
}
type Conversation {
createdAt: DateTime!
id: Float!
latestMessage: Message
messages: [Message!]!
participants: [ConversationParticipant!]!
updatedAt: DateTime!
}
type ConversationParticipant {
conversation: Conversation!
createdAt: DateTime!
hasSeenLatestMessage: Boolean!
id: Float!
unreadMessages: Float
updatedAt: DateTime!
userId: Float!
}
type ConversationResponse {
conversation: Conversation
error: String
}
"""
The javascript `Date` as string. Type represents date and time as the ISO Date string.
"""
scalar DateTime
type FieldError {
field: String!
message: String!
}
type Loan {
book: Book!
borrower: Member!
createdAt: DateTime!
id: Float!
lender: Member!
loanOverdue: Boolean!
returnDate: DateTime!
status: String
updatedAt: DateTime!
}
input LoginInput {
email: String
password: String!
phoneNumber: String
}
type Member {
books: [Book!]!
email: String!
id: Float!
phoneNumber: String!
unreadMessages: Float
username: String!
}
type MemberResponse {
error: [FieldError!]
member: Member
}
type Message {
body: String!
conversation: Conversation!
createdAt: DateTime!
id: Float!
sender: Member!
updatedAt: DateTime!
}
input MessageInput {
body: String!
conversationId: Float!
sender: Float!
}
type Mutation {
addAuthor(newAuthorData: NewAuthorInput!): Author!
addBook(newBookData: NewBookInput!): BookResponse!
addTag(name: String!): Author!
borrow(id: Float!): BookResponse!
changePassword(newPassword: String!, token: String!): Member!
createConversation(createConversationData: conversationsInput!): ConversationResponse!
deleteBook(id: Float!): Int!
forgotPassword(email: String!): Boolean!
login(loginInput: LoginInput!): MemberResponse!
logout: Boolean!
markConversationAsRead(conversationId: Float!): Conversation!
markNotificationsAsRead: Member!
register(newMemberData: NewMemberInput!): MemberResponse!
reserve(id: Float!): BookResponse!
sendMessage(messageData: MessageInput!): Message!
updateBook(cover: Upload, options: BookUpdateInput!): BookResponse!
}
input NewAuthorInput {
name: String!
}
input NewBookInput {
author: String!
tag: String!
title: String!
}
input NewMemberInput {
email: String!
password: String!
phoneNumber: String!
username: String!
}
type Query {
conversations: [Conversation!]!
currentUser: Member!
getAuthors: [Author!]!
getBookById(id: Float!): Book!
getBooks: [Book!]!
getBooksByOwner(ownerId: Float!): [Book!]!
getTags: [Tag!]!
loans: [Loan!]!
loansByLenderId(lenderId: Float!): [Loan!]!
messages(conversationId: Float!): [Message!]!
reservations: [Reservation!]!
reservationsByLenderId(lenderId: Float!): [Reservation!]!
searchBook(searchTerm: String!): [Book!]!
}
type Reservation {
book: Book!
createdAt: DateTime!
id: Float!
lender: Member!
reserver: Member!
status: String!
toBorrowDate: Int!
updatedAt: DateTime!
}
type Subscription {
messageSent(conversationId: Float!): Message!
newNotification(userId: Float!): Member!
updatedConversation(conversationId: Float!): Conversation!
}
type Tag {
books: [Book!]!
id: Float!
name: String!
}
"""The `Upload` scalar type represents a file upload."""
scalar Upload
input conversationsInput {
participantIds: [Int!]!
}