n_base_rails 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +5 -0
- data/CODE_OF_CONDUCT.md +84 -0
- data/Gemfile +8 -0
- data/LICENSE.txt +21 -0
- data/README.md +49 -0
- data/Rakefile +4 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/lib/.env +4 -0
- data/lib/.rspec +1 -0
- data/lib/.rubocop.yml +288 -0
- data/lib/.rubocop_disabled.yml +31 -0
- data/lib/.rubocop_enabled.yml +0 -0
- data/lib/Capfile +46 -0
- data/lib/Gemfile +51 -0
- data/lib/config/database.yml +24 -0
- data/lib/config/deploy/development.rb +85 -0
- data/lib/config/deploy/production.rb +63 -0
- data/lib/config/deploy/staging.rb +56 -0
- data/lib/config/deploy.rb +7 -0
- data/lib/config/initializers/devise.rb +315 -0
- data/lib/config/locales/devise.en.yml +65 -0
- data/lib/config/locales/en.yml +33 -0
- data/lib/config/locales/errors.en.yml +57 -0
- data/lib/config/routes.rb +26 -0
- data/lib/config/settings.yml +22 -0
- data/lib/controllers/api/admin/base_controller.rb +5 -0
- data/lib/controllers/api/admin/sessions_controller.rb +39 -0
- data/lib/controllers/api/admin/users_controller.rb +9 -0
- data/lib/controllers/api/v1/base_controller.rb +5 -0
- data/lib/controllers/api/v1/sessions_controller.rb +39 -0
- data/lib/controllers/api/v1/users_controller.rb +7 -0
- data/lib/controllers/application_controller.rb +30 -0
- data/lib/controllers/concerns/.DS_Store +0 -0
- data/lib/controllers/concerns/.keep +0 -0
- data/lib/controllers/concerns/base_concern.rb +9 -0
- data/lib/controllers/concerns/json_renderer.rb +76 -0
- data/lib/controllers/concerns/pagination.rb +32 -0
- data/lib/controllers/concerns/rescue_exception.rb +73 -0
- data/lib/db/migrate/20220721091426_devise_create_users.rb +46 -0
- data/lib/db/migrate/20230113072522_create_devices.rb +13 -0
- data/lib/db/migrate/20230227135020_create_posts.rb +15 -0
- data/lib/db/migrate/20230303165318_devise_create_admins.rb +46 -0
- data/lib/db/schema.rb +62 -0
- data/lib/db/seeds.rb +7 -0
- data/lib/generators/n_base_rails/install_generator.rb +42 -0
- data/lib/lib/.DS_Store +0 -0
- data/lib/lib/active_record_validation/error.rb +33 -0
- data/lib/lib/api/error.rb +63 -0
- data/lib/lib/json_web_token.rb +13 -0
- data/lib/log/.keep +0 -0
- data/lib/log/capistrano.log +28367 -0
- data/lib/log/development.log +30201 -0
- data/lib/log/test.log +11768 -0
- data/lib/models/admin.rb +10 -0
- data/lib/models/application_record.rb +5 -0
- data/lib/models/concerns/.keep +0 -0
- data/lib/models/device.rb +11 -0
- data/lib/models/post.rb +5 -0
- data/lib/models/user.rb +9 -0
- data/lib/n_base_rails/version.rb +5 -0
- data/lib/n_base_rails.rb +9 -0
- data/lib/public/404.html +67 -0
- data/lib/public/422.html +67 -0
- data/lib/public/500.html +66 -0
- data/lib/public/apple-touch-icon-precomposed.png +0 -0
- data/lib/public/apple-touch-icon.png +0 -0
- data/lib/public/docs/api/admin/definitions/users.yaml +15 -0
- data/lib/public/docs/api/admin/paths/index.yaml +29 -0
- data/lib/public/docs/api/admin/paths/sessions.yaml +121 -0
- data/lib/public/docs/api/admin/paths/users.yaml +39 -0
- data/lib/public/docs/api/shared/meta_infos.yaml +41 -0
- data/lib/public/docs/api/shared/unauthorized_response.yaml +31 -0
- data/lib/public/docs/api/v1/definitions/users.yaml +13 -0
- data/lib/public/docs/api/v1/paths/example.yaml +431 -0
- data/lib/public/docs/api/v1/paths/index.yaml +28 -0
- data/lib/public/docs/api/v1/paths/sessions.yaml +121 -0
- data/lib/public/docs/api/v1/paths/users.yaml +24 -0
- data/lib/public/favicon.ico +0 -0
- data/lib/public/robots.txt +1 -0
- data/lib/public/swagger/admin/admin-swagger-initializer.js +24 -0
- data/lib/public/swagger/admin/admin.html +19 -0
- data/lib/public/swagger/favicon-16x16.png +0 -0
- data/lib/public/swagger/favicon-32x32.png +0 -0
- data/lib/public/swagger/index.css +16 -0
- data/lib/public/swagger/oauth2-redirect.html +79 -0
- data/lib/public/swagger/swagger-ui-bundle.js +3 -0
- data/lib/public/swagger/swagger-ui-bundle.js.map +1 -0
- data/lib/public/swagger/swagger-ui-es-bundle-core.js +2 -0
- data/lib/public/swagger/swagger-ui-es-bundle-core.js.map +1 -0
- data/lib/public/swagger/swagger-ui-es-bundle.js +3 -0
- data/lib/public/swagger/swagger-ui-es-bundle.js.map +1 -0
- data/lib/public/swagger/swagger-ui-standalone-preset.js +3 -0
- data/lib/public/swagger/swagger-ui-standalone-preset.js.map +1 -0
- data/lib/public/swagger/swagger-ui.css +4 -0
- data/lib/public/swagger/swagger-ui.css.map +1 -0
- data/lib/public/swagger/swagger-ui.js +2 -0
- data/lib/public/swagger/swagger-ui.js.map +1 -0
- data/lib/public/swagger/v1/app.html +19 -0
- data/lib/public/swagger/v1/swagger-initializer.js +25 -0
- data/lib/serializers/.DS_Store +0 -0
- data/lib/serializers/action_not_allowed_serializer.rb +18 -0
- data/lib/serializers/api/.DS_Store +0 -0
- data/lib/serializers/api/admin/base_serializer.rb +14 -0
- data/lib/serializers/api/admin/hash_serializer.rb +22 -0
- data/lib/serializers/api/admin/user_serializer.rb +9 -0
- data/lib/serializers/api/v1/base_serializer.rb +14 -0
- data/lib/serializers/api/v1/hash_serializer.rb +22 -0
- data/lib/serializers/api/v1/user_serializer.rb +9 -0
- data/lib/serializers/record_not_found_serializer.rb +28 -0
- data/lib/serializers/validation_error_serializer.rb +45 -0
- data/lib/services/api/admin/generate_access_token_service.rb +34 -0
- data/lib/services/api/admin/generate_refresh_token_service.rb +24 -0
- data/lib/services/api/authorize_request_service.rb +35 -0
- data/lib/services/api/v1/generate_access_token_service.rb +34 -0
- data/lib/services/api/v1/generate_refresh_token_service.rb +24 -0
- data/lib/spec/controllers/api/admin/sessions_controller_spec.rb +125 -0
- data/lib/spec/controllers/api/admin/users_controller_spec.rb +35 -0
- data/lib/spec/controllers/api/v1/sessions_controller_spec.rb +125 -0
- data/lib/spec/controllers/api/v1/users_controller_spec.rb +23 -0
- data/lib/spec/factories/admins.rb +8 -0
- data/lib/spec/factories/devices.rb +7 -0
- data/lib/spec/factories/posts.rb +6 -0
- data/lib/spec/factories/users.rb +8 -0
- data/lib/spec/helpers/request_helpers.rb +7 -0
- data/lib/spec/models/admin_spec.rb +9 -0
- data/lib/spec/models/device_spec.rb +13 -0
- data/lib/spec/models/post_spec.rb +6 -0
- data/lib/spec/models/user_spec.rb +9 -0
- data/lib/spec/rails_helper.rb +66 -0
- data/lib/spec/serializers/api/admin/user_serializer.rb +20 -0
- data/lib/spec/serializers/api/v1/user_serializer.rb +20 -0
- data/lib/spec/spec_helper.rb +94 -0
- data/lib/spec/supports/shared_context.rb +19 -0
- data/lib/spec/supports/shared_example/admin_authentication.rb +47 -0
- data/lib/spec/supports/shared_example/user_authentication.rb +47 -0
- metadata +181 -0
@@ -0,0 +1,431 @@
|
|
1
|
+
post:
|
2
|
+
summary: Register User
|
3
|
+
tags:
|
4
|
+
- Users
|
5
|
+
description: Use this API to register a new user
|
6
|
+
requestBody:
|
7
|
+
content:
|
8
|
+
multipart/form-data:
|
9
|
+
schema:
|
10
|
+
type: object
|
11
|
+
properties:
|
12
|
+
user[nickname]:
|
13
|
+
type: string
|
14
|
+
example: My name
|
15
|
+
user[email]:
|
16
|
+
type: string
|
17
|
+
example: example@sun-asterisk.com
|
18
|
+
user[password]:
|
19
|
+
type: string
|
20
|
+
example: 12345678
|
21
|
+
user[prefecture_id]:
|
22
|
+
type: integer
|
23
|
+
example: 1
|
24
|
+
user[city_id]:
|
25
|
+
type: integer
|
26
|
+
example: 1
|
27
|
+
user[gender]:
|
28
|
+
type: string
|
29
|
+
example: male
|
30
|
+
description: Accept only one of [male, female, other]
|
31
|
+
user[birthday]:
|
32
|
+
type: string
|
33
|
+
example: "1999-09-13"
|
34
|
+
description: Format yyyy-mm-dd
|
35
|
+
user[height]:
|
36
|
+
type: integer
|
37
|
+
example: 160
|
38
|
+
user[weight]:
|
39
|
+
type: integer
|
40
|
+
example: 60
|
41
|
+
user[avatar]:
|
42
|
+
type: file
|
43
|
+
description: Accept only content_type [jpg, jpeg, png]
|
44
|
+
user[sns_provider]:
|
45
|
+
type: string
|
46
|
+
enum: [google, facebook, apple]
|
47
|
+
user[sns_uid]:
|
48
|
+
type: string
|
49
|
+
example: "bGciOiJIUzI1"
|
50
|
+
platform:
|
51
|
+
type: string
|
52
|
+
example: "android"
|
53
|
+
device_token:
|
54
|
+
type: string
|
55
|
+
example: "e73jnsaq28ddwwd89Wd"
|
56
|
+
device_name:
|
57
|
+
type: string
|
58
|
+
example: "Xiaomi"
|
59
|
+
required:
|
60
|
+
- user[nickname]
|
61
|
+
- user[email]
|
62
|
+
- user[password]
|
63
|
+
responses:
|
64
|
+
200:
|
65
|
+
description: Register user successfully
|
66
|
+
content:
|
67
|
+
application/json:
|
68
|
+
schema:
|
69
|
+
type: object
|
70
|
+
properties:
|
71
|
+
success:
|
72
|
+
type: boolean
|
73
|
+
example: true
|
74
|
+
data:
|
75
|
+
type: object
|
76
|
+
properties:
|
77
|
+
token_info:
|
78
|
+
$ref: "../../definitions/common.yaml#/access_token_object"
|
79
|
+
user:
|
80
|
+
$ref: "../../definitions/v4/user.yaml#/user_basic_info"
|
81
|
+
meta:
|
82
|
+
type: object
|
83
|
+
400:
|
84
|
+
description: Bad Request
|
85
|
+
content:
|
86
|
+
application/json:
|
87
|
+
schema:
|
88
|
+
$ref: "../../definitions/common.yaml#/errors_object"
|
89
|
+
examples:
|
90
|
+
when email is empty:
|
91
|
+
value:
|
92
|
+
success: false
|
93
|
+
errors:
|
94
|
+
- resource: user
|
95
|
+
field: email
|
96
|
+
code: 1003
|
97
|
+
message: メールアドレスを入力してください
|
98
|
+
when email has been taken:
|
99
|
+
value:
|
100
|
+
success: false
|
101
|
+
errors:
|
102
|
+
- resource: user
|
103
|
+
field: email
|
104
|
+
code: 1008
|
105
|
+
message: メールアドレスが既に登録されています
|
106
|
+
when nickname is empty:
|
107
|
+
value:
|
108
|
+
success: false
|
109
|
+
errors:
|
110
|
+
- resource: user
|
111
|
+
field: nickname
|
112
|
+
code: 1003
|
113
|
+
message: ニックネームを入力してください
|
114
|
+
when password is empty:
|
115
|
+
value:
|
116
|
+
success: false
|
117
|
+
errors:
|
118
|
+
- resource: user
|
119
|
+
field: password
|
120
|
+
code: 1003
|
121
|
+
message: パスワードを入力してください
|
122
|
+
when height is less than 1:
|
123
|
+
value:
|
124
|
+
success: false
|
125
|
+
errors:
|
126
|
+
- resource: user
|
127
|
+
field: height
|
128
|
+
code: 1015
|
129
|
+
message: 身長は1より大きい必要があります
|
130
|
+
when height is greater than 302:
|
131
|
+
value:
|
132
|
+
success: false
|
133
|
+
errors:
|
134
|
+
- resource: user
|
135
|
+
field: height
|
136
|
+
code: 1018
|
137
|
+
message: 身長は302未満である必要があります
|
138
|
+
when weight is less than 1:
|
139
|
+
value:
|
140
|
+
success: false
|
141
|
+
errors:
|
142
|
+
- resource: user
|
143
|
+
field: weight
|
144
|
+
code: 1015
|
145
|
+
message: 体重は1より大きい必要があります
|
146
|
+
when weight is greater than 227:
|
147
|
+
value:
|
148
|
+
success: false
|
149
|
+
errors:
|
150
|
+
- resource: user
|
151
|
+
field: weight
|
152
|
+
code: 1018
|
153
|
+
message: 体重は227未満である必要があります
|
154
|
+
when avatar is invalid:
|
155
|
+
value:
|
156
|
+
success: false
|
157
|
+
errors:
|
158
|
+
- resource: user
|
159
|
+
field: avatar
|
160
|
+
code: 1009
|
161
|
+
message: Avatarは無効な値です
|
162
|
+
when params birthday is future date:
|
163
|
+
value:
|
164
|
+
success: false
|
165
|
+
errors:
|
166
|
+
- code: 1028
|
167
|
+
resource: user
|
168
|
+
field: birthday
|
169
|
+
message: 未来の日付は指定できません
|
170
|
+
when SNS uid has been registered by other user:
|
171
|
+
value:
|
172
|
+
success: false
|
173
|
+
errors:
|
174
|
+
- code: 1008
|
175
|
+
resource: user
|
176
|
+
field: uid
|
177
|
+
message: このアカウントはすでに別の膝栗毛アカウントに登録されています。
|
178
|
+
|
179
|
+
patch:
|
180
|
+
summary: Update user info
|
181
|
+
tags:
|
182
|
+
- Users
|
183
|
+
description: Use this API to update user info
|
184
|
+
parameters:
|
185
|
+
- in: header
|
186
|
+
name: JWTAuthorization
|
187
|
+
type: string
|
188
|
+
required: true
|
189
|
+
example: Bearer eyJhbGciOiJIUzI1Ni...
|
190
|
+
- name: id_token
|
191
|
+
in: query
|
192
|
+
description: id token of firebase
|
193
|
+
example: eyJhbGciOiJIUzI1Ni...
|
194
|
+
schema:
|
195
|
+
type: string
|
196
|
+
requestBody:
|
197
|
+
content:
|
198
|
+
multipart/form-data:
|
199
|
+
schema:
|
200
|
+
type: object
|
201
|
+
properties:
|
202
|
+
user[gender]:
|
203
|
+
type: string
|
204
|
+
description: Accept only one of [male, female, other]
|
205
|
+
enum: [male, female, other]
|
206
|
+
user[birthday]:
|
207
|
+
type: string
|
208
|
+
example: "1999-09-13"
|
209
|
+
description: Format yyyy-mm-dd
|
210
|
+
user[height]:
|
211
|
+
type: integer
|
212
|
+
example: 160
|
213
|
+
user[weight]:
|
214
|
+
type: integer
|
215
|
+
example: 60
|
216
|
+
user[prefecture_id]:
|
217
|
+
type: integer
|
218
|
+
example: 1
|
219
|
+
user[city_id]:
|
220
|
+
type: integer
|
221
|
+
example: 1
|
222
|
+
user[nickname]:
|
223
|
+
type: string
|
224
|
+
example: Katarina
|
225
|
+
user[avatar]:
|
226
|
+
type: file
|
227
|
+
description: Accept only content_type [jpg, jpeg, png], send "" to delete avatar
|
228
|
+
responses:
|
229
|
+
200:
|
230
|
+
description: Update user info successfully
|
231
|
+
content:
|
232
|
+
application/json:
|
233
|
+
schema:
|
234
|
+
type: object
|
235
|
+
properties:
|
236
|
+
success:
|
237
|
+
type: boolean
|
238
|
+
data:
|
239
|
+
type: object
|
240
|
+
meta:
|
241
|
+
type: object
|
242
|
+
401:
|
243
|
+
$ref: "../../shared/unauthorized_response.yaml#invalid_access_token"
|
244
|
+
400:
|
245
|
+
description: Bad Request
|
246
|
+
content:
|
247
|
+
application/json:
|
248
|
+
schema:
|
249
|
+
$ref: "../../definitions/common.yaml#/errors_object"
|
250
|
+
examples:
|
251
|
+
when height is less than 1:
|
252
|
+
value:
|
253
|
+
success: false
|
254
|
+
errors:
|
255
|
+
- resource: user
|
256
|
+
field: height
|
257
|
+
code: 1015
|
258
|
+
message: 身長は1以上である必要があります
|
259
|
+
when height is greater than 302:
|
260
|
+
value:
|
261
|
+
success: false
|
262
|
+
errors:
|
263
|
+
- resource: user
|
264
|
+
field: height
|
265
|
+
code: 1018
|
266
|
+
message: 身長は302未満である必要があります
|
267
|
+
when weight is less than 1:
|
268
|
+
value:
|
269
|
+
success: false
|
270
|
+
errors:
|
271
|
+
- resource: user
|
272
|
+
field: weight
|
273
|
+
code: 1015
|
274
|
+
message: 体重は1以上である必要があります
|
275
|
+
when weight is greater than 227:
|
276
|
+
value:
|
277
|
+
success: false
|
278
|
+
errors:
|
279
|
+
- resource: user
|
280
|
+
field: weight
|
281
|
+
code: 1018
|
282
|
+
message: 体重は227未満である必要があります
|
283
|
+
when params birthday is future date:
|
284
|
+
value:
|
285
|
+
success: false
|
286
|
+
errors:
|
287
|
+
- code: 1028
|
288
|
+
resource: user
|
289
|
+
field: birthday
|
290
|
+
message: 未来の日付は指定できません
|
291
|
+
|
292
|
+
get:
|
293
|
+
summary: Get info of current user
|
294
|
+
tags:
|
295
|
+
- Users
|
296
|
+
description: Use this API to get info of current user
|
297
|
+
parameters:
|
298
|
+
- in: header
|
299
|
+
name: JWTAuthorization
|
300
|
+
schema:
|
301
|
+
type: string
|
302
|
+
required: true
|
303
|
+
example: Bearer eyJhbGciOiJIUzI1Ni...
|
304
|
+
responses:
|
305
|
+
200:
|
306
|
+
description: Get info successfully
|
307
|
+
content:
|
308
|
+
application/json:
|
309
|
+
schema:
|
310
|
+
type: object
|
311
|
+
properties:
|
312
|
+
success:
|
313
|
+
type: boolean
|
314
|
+
example: true
|
315
|
+
data:
|
316
|
+
type: object
|
317
|
+
properties:
|
318
|
+
user:
|
319
|
+
$ref: "../../definitions/v4/user.yaml#user_info"
|
320
|
+
meta:
|
321
|
+
type: object
|
322
|
+
400:
|
323
|
+
description: Bad request
|
324
|
+
content:
|
325
|
+
application/json:
|
326
|
+
schema:
|
327
|
+
$ref: "../../definitions/common.yaml#/errors_object"
|
328
|
+
examples:
|
329
|
+
when device invalid:
|
330
|
+
value:
|
331
|
+
success: false
|
332
|
+
errors:
|
333
|
+
- code: 1602
|
334
|
+
message: 他のデバイスに既にログインしています。ログアウトしてから再度お試しください。
|
335
|
+
401:
|
336
|
+
$ref: "../../shared/unauthorized_response.yaml#invalid_access_token"
|
337
|
+
|
338
|
+
delete:
|
339
|
+
summary: Delete user
|
340
|
+
tags:
|
341
|
+
- Users
|
342
|
+
description: Use this API to delete a user
|
343
|
+
parameters:
|
344
|
+
- in: header
|
345
|
+
name: JWTAuthorization
|
346
|
+
schema:
|
347
|
+
type: string
|
348
|
+
required: true
|
349
|
+
example: Bearer eyJhbGciOiJIUzI1Ni...
|
350
|
+
- name: id_token
|
351
|
+
in: query
|
352
|
+
description: id token of firebase
|
353
|
+
example: eyJhbGciOiJIUzI1Ni...
|
354
|
+
schema:
|
355
|
+
type: string
|
356
|
+
responses:
|
357
|
+
200:
|
358
|
+
description: Delete user successfully
|
359
|
+
content:
|
360
|
+
application/json:
|
361
|
+
schema:
|
362
|
+
type: object
|
363
|
+
properties:
|
364
|
+
success:
|
365
|
+
type: boolean
|
366
|
+
example: true
|
367
|
+
data:
|
368
|
+
type: object
|
369
|
+
meta:
|
370
|
+
type: object
|
371
|
+
400:
|
372
|
+
description: Bad Request
|
373
|
+
content:
|
374
|
+
application/json:
|
375
|
+
schema:
|
376
|
+
$ref: "../../definitions/common.yaml#/errors_object"
|
377
|
+
examples:
|
378
|
+
when author resource is invalid:
|
379
|
+
value:
|
380
|
+
success: false
|
381
|
+
errors:
|
382
|
+
- code: 1603
|
383
|
+
message: ご利用中のアカウントは停止されました
|
384
|
+
401:
|
385
|
+
$ref: "../../shared/unauthorized_response.yaml#invalid_access_token"
|
386
|
+
|
387
|
+
destroy_by_token:
|
388
|
+
delete:
|
389
|
+
summary: Delete a user by delete token
|
390
|
+
tags:
|
391
|
+
- Users
|
392
|
+
description: Use this API to delete a user by delete token on email
|
393
|
+
parameters:
|
394
|
+
- in: query
|
395
|
+
name: email
|
396
|
+
type: integer
|
397
|
+
required: true
|
398
|
+
example: example@sun-asterisk.com
|
399
|
+
- in: query
|
400
|
+
name: token
|
401
|
+
type: integer
|
402
|
+
required: true
|
403
|
+
example: "xxx___xyyy___zzz"
|
404
|
+
responses:
|
405
|
+
200:
|
406
|
+
description: Delete user successfully
|
407
|
+
content:
|
408
|
+
application/json:
|
409
|
+
schema:
|
410
|
+
type: object
|
411
|
+
properties:
|
412
|
+
success:
|
413
|
+
type: boolean
|
414
|
+
example: true
|
415
|
+
data:
|
416
|
+
type: object
|
417
|
+
meta:
|
418
|
+
type: object
|
419
|
+
400:
|
420
|
+
description: Bad Request
|
421
|
+
content:
|
422
|
+
application/json:
|
423
|
+
schema:
|
424
|
+
$ref: "../../definitions/common.yaml#/errors_object"
|
425
|
+
examples:
|
426
|
+
when email or token is invalid:
|
427
|
+
value:
|
428
|
+
success: false
|
429
|
+
errors:
|
430
|
+
- code: 1303
|
431
|
+
message: メールアドレスは無効な値です
|
@@ -0,0 +1,28 @@
|
|
1
|
+
openapi: 3.0.1
|
2
|
+
info:
|
3
|
+
description: "Document: <a href='https://swagger.io/docs/specification' target='_blank' >Click Here</a>
|
4
|
+
<br>Example: <a href='https://petstore.swagger.io' target='_blank' >Click Here </a>"
|
5
|
+
version: 1.0.0
|
6
|
+
title: "API documents"
|
7
|
+
schemes:
|
8
|
+
- "https"
|
9
|
+
- "http"
|
10
|
+
paths:
|
11
|
+
# Sessions
|
12
|
+
/api/v1/sign_in:
|
13
|
+
$ref: "sessions.yaml#create"
|
14
|
+
/api/v1/refresh:
|
15
|
+
$ref: "sessions.yaml#refresh"
|
16
|
+
/api/v1/logout:
|
17
|
+
$ref: "sessions.yaml#destroy"
|
18
|
+
|
19
|
+
# Users
|
20
|
+
/api/v1/users/:id:
|
21
|
+
$ref: "users.yaml#with_id"
|
22
|
+
|
23
|
+
components:
|
24
|
+
securitySchemes:
|
25
|
+
ApiKeyAuth:
|
26
|
+
type: apiKey
|
27
|
+
name: "Authorization"
|
28
|
+
in: "header"
|
@@ -0,0 +1,121 @@
|
|
1
|
+
create:
|
2
|
+
post:
|
3
|
+
summary: Login
|
4
|
+
tags:
|
5
|
+
- Authenticate
|
6
|
+
requestBody:
|
7
|
+
content:
|
8
|
+
application/json:
|
9
|
+
schema:
|
10
|
+
type: object
|
11
|
+
properties:
|
12
|
+
user:
|
13
|
+
type: object
|
14
|
+
properties:
|
15
|
+
email:
|
16
|
+
type: string
|
17
|
+
example: user1@gmail.vn
|
18
|
+
password:
|
19
|
+
type: string
|
20
|
+
example: Aa@123456
|
21
|
+
responses:
|
22
|
+
200:
|
23
|
+
description: Login user
|
24
|
+
content:
|
25
|
+
application/json:
|
26
|
+
schema:
|
27
|
+
type: object
|
28
|
+
properties:
|
29
|
+
success:
|
30
|
+
type: string
|
31
|
+
example: true
|
32
|
+
data:
|
33
|
+
type: object
|
34
|
+
properties:
|
35
|
+
access_token:
|
36
|
+
type: string
|
37
|
+
example: "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2NDg3MTcwMDEsImlhdCI6MTY0ODExMjIwMSwidXNlciI6eyJpZCI6MiwidG9rZW4iOiI3M2ZkMTljMTMxM2E0NmI3ODJhYzc3MjI5YjU3OTk1ODY0NmU2N2I5In0sImlzX3JlZnJlc2hfdG9rZW4iOmZhbHNlfQ.W8okh9k2lMJWfRMP01DCkk4IQclEsRPSW8WyUJ2en_A"
|
38
|
+
refresh_token:
|
39
|
+
type: string
|
40
|
+
example: "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2NTA3MDQyMDEsImlhdCI6MTY0ODExMjIwMSwidXNlciI6eyJpZCI6MiwidG9rZW4iOiI3M2ZkMTljMTMxM2E0NmI3ODJhYzc3MjI5YjU3OTk1ODY0NmU2N2I5In0sImlzX3JlZnJlc2hfdG9rZW4iOnRydWV9.u1ggFKZPQYpxRx00qC0Sx2L4fVYg7peE9E5wLX6L7IQ"
|
41
|
+
user:
|
42
|
+
type: object
|
43
|
+
properties:
|
44
|
+
id:
|
45
|
+
type: integer
|
46
|
+
example: 1
|
47
|
+
email:
|
48
|
+
type: string
|
49
|
+
example: user1@nal.vn
|
50
|
+
meta:
|
51
|
+
type: object
|
52
|
+
|
53
|
+
refresh:
|
54
|
+
post:
|
55
|
+
summary: Refresh token
|
56
|
+
tags:
|
57
|
+
- Authenticate
|
58
|
+
requestBody:
|
59
|
+
content:
|
60
|
+
application/json:
|
61
|
+
schema:
|
62
|
+
type: object
|
63
|
+
properties:
|
64
|
+
refresh_token:
|
65
|
+
type: string
|
66
|
+
example: refresh_token
|
67
|
+
responses:
|
68
|
+
201:
|
69
|
+
description: Refresh access token
|
70
|
+
content:
|
71
|
+
application/json:
|
72
|
+
schema:
|
73
|
+
type: object
|
74
|
+
properties:
|
75
|
+
success:
|
76
|
+
type: string
|
77
|
+
example: true
|
78
|
+
data:
|
79
|
+
type: object
|
80
|
+
properties:
|
81
|
+
access_token:
|
82
|
+
type: string
|
83
|
+
example: "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2NDg3MTcwMDEsImlhdCI6MTY0ODExMjIwMSwidXNlciI6eyJpZCI6MiwidG9rZW4iOiI3M2ZkMTljMTMxM2E0NmI3ODJhYzc3MjI5YjU3OTk1ODY0NmU2N2I5In0sImlzX3JlZnJlc2hfdG9rZW4iOmZhbHNlfQ.W8okh9k2lMJWfRMP01DCkk4IQclEsRPSW8WyUJ2en_A"
|
84
|
+
refresh_token:
|
85
|
+
type: string
|
86
|
+
example: "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2NTA3MDQyMDEsImlhdCI6MTY0ODExMjIwMSwidXNlciI6eyJpZCI6MiwidG9rZW4iOiI3M2ZkMTljMTMxM2E0NmI3ODJhYzc3MjI5YjU3OTk1ODY0NmU2N2I5In0sImlzX3JlZnJlc2hfdG9rZW4iOnRydWV9.u1ggFKZPQYpxRx00qC0Sx2L4fVYg7peE9E5wLX6L7IQ"
|
87
|
+
user:
|
88
|
+
type: object
|
89
|
+
properties:
|
90
|
+
id:
|
91
|
+
type: integer
|
92
|
+
example: 1
|
93
|
+
email:
|
94
|
+
type: string
|
95
|
+
example: user1@nal.vn
|
96
|
+
meta:
|
97
|
+
type: object
|
98
|
+
|
99
|
+
destroy:
|
100
|
+
delete:
|
101
|
+
security:
|
102
|
+
- ApiKeyAuth: []
|
103
|
+
summary: Logout
|
104
|
+
tags:
|
105
|
+
- Authenticate
|
106
|
+
responses:
|
107
|
+
200:
|
108
|
+
description: Logout success
|
109
|
+
content:
|
110
|
+
application/json:
|
111
|
+
schema:
|
112
|
+
type: object
|
113
|
+
properties:
|
114
|
+
status:
|
115
|
+
type: string
|
116
|
+
example: ok
|
117
|
+
message:
|
118
|
+
type: string
|
119
|
+
example: Logout successful
|
120
|
+
401:
|
121
|
+
$ref: "../../shared/unauthorized_response.yaml#invalid_access_token"
|
@@ -0,0 +1,24 @@
|
|
1
|
+
with_id:
|
2
|
+
get:
|
3
|
+
security:
|
4
|
+
- ApiKeyAuth: []
|
5
|
+
summary: Get info user
|
6
|
+
tags:
|
7
|
+
- Users
|
8
|
+
responses:
|
9
|
+
200:
|
10
|
+
description:
|
11
|
+
content:
|
12
|
+
application/json:
|
13
|
+
schema:
|
14
|
+
type: object
|
15
|
+
properties:
|
16
|
+
success:
|
17
|
+
type: boolean
|
18
|
+
example: true
|
19
|
+
data:
|
20
|
+
$ref: "../definitions/users.yaml#user_details"
|
21
|
+
meta:
|
22
|
+
type: object
|
23
|
+
401:
|
24
|
+
$ref: "../../shared/unauthorized_response.yaml#invalid_access_token"
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
# See https://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
|
@@ -0,0 +1,24 @@
|
|
1
|
+
window.onload = function() {
|
2
|
+
//<editor-fold desc="Changeable Configuration Block">
|
3
|
+
|
4
|
+
// the following lines will be replaced by docker/configurator, when it runs in a docker-container
|
5
|
+
window.ui = SwaggerUIBundle({
|
6
|
+
url: "/docs/api/admin/paths/index.yaml",
|
7
|
+
dom_id: '#swagger-ui',
|
8
|
+
deepLinking: true,
|
9
|
+
presets: [
|
10
|
+
SwaggerUIBundle.presets.apis,
|
11
|
+
SwaggerUIStandalonePreset
|
12
|
+
],
|
13
|
+
plugins: [
|
14
|
+
SwaggerUIBundle.plugins.DownloadUrl
|
15
|
+
],
|
16
|
+
layout: "StandaloneLayout",
|
17
|
+
requestInterceptor: (req) => {
|
18
|
+
req.headers["Authorization"] = "Bearer " + req.headers["Authorization"]
|
19
|
+
return req
|
20
|
+
}
|
21
|
+
});
|
22
|
+
|
23
|
+
//</editor-fold>
|
24
|
+
};
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<!-- HTML for static distribution bundle build -->
|
2
|
+
<!DOCTYPE html>
|
3
|
+
<html lang="en">
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
<title>Swagger UI</title>
|
7
|
+
<link rel="stylesheet" type="text/css" href="../swagger-ui.css" />
|
8
|
+
<link rel="stylesheet" type="text/css" href="../index.css" />
|
9
|
+
<link rel="icon" type="image/png" href="../favicon-32x32.png" sizes="32x32" />
|
10
|
+
<link rel="icon" type="image/png" href="../favicon-16x16.png" sizes="16x16" />
|
11
|
+
</head>
|
12
|
+
|
13
|
+
<body>
|
14
|
+
<div id="swagger-ui"></div>
|
15
|
+
<script src="../swagger-ui-bundle.js" charset="UTF-8"> </script>
|
16
|
+
<script src="../swagger-ui-standalone-preset.js" charset="UTF-8"> </script>
|
17
|
+
<script src="./admin-swagger-initializer.js" charset="UTF-8"> </script>
|
18
|
+
</body>
|
19
|
+
</html>
|
Binary file
|
Binary file
|