@thzero/library_server_fastify 0.17.5 → 0.17.6
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.
- package/README.md +17 -17
- package/boot/index.js +367 -367
- package/boot/plugins/admin/news.js +11 -11
- package/boot/plugins/admin/users.js +11 -11
- package/boot/plugins/api.js +16 -16
- package/boot/plugins/apiFront.js +21 -21
- package/boot/plugins/news.js +11 -11
- package/boot/plugins/users.js +11 -11
- package/boot/plugins/usersExtended.js +6 -6
- package/license.md +8 -8
- package/middleware/authentication.js +94 -94
- package/middleware/authorization.js +220 -220
- package/openSource.js +80 -80
- package/package.json +41 -41
- package/plugins/apiKey.js +48 -48
- package/plugins/auth.js +124 -124
- package/plugins/responseTime.js +111 -111
- package/plugins/settings.js +12 -12
- package/plugins/usageMetrics.js +24 -24
- package/routes/admin/index.js +140 -140
- package/routes/admin/news.js +22 -22
- package/routes/admin/users.js +26 -26
- package/routes/baseNews.js +45 -45
- package/routes/baseUsers.js +153 -153
- package/routes/home.js +28 -28
- package/routes/index.js +41 -41
- package/routes/news.js +6 -6
- package/routes/plans.js +39 -39
- package/routes/users.js +6 -6
- package/routes/utility.js +80 -80
- package/routes/version.js +39 -39
package/routes/baseUsers.js
CHANGED
|
@@ -1,153 +1,153 @@
|
|
|
1
|
-
import LibraryServerConstants from '@thzero/library_server/constants.js';
|
|
2
|
-
|
|
3
|
-
import BaseRoute from './index.js';
|
|
4
|
-
|
|
5
|
-
class BaseUsersRoute extends BaseRoute {
|
|
6
|
-
constructor(prefix, version) {
|
|
7
|
-
super(prefix ? prefix : '/users');
|
|
8
|
-
|
|
9
|
-
// this._serviceUsers = null;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
async init(injector, app, config) {
|
|
13
|
-
await super.init(injector, app, config);
|
|
14
|
-
// this._serviceUsers = injector.getService(LibraryServerConstants.InjectorKeys.SERVICE_USERS);
|
|
15
|
-
this._inject(app, injector, LibraryServerConstants.InjectorKeys.SERVICE_USERS, LibraryServerConstants.InjectorKeys.SERVICE_USERS);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
get id() {
|
|
19
|
-
return 'users';
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
_initializeRoutes(router) {
|
|
23
|
-
this._initializeRoutesGamerById(router);
|
|
24
|
-
this._initializeRoutesGamerByTag(router);
|
|
25
|
-
this._initializeRoutesRefreshSettings(router);
|
|
26
|
-
this._initializeRoutesUpdate(router);
|
|
27
|
-
this._initializeRoutesUpdateSettings(router);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
_initializeRoutesGamerById(router) {
|
|
31
|
-
return router.get(this._join('/gamerId/:gamerId'),
|
|
32
|
-
// authentication(false),
|
|
33
|
-
// // authorization('user'),
|
|
34
|
-
{
|
|
35
|
-
preHandler: router.auth([
|
|
36
|
-
router.authenticationDefault,
|
|
37
|
-
// router.authorizationDefault
|
|
38
|
-
],
|
|
39
|
-
{
|
|
40
|
-
relation: 'and',
|
|
41
|
-
required: false,
|
|
42
|
-
roles: [ 'user' ]
|
|
43
|
-
}),
|
|
44
|
-
},
|
|
45
|
-
// eslint-disable-next-line
|
|
46
|
-
async (request, reply) => {
|
|
47
|
-
// const service = this._injector.getService(LibraryServerConstants.InjectorKeys.SERVICE_USERS);
|
|
48
|
-
const response = (await router[LibraryServerConstants.InjectorKeys.SERVICE_USERS].fetchByGamerId(request.correlationId, request.params.gamerId)).check(request);
|
|
49
|
-
// https://github.com/fastify/fastify-compress/issues/215#issuecomment-1210598312
|
|
50
|
-
return this._jsonResponse(reply, response);
|
|
51
|
-
}
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
_initializeRoutesGamerByTag(router) {
|
|
56
|
-
return router.get(this._join('/gamerTag/:gamerTag'),
|
|
57
|
-
// authentication(false),
|
|
58
|
-
// // authorization('user'),
|
|
59
|
-
{
|
|
60
|
-
preHandler: router.auth([
|
|
61
|
-
router.authenticationDefault,
|
|
62
|
-
// router.authorizationDefault
|
|
63
|
-
],
|
|
64
|
-
{
|
|
65
|
-
relation: 'and',
|
|
66
|
-
required: false,
|
|
67
|
-
roles: [ 'user' ]
|
|
68
|
-
}),
|
|
69
|
-
},
|
|
70
|
-
// eslint-disable-next-line
|
|
71
|
-
async (request, reply) => {
|
|
72
|
-
// const service = this._injector.getService(LibraryServerConstants.InjectorKeys.SERVICE_USERS);
|
|
73
|
-
const response = (await router[LibraryServerConstants.InjectorKeys.SERVICE_USERS].fetchByGamerTag(request.correlationId, request.params.gamerTag)).check(request);
|
|
74
|
-
// https://github.com/fastify/fastify-compress/issues/215#issuecomment-1210598312
|
|
75
|
-
return this._jsonResponse(reply, response);
|
|
76
|
-
}
|
|
77
|
-
);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
_initializeRoutesRefreshSettings(router) {
|
|
81
|
-
return router.post(this._join('/refresh/settings'),
|
|
82
|
-
// authentication(true),
|
|
83
|
-
// authorization('user'),
|
|
84
|
-
{
|
|
85
|
-
preHandler: router.auth([
|
|
86
|
-
router.authenticationDefault,
|
|
87
|
-
router.authorizationDefault
|
|
88
|
-
],
|
|
89
|
-
{
|
|
90
|
-
relation: 'and',
|
|
91
|
-
roles: [ 'user' ]
|
|
92
|
-
}),
|
|
93
|
-
},
|
|
94
|
-
// eslint-disable-next-line
|
|
95
|
-
async (request, reply) => {
|
|
96
|
-
// const service = this._injector.getService(LibraryServerConstants.InjectorKeys.SERVICE_USERS);
|
|
97
|
-
const response = (await router[LibraryServerConstants.InjectorKeys.SERVICE_USERS].refreshSettings(request.correlationId, request.body)).check(request);
|
|
98
|
-
// https://github.com/fastify/fastify-compress/issues/215#issuecomment-1210598312
|
|
99
|
-
return this._jsonResponse(reply, response);
|
|
100
|
-
}
|
|
101
|
-
);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
_initializeRoutesUpdate(router) {
|
|
105
|
-
return router.post(this._join('/update'),
|
|
106
|
-
// authentication(true),
|
|
107
|
-
// authorization('user'),
|
|
108
|
-
{
|
|
109
|
-
preHandler: router.auth([
|
|
110
|
-
router.authenticationDefault,
|
|
111
|
-
// router.authorizationDefault
|
|
112
|
-
],
|
|
113
|
-
{
|
|
114
|
-
relation: 'and',
|
|
115
|
-
roles: [ 'user' ]
|
|
116
|
-
}),
|
|
117
|
-
},
|
|
118
|
-
// eslint-disable-next-line
|
|
119
|
-
async (request, reply) => {
|
|
120
|
-
// const service = this._injector.getService(LibraryServerConstants.InjectorKeys.SERVICE_USERS);
|
|
121
|
-
const response = (await router[LibraryServerConstants.InjectorKeys.SERVICE_USERS].update(request.correlationId, request.body)).check(request);
|
|
122
|
-
// https://github.com/fastify/fastify-compress/issues/215#issuecomment-1210598312
|
|
123
|
-
return this._jsonResponse(reply, response);
|
|
124
|
-
}
|
|
125
|
-
);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
_initializeRoutesUpdateSettings(router) {
|
|
129
|
-
return router.post(this._join('/update/settings'),
|
|
130
|
-
// authentication(true),
|
|
131
|
-
// authorization('user'),
|
|
132
|
-
{
|
|
133
|
-
preHandler: router.auth([
|
|
134
|
-
router.authenticationDefault,
|
|
135
|
-
router.authorizationDefault
|
|
136
|
-
],
|
|
137
|
-
{
|
|
138
|
-
relation: 'and',
|
|
139
|
-
roles: [ 'user' ]
|
|
140
|
-
}),
|
|
141
|
-
},
|
|
142
|
-
// eslint-disable-next-line
|
|
143
|
-
async (request, reply) => {
|
|
144
|
-
// const service = this._injector.getService(LibraryServerConstants.InjectorKeys.SERVICE_USERS);
|
|
145
|
-
const response = (await router[LibraryServerConstants.InjectorKeys.SERVICE_USERS].updateSettings(request.correlationId, request.body)).check(request);
|
|
146
|
-
// https://github.com/fastify/fastify-compress/issues/215#issuecomment-1210598312
|
|
147
|
-
return this._jsonResponse(reply, response);
|
|
148
|
-
}
|
|
149
|
-
);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
export default BaseUsersRoute;
|
|
1
|
+
import LibraryServerConstants from '@thzero/library_server/constants.js';
|
|
2
|
+
|
|
3
|
+
import BaseRoute from './index.js';
|
|
4
|
+
|
|
5
|
+
class BaseUsersRoute extends BaseRoute {
|
|
6
|
+
constructor(prefix, version) {
|
|
7
|
+
super(prefix ? prefix : '/users');
|
|
8
|
+
|
|
9
|
+
// this._serviceUsers = null;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
async init(injector, app, config) {
|
|
13
|
+
await super.init(injector, app, config);
|
|
14
|
+
// this._serviceUsers = injector.getService(LibraryServerConstants.InjectorKeys.SERVICE_USERS);
|
|
15
|
+
this._inject(app, injector, LibraryServerConstants.InjectorKeys.SERVICE_USERS, LibraryServerConstants.InjectorKeys.SERVICE_USERS);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
get id() {
|
|
19
|
+
return 'users';
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
_initializeRoutes(router) {
|
|
23
|
+
this._initializeRoutesGamerById(router);
|
|
24
|
+
this._initializeRoutesGamerByTag(router);
|
|
25
|
+
this._initializeRoutesRefreshSettings(router);
|
|
26
|
+
this._initializeRoutesUpdate(router);
|
|
27
|
+
this._initializeRoutesUpdateSettings(router);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
_initializeRoutesGamerById(router) {
|
|
31
|
+
return router.get(this._join('/gamerId/:gamerId'),
|
|
32
|
+
// authentication(false),
|
|
33
|
+
// // authorization('user'),
|
|
34
|
+
{
|
|
35
|
+
preHandler: router.auth([
|
|
36
|
+
router.authenticationDefault,
|
|
37
|
+
// router.authorizationDefault
|
|
38
|
+
],
|
|
39
|
+
{
|
|
40
|
+
relation: 'and',
|
|
41
|
+
required: false,
|
|
42
|
+
roles: [ 'user' ]
|
|
43
|
+
}),
|
|
44
|
+
},
|
|
45
|
+
// eslint-disable-next-line
|
|
46
|
+
async (request, reply) => {
|
|
47
|
+
// const service = this._injector.getService(LibraryServerConstants.InjectorKeys.SERVICE_USERS);
|
|
48
|
+
const response = (await router[LibraryServerConstants.InjectorKeys.SERVICE_USERS].fetchByGamerId(request.correlationId, request.params.gamerId)).check(request);
|
|
49
|
+
// https://github.com/fastify/fastify-compress/issues/215#issuecomment-1210598312
|
|
50
|
+
return this._jsonResponse(reply, response);
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
_initializeRoutesGamerByTag(router) {
|
|
56
|
+
return router.get(this._join('/gamerTag/:gamerTag'),
|
|
57
|
+
// authentication(false),
|
|
58
|
+
// // authorization('user'),
|
|
59
|
+
{
|
|
60
|
+
preHandler: router.auth([
|
|
61
|
+
router.authenticationDefault,
|
|
62
|
+
// router.authorizationDefault
|
|
63
|
+
],
|
|
64
|
+
{
|
|
65
|
+
relation: 'and',
|
|
66
|
+
required: false,
|
|
67
|
+
roles: [ 'user' ]
|
|
68
|
+
}),
|
|
69
|
+
},
|
|
70
|
+
// eslint-disable-next-line
|
|
71
|
+
async (request, reply) => {
|
|
72
|
+
// const service = this._injector.getService(LibraryServerConstants.InjectorKeys.SERVICE_USERS);
|
|
73
|
+
const response = (await router[LibraryServerConstants.InjectorKeys.SERVICE_USERS].fetchByGamerTag(request.correlationId, request.params.gamerTag)).check(request);
|
|
74
|
+
// https://github.com/fastify/fastify-compress/issues/215#issuecomment-1210598312
|
|
75
|
+
return this._jsonResponse(reply, response);
|
|
76
|
+
}
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
_initializeRoutesRefreshSettings(router) {
|
|
81
|
+
return router.post(this._join('/refresh/settings'),
|
|
82
|
+
// authentication(true),
|
|
83
|
+
// authorization('user'),
|
|
84
|
+
{
|
|
85
|
+
preHandler: router.auth([
|
|
86
|
+
router.authenticationDefault,
|
|
87
|
+
router.authorizationDefault
|
|
88
|
+
],
|
|
89
|
+
{
|
|
90
|
+
relation: 'and',
|
|
91
|
+
roles: [ 'user' ]
|
|
92
|
+
}),
|
|
93
|
+
},
|
|
94
|
+
// eslint-disable-next-line
|
|
95
|
+
async (request, reply) => {
|
|
96
|
+
// const service = this._injector.getService(LibraryServerConstants.InjectorKeys.SERVICE_USERS);
|
|
97
|
+
const response = (await router[LibraryServerConstants.InjectorKeys.SERVICE_USERS].refreshSettings(request.correlationId, request.body)).check(request);
|
|
98
|
+
// https://github.com/fastify/fastify-compress/issues/215#issuecomment-1210598312
|
|
99
|
+
return this._jsonResponse(reply, response);
|
|
100
|
+
}
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
_initializeRoutesUpdate(router) {
|
|
105
|
+
return router.post(this._join('/update'),
|
|
106
|
+
// authentication(true),
|
|
107
|
+
// authorization('user'),
|
|
108
|
+
{
|
|
109
|
+
preHandler: router.auth([
|
|
110
|
+
router.authenticationDefault,
|
|
111
|
+
// router.authorizationDefault
|
|
112
|
+
],
|
|
113
|
+
{
|
|
114
|
+
relation: 'and',
|
|
115
|
+
roles: [ 'user' ]
|
|
116
|
+
}),
|
|
117
|
+
},
|
|
118
|
+
// eslint-disable-next-line
|
|
119
|
+
async (request, reply) => {
|
|
120
|
+
// const service = this._injector.getService(LibraryServerConstants.InjectorKeys.SERVICE_USERS);
|
|
121
|
+
const response = (await router[LibraryServerConstants.InjectorKeys.SERVICE_USERS].update(request.correlationId, request.body)).check(request);
|
|
122
|
+
// https://github.com/fastify/fastify-compress/issues/215#issuecomment-1210598312
|
|
123
|
+
return this._jsonResponse(reply, response);
|
|
124
|
+
}
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
_initializeRoutesUpdateSettings(router) {
|
|
129
|
+
return router.post(this._join('/update/settings'),
|
|
130
|
+
// authentication(true),
|
|
131
|
+
// authorization('user'),
|
|
132
|
+
{
|
|
133
|
+
preHandler: router.auth([
|
|
134
|
+
router.authenticationDefault,
|
|
135
|
+
router.authorizationDefault
|
|
136
|
+
],
|
|
137
|
+
{
|
|
138
|
+
relation: 'and',
|
|
139
|
+
roles: [ 'user' ]
|
|
140
|
+
}),
|
|
141
|
+
},
|
|
142
|
+
// eslint-disable-next-line
|
|
143
|
+
async (request, reply) => {
|
|
144
|
+
// const service = this._injector.getService(LibraryServerConstants.InjectorKeys.SERVICE_USERS);
|
|
145
|
+
const response = (await router[LibraryServerConstants.InjectorKeys.SERVICE_USERS].updateSettings(request.correlationId, request.body)).check(request);
|
|
146
|
+
// https://github.com/fastify/fastify-compress/issues/215#issuecomment-1210598312
|
|
147
|
+
return this._jsonResponse(reply, response);
|
|
148
|
+
}
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export default BaseUsersRoute;
|
package/routes/home.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import BaseRoute from './index.js';
|
|
2
|
-
|
|
3
|
-
class HomeRoute extends BaseRoute {
|
|
4
|
-
constructor(prefix) {
|
|
5
|
-
super(prefix ? prefix : '');
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
get id() {
|
|
9
|
-
return 'home';
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
_initializeRoutes(router) {
|
|
13
|
-
// eslint-disable-next-linethis._prefix
|
|
14
|
-
router.get(this._join('/'), (request, reply) => {
|
|
15
|
-
reply.status(494).send();
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
get _ignoreApi() {
|
|
20
|
-
return true;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
get _version() {
|
|
24
|
-
return '';
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export default HomeRoute;
|
|
1
|
+
import BaseRoute from './index.js';
|
|
2
|
+
|
|
3
|
+
class HomeRoute extends BaseRoute {
|
|
4
|
+
constructor(prefix) {
|
|
5
|
+
super(prefix ? prefix : '');
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
get id() {
|
|
9
|
+
return 'home';
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
_initializeRoutes(router) {
|
|
13
|
+
// eslint-disable-next-linethis._prefix
|
|
14
|
+
router.get(this._join('/'), (request, reply) => {
|
|
15
|
+
reply.status(494).send();
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
get _ignoreApi() {
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
get _version() {
|
|
24
|
+
return '';
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default HomeRoute;
|
package/routes/index.js
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import fastifyPlugin from 'fastify-plugin';
|
|
2
|
-
|
|
3
|
-
import LibraryCommonUtility from '@thzero/library_common/utility/index.js';
|
|
4
|
-
|
|
5
|
-
import BaseRoute from'@thzero/library_server/routes/index.js';
|
|
6
|
-
|
|
7
|
-
class FastifyBaseRoute extends BaseRoute {
|
|
8
|
-
_initializeRouter(app, config) {
|
|
9
|
-
return app;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
async _inject(app, injector, key, name) {
|
|
13
|
-
const service = injector.getService(key);
|
|
14
|
-
if (!service)
|
|
15
|
-
throw Error(`Invalid service for '${key}'.`);
|
|
16
|
-
|
|
17
|
-
app.register(fastifyPlugin((instance, opts, done) => {
|
|
18
|
-
instance.decorate(opts.name, opts.service);
|
|
19
|
-
done();
|
|
20
|
-
}), {
|
|
21
|
-
name: name,
|
|
22
|
-
service: service
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
_join(path) {
|
|
27
|
-
return this._prefix + path;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
_jsonResponse(reply, json) {
|
|
31
|
-
if (!reply)
|
|
32
|
-
throw Error('Invalid context for response.');
|
|
33
|
-
|
|
34
|
-
return reply
|
|
35
|
-
.code(200)
|
|
36
|
-
.header('Content-Type', 'application/json; charset=utf-8')
|
|
37
|
-
.send((typeof json === 'string') ? json : LibraryCommonUtility.stringify(json));
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export default FastifyBaseRoute;
|
|
1
|
+
import fastifyPlugin from 'fastify-plugin';
|
|
2
|
+
|
|
3
|
+
import LibraryCommonUtility from '@thzero/library_common/utility/index.js';
|
|
4
|
+
|
|
5
|
+
import BaseRoute from'@thzero/library_server/routes/index.js';
|
|
6
|
+
|
|
7
|
+
class FastifyBaseRoute extends BaseRoute {
|
|
8
|
+
_initializeRouter(app, config) {
|
|
9
|
+
return app;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
async _inject(app, injector, key, name) {
|
|
13
|
+
const service = injector.getService(key);
|
|
14
|
+
if (!service)
|
|
15
|
+
throw Error(`Invalid service for '${key}'.`);
|
|
16
|
+
|
|
17
|
+
app.register(fastifyPlugin((instance, opts, done) => {
|
|
18
|
+
instance.decorate(opts.name, opts.service);
|
|
19
|
+
done();
|
|
20
|
+
}), {
|
|
21
|
+
name: name,
|
|
22
|
+
service: service
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
_join(path) {
|
|
27
|
+
return this._prefix + path;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
_jsonResponse(reply, json) {
|
|
31
|
+
if (!reply)
|
|
32
|
+
throw Error('Invalid context for response.');
|
|
33
|
+
|
|
34
|
+
return reply
|
|
35
|
+
.code(200)
|
|
36
|
+
.header('Content-Type', 'application/json; charset=utf-8')
|
|
37
|
+
.send((typeof json === 'string') ? json : LibraryCommonUtility.stringify(json));
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export default FastifyBaseRoute;
|
package/routes/news.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import BaseNewsRoute from './baseNews.js';
|
|
2
|
-
|
|
3
|
-
class NewsRoute extends BaseNewsRoute {
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
export default NewsRoute;
|
|
1
|
+
import BaseNewsRoute from './baseNews.js';
|
|
2
|
+
|
|
3
|
+
class NewsRoute extends BaseNewsRoute {
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export default NewsRoute;
|
package/routes/plans.js
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import LibraryServerConstants from '@thzero/library_server/constants.js';
|
|
2
|
-
|
|
3
|
-
import BaseRoute from './index.js';
|
|
4
|
-
|
|
5
|
-
class PlansRoute extends BaseRoute {
|
|
6
|
-
constructor(prefix) {
|
|
7
|
-
super(prefix ? prefix : '/plans');
|
|
8
|
-
|
|
9
|
-
// this._servicePlans = null;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
async init(injector, app, config) {
|
|
13
|
-
await super.init(injector, app, config);
|
|
14
|
-
// this._servicePlans = injector.getService(LibraryServerConstants.InjectorKeys.SERVICE_PLANS);
|
|
15
|
-
this._inject(app, injector, LibraryServerConstants.InjectorKeys.SERVICE_PLANS, LibraryServerConstants.InjectorKeys.SERVICE_PLANS);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
get id() {
|
|
19
|
-
return 'plans';
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
_initializeRoutes(router) {
|
|
23
|
-
router.get(this._join(''),
|
|
24
|
-
// eslint-disable-next-line
|
|
25
|
-
async (request, reply) => {
|
|
26
|
-
// const service = this._injector.getService(LibraryServerConstants.InjectorKeys.SERVICE_PLANS);
|
|
27
|
-
const response = (await router[LibraryServerConstants.InjectorKeys.SERVICE_PLANS].listing(request.correlationId, request.body)).check(request);
|
|
28
|
-
// https://github.com/fastify/fastify-compress/issues/215#issuecomment-1210598312
|
|
29
|
-
return this._jsonResponse(reply, response);
|
|
30
|
-
}
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
get _version() {
|
|
35
|
-
return 'v1';
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export default PlansRoute;
|
|
1
|
+
import LibraryServerConstants from '@thzero/library_server/constants.js';
|
|
2
|
+
|
|
3
|
+
import BaseRoute from './index.js';
|
|
4
|
+
|
|
5
|
+
class PlansRoute extends BaseRoute {
|
|
6
|
+
constructor(prefix) {
|
|
7
|
+
super(prefix ? prefix : '/plans');
|
|
8
|
+
|
|
9
|
+
// this._servicePlans = null;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
async init(injector, app, config) {
|
|
13
|
+
await super.init(injector, app, config);
|
|
14
|
+
// this._servicePlans = injector.getService(LibraryServerConstants.InjectorKeys.SERVICE_PLANS);
|
|
15
|
+
this._inject(app, injector, LibraryServerConstants.InjectorKeys.SERVICE_PLANS, LibraryServerConstants.InjectorKeys.SERVICE_PLANS);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
get id() {
|
|
19
|
+
return 'plans';
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
_initializeRoutes(router) {
|
|
23
|
+
router.get(this._join(''),
|
|
24
|
+
// eslint-disable-next-line
|
|
25
|
+
async (request, reply) => {
|
|
26
|
+
// const service = this._injector.getService(LibraryServerConstants.InjectorKeys.SERVICE_PLANS);
|
|
27
|
+
const response = (await router[LibraryServerConstants.InjectorKeys.SERVICE_PLANS].listing(request.correlationId, request.body)).check(request);
|
|
28
|
+
// https://github.com/fastify/fastify-compress/issues/215#issuecomment-1210598312
|
|
29
|
+
return this._jsonResponse(reply, response);
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
get _version() {
|
|
35
|
+
return 'v1';
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export default PlansRoute;
|
package/routes/users.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import BaseUsersRoute from './baseUser.jss';
|
|
2
|
-
|
|
3
|
-
class UsersRoute extends BaseUsersRoute {
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
export default UsersRoute;
|
|
1
|
+
import BaseUsersRoute from './baseUser.jss';
|
|
2
|
+
|
|
3
|
+
class UsersRoute extends BaseUsersRoute {
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export default UsersRoute;
|