-
Notifications
You must be signed in to change notification settings - Fork 1
/
schema.graphql
executable file
·140 lines (122 loc) · 2.72 KB
/
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
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
directive @isEmail on FIELD | FIELD_DEFINITION
scalar Upload
type Subscription {
data(id: ID!): SubscriptionPayload
}
type Query {
conversations: [Conversation]!
users: [User!]!
search(query: String!): [User]!
messages(id: ID!): [Message]!
profile: User!
# ads: [Ad!]!
# campaignAds: [Ad!]!
# profile: UserPayload
# pickAd: AdPayload
}
type Mutation {
signup(phoneNumber: String!, password: String!, name: String!): LoginPayload
login(phoneNumber: String!, password: String!): LoginPayload
saveProfile(phoneNumber: String, name: String, birthday: String, gender: String, profilePhoto: Upload): User
addConversation(users: [ID!]!): Conversation
sendMessage(content: String!, files: [ChattyFileUpload], conversation: ID!): Message
deleteMessage(id: ID!): ResponsePayload
deleteConversation(id: ID!): ResponsePayload
updateCounter: String
singleUpload (file: Upload!): File!
# createAdmin(email: String!, password: String!, name: String!): AuthPayload
# postAd(url: String!, price: Int!, duration: Int!, description: String, startAfterApprove: Boolean!): AdPayload
# updateAd(id: ID!, data: AdUpdateInput!): AdPayload
# watchAd(id: ID!): AdPayload
# deleteAd(id: ID!): UserPayload
# updateProfile(username: String, email: String): UserPayload
}
type User {
_id: ID!
name: String!
phoneNumber: String!
confirmed: Boolean!
#email: String! @isEmail
birthday: String
gender: String
password: String!
friends: [User]!
conversations: [Conversation]!
createdAt: Float!
modifiedAt: Float!
isPrivate: Boolean!
profilePhoto: String
}
type Conversation {
_id: ID!
messages: [Message]!
users: [User!]!
createdAt: Float!
modifiedAt: Float!
lastMessage: Message
}
type Message {
_id: ID!
content: String!
files: [ChattyFile!]
sender: User!
createdAt: Float!
modifiedAt: Float!
isLoggedUser: Boolean!
}
input ChattyFileUpload {
file: Upload!
thumbnail: Upload!
}
type ChattyFile {
file: String!
thumbnail: String
}
type AuthPayload {
user: User
token: String
error: String
}
type LoginPayload {
userId: String
token: String
error: String
}
# input AdUpdateInput {
# url: String
# price: Int
# totalPrice: Int
# duration: Int
# description: String
# startAfterApprove: Boolean
# isRunning: Boolean
# }
# type MessagePayload {
# message: String!
# }
# type AdPayload {
# ad: Ad,
# message: String
# error: String
# }
# type UserPayload {
# user: User,
# message: String
# error: String
# }
type ResponsePayload {
error: String
success: String
}
type SubscriptionPayload {
conversation: Conversation
message: Message
update: Boolean!
}
type File {
id: ID!
path: String!
filename: String!
mimetype: String!
encoding: String!
}