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
data/lib/models/admin.rb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Admin < ApplicationRecord
|
4
|
+
acts_as_paranoid
|
5
|
+
# Include default devise modules. Others available are:
|
6
|
+
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
|
7
|
+
devise :database_authenticatable, :registerable, :validatable
|
8
|
+
|
9
|
+
has_many :devices, as: :resourceable, dependent: :destroy
|
10
|
+
end
|
File without changes
|
data/lib/models/post.rb
ADDED
data/lib/models/user.rb
ADDED
data/lib/n_base_rails.rb
ADDED
data/lib/public/404.html
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
+
<style>
|
7
|
+
.rails-default-error-page {
|
8
|
+
background-color: #EFEFEF;
|
9
|
+
color: #2E2F30;
|
10
|
+
text-align: center;
|
11
|
+
font-family: arial, sans-serif;
|
12
|
+
margin: 0;
|
13
|
+
}
|
14
|
+
|
15
|
+
.rails-default-error-page div.dialog {
|
16
|
+
width: 95%;
|
17
|
+
max-width: 33em;
|
18
|
+
margin: 4em auto 0;
|
19
|
+
}
|
20
|
+
|
21
|
+
.rails-default-error-page div.dialog > div {
|
22
|
+
border: 1px solid #CCC;
|
23
|
+
border-right-color: #999;
|
24
|
+
border-left-color: #999;
|
25
|
+
border-bottom-color: #BBB;
|
26
|
+
border-top: #B00100 solid 4px;
|
27
|
+
border-top-left-radius: 9px;
|
28
|
+
border-top-right-radius: 9px;
|
29
|
+
background-color: white;
|
30
|
+
padding: 7px 12% 0;
|
31
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
+
}
|
33
|
+
|
34
|
+
.rails-default-error-page h1 {
|
35
|
+
font-size: 100%;
|
36
|
+
color: #730E15;
|
37
|
+
line-height: 1.5em;
|
38
|
+
}
|
39
|
+
|
40
|
+
.rails-default-error-page div.dialog > p {
|
41
|
+
margin: 0 0 1em;
|
42
|
+
padding: 1em;
|
43
|
+
background-color: #F7F7F7;
|
44
|
+
border: 1px solid #CCC;
|
45
|
+
border-right-color: #999;
|
46
|
+
border-left-color: #999;
|
47
|
+
border-bottom-color: #999;
|
48
|
+
border-bottom-left-radius: 4px;
|
49
|
+
border-bottom-right-radius: 4px;
|
50
|
+
border-top-color: #DADADA;
|
51
|
+
color: #666;
|
52
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
+
}
|
54
|
+
</style>
|
55
|
+
</head>
|
56
|
+
|
57
|
+
<body class="rails-default-error-page">
|
58
|
+
<!-- This file lives in public/404.html -->
|
59
|
+
<div class="dialog">
|
60
|
+
<div>
|
61
|
+
<h1>The page you were looking for doesn't exist.</h1>
|
62
|
+
<p>You may have mistyped the address or the page may have moved.</p>
|
63
|
+
</div>
|
64
|
+
<p>If you are the application owner check the logs for more information.</p>
|
65
|
+
</div>
|
66
|
+
</body>
|
67
|
+
</html>
|
data/lib/public/422.html
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The change you wanted was rejected (422)</title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
+
<style>
|
7
|
+
.rails-default-error-page {
|
8
|
+
background-color: #EFEFEF;
|
9
|
+
color: #2E2F30;
|
10
|
+
text-align: center;
|
11
|
+
font-family: arial, sans-serif;
|
12
|
+
margin: 0;
|
13
|
+
}
|
14
|
+
|
15
|
+
.rails-default-error-page div.dialog {
|
16
|
+
width: 95%;
|
17
|
+
max-width: 33em;
|
18
|
+
margin: 4em auto 0;
|
19
|
+
}
|
20
|
+
|
21
|
+
.rails-default-error-page div.dialog > div {
|
22
|
+
border: 1px solid #CCC;
|
23
|
+
border-right-color: #999;
|
24
|
+
border-left-color: #999;
|
25
|
+
border-bottom-color: #BBB;
|
26
|
+
border-top: #B00100 solid 4px;
|
27
|
+
border-top-left-radius: 9px;
|
28
|
+
border-top-right-radius: 9px;
|
29
|
+
background-color: white;
|
30
|
+
padding: 7px 12% 0;
|
31
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
+
}
|
33
|
+
|
34
|
+
.rails-default-error-page h1 {
|
35
|
+
font-size: 100%;
|
36
|
+
color: #730E15;
|
37
|
+
line-height: 1.5em;
|
38
|
+
}
|
39
|
+
|
40
|
+
.rails-default-error-page div.dialog > p {
|
41
|
+
margin: 0 0 1em;
|
42
|
+
padding: 1em;
|
43
|
+
background-color: #F7F7F7;
|
44
|
+
border: 1px solid #CCC;
|
45
|
+
border-right-color: #999;
|
46
|
+
border-left-color: #999;
|
47
|
+
border-bottom-color: #999;
|
48
|
+
border-bottom-left-radius: 4px;
|
49
|
+
border-bottom-right-radius: 4px;
|
50
|
+
border-top-color: #DADADA;
|
51
|
+
color: #666;
|
52
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
+
}
|
54
|
+
</style>
|
55
|
+
</head>
|
56
|
+
|
57
|
+
<body class="rails-default-error-page">
|
58
|
+
<!-- This file lives in public/422.html -->
|
59
|
+
<div class="dialog">
|
60
|
+
<div>
|
61
|
+
<h1>The change you wanted was rejected.</h1>
|
62
|
+
<p>Maybe you tried to change something you didn't have access to.</p>
|
63
|
+
</div>
|
64
|
+
<p>If you are the application owner check the logs for more information.</p>
|
65
|
+
</div>
|
66
|
+
</body>
|
67
|
+
</html>
|
data/lib/public/500.html
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>We're sorry, but something went wrong (500)</title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
+
<style>
|
7
|
+
.rails-default-error-page {
|
8
|
+
background-color: #EFEFEF;
|
9
|
+
color: #2E2F30;
|
10
|
+
text-align: center;
|
11
|
+
font-family: arial, sans-serif;
|
12
|
+
margin: 0;
|
13
|
+
}
|
14
|
+
|
15
|
+
.rails-default-error-page div.dialog {
|
16
|
+
width: 95%;
|
17
|
+
max-width: 33em;
|
18
|
+
margin: 4em auto 0;
|
19
|
+
}
|
20
|
+
|
21
|
+
.rails-default-error-page div.dialog > div {
|
22
|
+
border: 1px solid #CCC;
|
23
|
+
border-right-color: #999;
|
24
|
+
border-left-color: #999;
|
25
|
+
border-bottom-color: #BBB;
|
26
|
+
border-top: #B00100 solid 4px;
|
27
|
+
border-top-left-radius: 9px;
|
28
|
+
border-top-right-radius: 9px;
|
29
|
+
background-color: white;
|
30
|
+
padding: 7px 12% 0;
|
31
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
+
}
|
33
|
+
|
34
|
+
.rails-default-error-page h1 {
|
35
|
+
font-size: 100%;
|
36
|
+
color: #730E15;
|
37
|
+
line-height: 1.5em;
|
38
|
+
}
|
39
|
+
|
40
|
+
.rails-default-error-page div.dialog > p {
|
41
|
+
margin: 0 0 1em;
|
42
|
+
padding: 1em;
|
43
|
+
background-color: #F7F7F7;
|
44
|
+
border: 1px solid #CCC;
|
45
|
+
border-right-color: #999;
|
46
|
+
border-left-color: #999;
|
47
|
+
border-bottom-color: #999;
|
48
|
+
border-bottom-left-radius: 4px;
|
49
|
+
border-bottom-right-radius: 4px;
|
50
|
+
border-top-color: #DADADA;
|
51
|
+
color: #666;
|
52
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
+
}
|
54
|
+
</style>
|
55
|
+
</head>
|
56
|
+
|
57
|
+
<body class="rails-default-error-page">
|
58
|
+
<!-- This file lives in public/500.html -->
|
59
|
+
<div class="dialog">
|
60
|
+
<div>
|
61
|
+
<h1>We're sorry, but something went wrong.</h1>
|
62
|
+
</div>
|
63
|
+
<p>If you are the application owner check the logs for more information.</p>
|
64
|
+
</div>
|
65
|
+
</body>
|
66
|
+
</html>
|
File without changes
|
File without changes
|
@@ -0,0 +1,29 @@
|
|
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/admin/sign_in:
|
13
|
+
$ref: "sessions.yaml#create"
|
14
|
+
/api/admin/refresh:
|
15
|
+
$ref: "sessions.yaml#refresh"
|
16
|
+
/api/admin/logout:
|
17
|
+
$ref: "sessions.yaml#destroy"
|
18
|
+
|
19
|
+
# Users
|
20
|
+
/api/admin/users:
|
21
|
+
$ref: "users.yaml#without_id"
|
22
|
+
|
23
|
+
|
24
|
+
components:
|
25
|
+
securitySchemes:
|
26
|
+
ApiKeyAuth:
|
27
|
+
type: apiKey
|
28
|
+
name: "Authorization"
|
29
|
+
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
|
+
admin:
|
13
|
+
type: object
|
14
|
+
properties:
|
15
|
+
email:
|
16
|
+
type: string
|
17
|
+
example: admin@gmail.vn
|
18
|
+
password:
|
19
|
+
type: string
|
20
|
+
example: Aa@123456
|
21
|
+
responses:
|
22
|
+
200:
|
23
|
+
description: Login admin
|
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
|
+
admin:
|
42
|
+
type: object
|
43
|
+
properties:
|
44
|
+
id:
|
45
|
+
type: integer
|
46
|
+
example: 1
|
47
|
+
email:
|
48
|
+
type: string
|
49
|
+
example: admin@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
|
+
admin:
|
88
|
+
type: object
|
89
|
+
properties:
|
90
|
+
id:
|
91
|
+
type: integer
|
92
|
+
example: 1
|
93
|
+
email:
|
94
|
+
type: string
|
95
|
+
example: admin@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,39 @@
|
|
1
|
+
without_id:
|
2
|
+
get:
|
3
|
+
security:
|
4
|
+
- ApiKeyAuth: []
|
5
|
+
summary: Get list user
|
6
|
+
tags:
|
7
|
+
- Users
|
8
|
+
parameters:
|
9
|
+
- in: query
|
10
|
+
name: page
|
11
|
+
schema:
|
12
|
+
type: integer
|
13
|
+
required: false
|
14
|
+
example: 1
|
15
|
+
description: page number
|
16
|
+
- in: query
|
17
|
+
name: items
|
18
|
+
schema:
|
19
|
+
type: integer
|
20
|
+
required: false
|
21
|
+
example: 2
|
22
|
+
description: number of item per page
|
23
|
+
responses:
|
24
|
+
200:
|
25
|
+
description:
|
26
|
+
content:
|
27
|
+
application/json:
|
28
|
+
schema:
|
29
|
+
type: object
|
30
|
+
properties:
|
31
|
+
success:
|
32
|
+
type: boolean
|
33
|
+
example: true
|
34
|
+
data:
|
35
|
+
$ref: "../definitions/users.yaml#user_list"
|
36
|
+
meta:
|
37
|
+
$ref: "../../shared/meta_infos.yaml#meta_infos"
|
38
|
+
401:
|
39
|
+
$ref: "../../shared/unauthorized_response.yaml#invalid_access_token"
|
@@ -0,0 +1,41 @@
|
|
1
|
+
meta_infos:
|
2
|
+
type: object
|
3
|
+
properties:
|
4
|
+
count:
|
5
|
+
type: integer
|
6
|
+
example: 1
|
7
|
+
page:
|
8
|
+
type: integer
|
9
|
+
example: 1
|
10
|
+
outset:
|
11
|
+
type: integer
|
12
|
+
example: 0
|
13
|
+
items:
|
14
|
+
type: integer
|
15
|
+
example: 30
|
16
|
+
last:
|
17
|
+
type: integer
|
18
|
+
example: 1
|
19
|
+
pages:
|
20
|
+
type: integer
|
21
|
+
example: 2
|
22
|
+
offset:
|
23
|
+
type: integer
|
24
|
+
example: 1
|
25
|
+
params:
|
26
|
+
type: object
|
27
|
+
from:
|
28
|
+
type: integer
|
29
|
+
example: 1
|
30
|
+
to:
|
31
|
+
type: integer
|
32
|
+
example: 1
|
33
|
+
in:
|
34
|
+
type: integer
|
35
|
+
example: 1
|
36
|
+
prev:
|
37
|
+
type: integer
|
38
|
+
example: 1
|
39
|
+
next:
|
40
|
+
type: integer
|
41
|
+
example: 1
|
@@ -0,0 +1,31 @@
|
|
1
|
+
invalid_access_token:
|
2
|
+
description:
|
3
|
+
content:
|
4
|
+
application/json:
|
5
|
+
schema:
|
6
|
+
type: object
|
7
|
+
properties:
|
8
|
+
success:
|
9
|
+
type: boolean
|
10
|
+
errors:
|
11
|
+
type: array
|
12
|
+
items:
|
13
|
+
type: object
|
14
|
+
properties:
|
15
|
+
code:
|
16
|
+
type: integer
|
17
|
+
message:
|
18
|
+
type: string
|
19
|
+
examples:
|
20
|
+
when token is invalid:
|
21
|
+
value:
|
22
|
+
success: false
|
23
|
+
errors:
|
24
|
+
- code: 1204
|
25
|
+
message: Invalid Token
|
26
|
+
when token is expired:
|
27
|
+
value:
|
28
|
+
success: false
|
29
|
+
errors:
|
30
|
+
- code: 1205
|
31
|
+
message: Token Expired
|