-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathswagger.yaml
More file actions
301 lines (284 loc) · 8.43 KB
/
swagger.yaml
File metadata and controls
301 lines (284 loc) · 8.43 KB
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
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
openapi: 3.0.0
info:
title: API Documentation
description: Mô tả tất cả API từ Fish Server
version: 1.0.0
servers:
- url: http://localhost:3000
description: Máy chủ phát triển
tags:
- name: invitation api
description: api để gửi thư mời user vô 1 thuyền
- name: ship api
description: api liên quan tới thuyền
- name: user api
description: api cơ bản cho người dùng
- name: admin api
description: api cho quản trị viên
components:
schemas:
CommonResponse:
type: object
properties:
timestamp:
type: string
format: date-time
description: Thời gian phản hồi
status:
type: string
description: Trạng thái của phản hồi (success, error, ...)
code:
type: integer
description: Mã phản hồi HTTP
message:
type: object
description: Phản hồi của ứng dụng
securitySchemes:
BearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
paths:
/admin/assign:
patch:
summary: gán quyền (role) cho người dùng
description: API này cho phép admin gán quyền hoặc nhiệm vụ cho một người dùng cụ thể.
tags:
- admin api
security:
- BearerAuth: []
parameters:
- name: email
in: query
required: true
schema:
type: string
- name: role
in: query
required: true
schema:
type: string
responses:
default:
description: Phản hồi chung cho mọi mã trạng thái
content:
application/json:
schema:
$ref: "#/components/schemas/CommonResponse"
/admin/getUser:
get:
summary: lấy thông tin tất cả user
description: API này cho phép lấy thông tin của tất cả người dùng
tags:
- admin api
security:
- BearerAuth: []
parameters:
- name: page
in: query
required: true
schema:
type: integer
default: 0
responses:
default:
description: Phản hồi chung cho mọi mã trạng thái
content:
application/json:
schema:
$ref: "#/components/schemas/CommonResponse"
/admin/deleteUser/{email}:
delete:
summary: xóa thông tin của user ra khỏi database
description: API này cho phép xóa thông tin của user ra khỏi database, đồng thời xóa luôn thuyền mà user đó sở hữu
tags:
- admin api
security:
- BearerAuth: []
# parameters:
responses:
default:
description: Phản hồi chung cho mọi mã trạng thái
content:
application/json:
schema:
$ref: "#/components/schemas/CommonResponse"
/api/info:
get:
summary: lấy thông tin người dùng
description: API này cho phép lấy thông tin của user
tags:
- user api
security:
- BearerAuth: []
responses:
default:
description: Phản hồi chung cho mọi mã trạng thái
content:
application/json:
schema:
$ref: "#/components/schemas/CommonResponse"
/api/changeDisplayName:
patch:
summary: đổi tên hiển thị
description: :v
tags:
- user api
security:
- BearerAuth: []
parameters:
- name: name
in: query
required: true
schema:
type: string
responses:
default:
description: Phản hồi chung cho mọi mã trạng thái
content:
application/json:
schema:
$ref: "#/components/schemas/CommonResponse"
/ship:
post:
summary: tạo thuyền mới
tags:
- ship api
security:
- BearerAuth: []
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
name:
type: string
crewSize:
type: integer
responses:
default:
description: Phản hồi chung cho mọi mã trạng thái
content:
application/json:
schema:
$ref: "#/components/schemas/CommonResponse"
get:
summary: lấy thông tin tất cả thuyền mà user sỡ hữu
tags:
- ship api
security:
- BearerAuth: []
responses:
default:
description: Phản hồi chung cho mọi mã trạng thái
content:
application/json:
schema:
$ref: "#/components/schemas/CommonResponse"
/ship/addMember:
post:
summary: Gửi thư mời thành viên khác lên thuyên
description: Gửi một email tồn tại trong 12 tiếng, email nãy sẽ chứa url đến <domain>/invitation/join/....
tags:
- ship api
security:
- BearerAuth: []
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
shipID:
type: string
userEmail:
type: string
responses:
default:
description: Phản hồi chung cho mọi mã trạng thái
content:
application/json:
schema:
$ref: "#/components/schemas/CommonResponse"
/ship/leave/{ship_id}:
get:
summary: Rời khỏi thuyền
description: API để out khỏi thuyền. Đối với owner, báo lỗi không thể out. Nếu thuyền không tồn tại, báo lỗi 404.
tags:
- ship api
security:
- BearerAuth: []
responses:
default:
description: Phản hồi chung cho mọi mã trạng thái
content:
application/json:
schema:
$ref: "#/components/schemas/CommonResponse"
/ship/promote/{user_id}:
get:
summary: Nhường quyền owner cho 1 thuyền viên
description: Nhường quyền owner cho 1 thuyền viên owner -> member & member -> owner. Báo lỗi 404 nếu user_id không tồn tại hoặc không có trên thuyền.
tags:
- ship api
security:
- BearerAuth: []
responses:
default:
description: Phản hồi chung cho mọi mã trạng thái
content:
application/json:
schema:
$ref: "#/components/schemas/CommonResponse"
/ship/delete/{ship_id}:
delete:
summary: Xóa 1 thuyền trong danh sách thuyền đã tạo của user
description: Xóa 1 thuyền trong danh sách thuyền đã tạo của user, nếu {ship_id} không tồn tại báo lỗi 404
tags:
- ship api
security:
- BearerAuth: []
responses:
default:
description: Phản hồi chung cho mọi mã trạng thái
content:
application/json:
schema:
$ref: "#/components/schemas/CommonResponse"
/ship/delete/{ship_id}/{user_id}:
delete:
summary: Xóa 1 thành viên ra khỏi thuyền
description: Xóa 1 thành viên ra khỏi thuyền, nếu {ship_id} / {user_id} không tồn tại báo lỗi 404
tags:
- ship api
security:
- BearerAuth: []
responses:
default:
description: Phản hồi chung cho mọi mã trạng thái
content:
application/json:
schema:
$ref: "#/components/schemas/CommonResponse"
/invitation/join/{invitation_id}:
post:
summary: chấp nhận lời mời
description: xóa dữ liệu sau khi chấp nhận (hoặc lỗi)
tags:
- invitation api
parameters:
- name: email
in: query
required: true
schema:
type: string
responses:
default:
description: Phản hồi chung cho mọi mã trạng thái
content:
application/json:
schema:
$ref: "#/components/schemas/CommonResponse"