c2-http 1.0.83 → 1.0.85
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.
|
@@ -4,11 +4,13 @@ import { ICrudControllerOptions } from "./ICrudControllerOptions";
|
|
|
4
4
|
export declare abstract class CrudController extends Controller {
|
|
5
5
|
constructor(options: ICrudControllerOptions);
|
|
6
6
|
abstract search(request: Request, response: Response): Promise<[number, any]>;
|
|
7
|
+
abstract deepSearch(request: Request, response: Response): Promise<[number, any]>;
|
|
7
8
|
abstract getById(request: Request, response: Response): Promise<[number, any]>;
|
|
8
9
|
abstract create(request: Request, response: Response): Promise<[number, any]>;
|
|
9
10
|
abstract update(request: Request, response: Response): Promise<[number, any]>;
|
|
10
11
|
abstract delete(request: Request, response: Response): Promise<[number, any]>;
|
|
11
12
|
searchRunner(request: Request, response: Response): Promise<[number, any]>;
|
|
13
|
+
deepSearchRunner(request: Request, response: Response): Promise<[number, any]>;
|
|
12
14
|
getByIdRunner(request: Request, response: Response): Promise<[number, any]>;
|
|
13
15
|
createRunner(request: Request, response: Response): Promise<[number, any]>;
|
|
14
16
|
updateRunner(request: Request, response: Response): Promise<[number, any]>;
|
|
@@ -19,11 +19,6 @@ class CrudController extends Controller_1.Controller {
|
|
|
19
19
|
this.updateRunner = this.updateRunner.bind(this);
|
|
20
20
|
this.deleteRunner = this.deleteRunner.bind(this);
|
|
21
21
|
if (options.byPass === true || options.middlewareCheckAuthorization === undefined) {
|
|
22
|
-
// this.routers.get(`${this.options.uri}/:id`, this.getByIdRunner)
|
|
23
|
-
// this.routers.get(`${this.options.uri}`, this.searchRunner)
|
|
24
|
-
// this.routers.post(`${this.options.uri}`, this.createRunner)
|
|
25
|
-
// this.routers.patch(`${this.options.uri}/:id`, this.updateRunner)
|
|
26
|
-
// this.routers.delete(`${this.options.uri}/:id`, this.deleteRunner)
|
|
27
22
|
this.routesControlled.push(new ControllerRoute_1.ControllerRoute({
|
|
28
23
|
router: this.routers,
|
|
29
24
|
method: "get",
|
|
@@ -36,6 +31,12 @@ class CrudController extends Controller_1.Controller {
|
|
|
36
31
|
uri: `${this.options.uri}`,
|
|
37
32
|
controllerFn: this.searchRunner
|
|
38
33
|
}));
|
|
34
|
+
this.routesControlled.push(new ControllerRoute_1.ControllerRoute({
|
|
35
|
+
router: this.routers,
|
|
36
|
+
method: "patch",
|
|
37
|
+
uri: `${this.options.uri}`,
|
|
38
|
+
controllerFn: this.deepSearchRunner
|
|
39
|
+
}));
|
|
39
40
|
this.routesControlled.push(new ControllerRoute_1.ControllerRoute({
|
|
40
41
|
router: this.routers,
|
|
41
42
|
method: "post",
|
|
@@ -56,21 +57,6 @@ class CrudController extends Controller_1.Controller {
|
|
|
56
57
|
}));
|
|
57
58
|
}
|
|
58
59
|
else {
|
|
59
|
-
// this.routers.get(`${this.options.uri}/:id`,
|
|
60
|
-
// options.middlewareRoles([`${this.options.prefixRole}:read`]),
|
|
61
|
-
// this.getByIdRunner)
|
|
62
|
-
// this.routers.get(`${this.options.uri}`,
|
|
63
|
-
// options.middlewareRoles([`${this.options.prefixRole}:read`]),
|
|
64
|
-
// this.searchRunner)
|
|
65
|
-
// this.routers.post(`${this.options.uri}`,
|
|
66
|
-
// options.middlewareRoles([`${this.options.prefixRole}:create`]),
|
|
67
|
-
// this.createRunner)
|
|
68
|
-
// this.routers.patch(`${this.options.uri}/:id`,
|
|
69
|
-
// options.middlewareRoles([`${this.options.prefixRole}:edit`]),
|
|
70
|
-
// this.updateRunner)
|
|
71
|
-
// this.routers.delete(`${this.options.uri}/:id`,
|
|
72
|
-
// options.middlewareRoles([`${this.options.prefixRole}:delete`]),
|
|
73
|
-
// this.deleteRunner)
|
|
74
60
|
this.routesControlled.push(new ControllerRoute_1.ControllerRoute({
|
|
75
61
|
router: this.routers,
|
|
76
62
|
method: "get",
|
|
@@ -85,6 +71,13 @@ class CrudController extends Controller_1.Controller {
|
|
|
85
71
|
middlewareCheckAuthorization: new ControllerRoleMiddleware_1.ControllerRoleMiddleware([`${this.options.prefixRole}:read`], options.middlewareCheckAuthorization),
|
|
86
72
|
controllerFn: this.searchRunner
|
|
87
73
|
}));
|
|
74
|
+
this.routesControlled.push(new ControllerRoute_1.ControllerRoute({
|
|
75
|
+
router: this.routers,
|
|
76
|
+
method: "patch",
|
|
77
|
+
uri: `${this.options.uri}`,
|
|
78
|
+
middlewareCheckAuthorization: new ControllerRoleMiddleware_1.ControllerRoleMiddleware([`${this.options.prefixRole}:read`], options.middlewareCheckAuthorization),
|
|
79
|
+
controllerFn: this.deepSearchRunner
|
|
80
|
+
}));
|
|
88
81
|
this.routesControlled.push(new ControllerRoute_1.ControllerRoute({
|
|
89
82
|
router: this.routers,
|
|
90
83
|
method: "post",
|
|
@@ -111,6 +104,9 @@ class CrudController extends Controller_1.Controller {
|
|
|
111
104
|
async searchRunner(request, response) {
|
|
112
105
|
return await this.search(request, response);
|
|
113
106
|
}
|
|
107
|
+
async deepSearchRunner(request, response) {
|
|
108
|
+
return await this.deepSearch(request, response);
|
|
109
|
+
}
|
|
114
110
|
async getByIdRunner(request, response) {
|
|
115
111
|
return await this.getById(request, response);
|
|
116
112
|
}
|
|
@@ -127,6 +123,9 @@ class CrudController extends Controller_1.Controller {
|
|
|
127
123
|
__decorate([
|
|
128
124
|
Controller_1.HttpDispatchHandling
|
|
129
125
|
], CrudController.prototype, "searchRunner", null);
|
|
126
|
+
__decorate([
|
|
127
|
+
Controller_1.HttpDispatchHandling
|
|
128
|
+
], CrudController.prototype, "deepSearchRunner", null);
|
|
130
129
|
__decorate([
|
|
131
130
|
Controller_1.HttpDispatchHandling
|
|
132
131
|
], CrudController.prototype, "getByIdRunner", null);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "c2-http",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.85",
|
|
4
4
|
"description": "Biblioteca Typescript para API NodeJS",
|
|
5
5
|
"repository": "https://cabralsilva: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@github.com/cabralsilva/c2-http.git",
|
|
6
6
|
"author": "Daniel Cabral <cabralconsultoriaemsoftware@gmail.com>",
|