-
Notifications
You must be signed in to change notification settings - Fork 0
/
typeDefs.js
270 lines (257 loc) · 4.76 KB
/
typeDefs.js
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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
const { gql } = require("apollo-server-express");
// meetTime: String
// details: String
// status: String
// message: String
// meetTime: String
// details: String
// status: String
// message: String
const typeDefs = gql`
type User {
id: ID!
imageUri: String
username: String!
emailAddress: String!
# password: String!
cart: [Product]!
store: String
interests: [Category]!
roomAddress: String
tel: String
}
type Cart {
product: Product!
quantity: Int!
extraData: [KeyValue]!
}
type SubData {
id: Int!
key: String
amount: Int
value: Int
}
type Content {
info: String!
status: Int!
subData: [SubData]
}
type Pricing {
plan: String!
description: String!
pricing: Int
content: [Content]!
}
# rating functionality to be resolved
type Transaction {
reference: String!
amount: Int!
paidAt: String!
userId: ID!
storeId: ID!
plan: Pricing!
subPlan: SubData
}
type RatingDist {
_5: Int!
_4: Int!
_3: Int!
_2: Int!
_1: Int!
}
type RatingData {
user: User!
rating: Int!
}
type Rating {
ratingDistribution: RatingDist
ratingData: RatingData
}
# comment functionality
type Comment {
user: User!
comment: String!
uploadTime: String!
likes: Int!
disLikes: Int!
}
type Product {
id: ID!
imageUri: String
name: String!
description: String!
price: Int!
tags: [String]!
extraData: [KeyValue]!
store: Store!
rating: [Rating]!
comments: [Comment]!
}
type Category {
id: ID!
name: String!
description: String
imageUri: String
popularity: Int!
}
type KeyValue {
key: String
values: [String]!
}
type Store {
id: ID!
name: String!
imageUri: String
description: String!
clientLimit: Int!
products: [Product]!
activated: Boolean!
}
type Order {
id: String!
user: User!
product: Product!
quantity: Int!
store: Store!
orderKey: String!
uploadTime: String!
updatedTime: String!
lastActive: String!
read: Boolean!
activated: Boolean!
}
type StoreMessage {
status: String!
message: String
store: Store
}
type UserMessage {
status: String!
message: String
user: User
isInterest: Boolean
}
type ProductMessage {
status: String!
message: String
product: Product
}
type GetProductMessage {
products: [Product!]!
isNext: Boolean
}
type CommentMessage {
status: String!
message: String
comment: Comment
}
type OrdersMessage {
status: String!
message: String
orders: [Order]
}
type ReadMessage {
status: String!
message: String
}
type IsOrderMessage {
status: Int!
message: String
}
type PricingMessage {
plans: String!
isNew: Boolean
}
type OrderMessage {
status: String!
isNext: Boolean
unPaid: Int
orders: [Order!]
}
type TransactionMessage {
status: String!
message: String
transactions: [Transaction]
}
input UserInput {
imageUri: String
username: String
tags: [ID]
tel: String
roomAddress: String
}
input ProductInput {
imageUri: String
name: String!
description: String!
price: Int!
tags: [String!]!
}
input StoreInput {
name: String!
imageUri: String
description: String!
}
input OrderInput {
productId: String!
storeId: String!
quantity: Int!
}
input OrderDetails {
quantity: Int
}
enum Type {
USER
STORE
}
type Query {
hello: String
getAdminOrders(page: Int!): OrderMessage!
getProducts(page: Int!): GetProductMessage!
getProduct(id: ID): Product!
user: User
getStore(id: ID!): StoreMessage!
getCategories: [Category]!
getOrders(type: Type!): OrderMessage!
search(search: String!): [Product]!
isOrder: IsOrderMessage!
getPricing: PricingMessage!
getTransactions: TransactionMessage!
}
type Mutation {
addUser(
username: String!
emailAddress: String!
password: String!
tel: String!
roomAddress: String!
): UserMessage!
addInterests(interests: [ID!]!): String!
register(email: String!, id: String!): UserMessage!
updateUser(data: UserInput): UserMessage!
login(username: String!, password: String!): UserMessage!
signS3(filename: String!, fileType: String!): String!
addStore(
name: String!
imageUri: String
description: String!
): StoreMessage
initStore: StoreMessage!
updateStore(id: ID!, store: StoreInput!): StoreMessage!
deleteStore(id: ID!): StoreMessage!
addProduct(product: ProductInput!): ProductMessage!
updateProduct(id: ID!, product: ProductInput!): ProductMessage!
deleteProduct(id: ID!): ProductMessage!
addComment(id: ID!, comment: String!): CommentMessage!
placeOrder(orders: [OrderInput]!): OrdersMessage!
updateOrder(
type: Type!
orderId: String!
order: OrderDetails!
): OrdersMessage!
markRead(type: Type!, ids: [ID]!): ReadMessage!
cancelOrder(type: Type!, id: ID!): OrdersMessage!
buyClients(ref: String!): Int!
}
`;
module.exports = typeDefs;