namirasoft-node 1.1.11 → 1.1.12
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/dist/BaseApplication.d.ts +2 -0
- package/dist/BaseApplication.js.map +1 -1
- package/dist/BaseController.d.ts +9 -3
- package/dist/BaseController.js +28 -5
- package/dist/BaseController.js.map +1 -1
- package/dist/Schema/ApplicationSchema.d.ts +6 -0
- package/dist/Schema/ApplicationSchema.js +11 -0
- package/dist/Schema/ApplicationSchema.js.map +1 -0
- package/dist/Schema/ControllerSchema.d.ts +13 -0
- package/dist/Schema/ControllerSchema.js +17 -0
- package/dist/Schema/ControllerSchema.js.map +1 -0
- package/dist/Schema/VariableSchema.d.ts +13 -0
- package/dist/Schema/VariableSchema.js +33 -0
- package/dist/Schema/VariableSchema.js.map +1 -0
- package/package.json +5 -5
- package/src/BaseApplication.ts +2 -0
- package/src/BaseController.ts +34 -8
- package/src/Schema/ApplicationSchema.ts +11 -0
- package/src/Schema/ControllerSchema.ts +21 -0
- package/src/Schema/VariableSchema.ts +25 -0
|
@@ -2,6 +2,7 @@ import express, { Router } from 'express';
|
|
|
2
2
|
import { BaseDatabase } from './BaseDatabase';
|
|
3
3
|
import { ILogger } from "namirasoft-log";
|
|
4
4
|
import { BaseApplicationLink } from './BaseApplicationLink';
|
|
5
|
+
import { ApplicationSchema } from './Schema/ApplicationSchema';
|
|
5
6
|
export declare abstract class BaseApplication<D extends BaseDatabase> {
|
|
6
7
|
private title;
|
|
7
8
|
protected description: string;
|
|
@@ -29,4 +30,5 @@ export declare abstract class BaseApplication<D extends BaseDatabase> {
|
|
|
29
30
|
protected startSwagger(): Promise<void>;
|
|
30
31
|
protected startHomePage(): Promise<void>;
|
|
31
32
|
abstract onStart(): Promise<void>;
|
|
33
|
+
abstract getSchema(): Promise<ApplicationSchema>;
|
|
32
34
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseApplication.js","sourceRoot":"","s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ACf,OAAO;gBACX,CAAC,CAAA,CAAC,CAAC;YACP,CAAC,CAAC,CAAC;QACP,CAAC;KAAA;CAGJ;AAhLD,0CAgLC"}
|
package/dist/BaseController.d.ts
CHANGED
|
@@ -6,7 +6,9 @@ import { ILogger } from 'namirasoft-log';
|
|
|
6
6
|
import { Meta } from './Meta';
|
|
7
7
|
import { HTTPMethod } from './HTTPMethod';
|
|
8
8
|
import { BaseApplication } from './BaseApplication';
|
|
9
|
-
|
|
9
|
+
import { ControllerSchema } from './Schema/ControllerSchema';
|
|
10
|
+
import { VariableSchema } from './Schema/VariableSchema';
|
|
11
|
+
export declare abstract class BaseController<D extends BaseDatabase, State, Props, Output> {
|
|
10
12
|
protected showLogAtTheBeginning: boolean;
|
|
11
13
|
protected showLogAtTheEnd: boolean;
|
|
12
14
|
protected app: BaseApplication<D>;
|
|
@@ -14,7 +16,8 @@ export declare abstract class BaseController<D extends BaseDatabase, State, Prop
|
|
|
14
16
|
protected res: express.Response;
|
|
15
17
|
protected logger: ILogger;
|
|
16
18
|
protected meta: Meta;
|
|
17
|
-
protected
|
|
19
|
+
protected output: Output | null;
|
|
20
|
+
protected result: any;
|
|
18
21
|
protected database: D;
|
|
19
22
|
protected state: State;
|
|
20
23
|
protected props: Props;
|
|
@@ -28,12 +31,15 @@ export declare abstract class BaseController<D extends BaseDatabase, State, Prop
|
|
|
28
31
|
tag: string;
|
|
29
32
|
summary: string;
|
|
30
33
|
};
|
|
34
|
+
abstract getParameterSchema(): SchemaLike | null;
|
|
31
35
|
abstract getBodySchema(): SchemaLike | null;
|
|
32
36
|
abstract getQuerySchema(): SchemaLike | null;
|
|
37
|
+
abstract getOutputSchema(): VariableSchema;
|
|
33
38
|
abstract getState(): Promise<State>;
|
|
34
39
|
abstract getProps(): Promise<Props>;
|
|
35
40
|
abstract preHandle(): Promise<void>;
|
|
36
|
-
abstract handle(): Promise<
|
|
41
|
+
abstract handle(): Promise<Output>;
|
|
37
42
|
abstract postHandle(): Promise<void>;
|
|
38
43
|
run(): Promise<express.Response<any, Record<string, any>>>;
|
|
44
|
+
getSchema(): Promise<ControllerSchema>;
|
|
39
45
|
}
|
package/dist/BaseController.js
CHANGED
|
@@ -16,6 +16,8 @@ exports.BaseController = void 0;
|
|
|
16
16
|
const Meta_1 = require("./Meta");
|
|
17
17
|
const joi_1 = __importDefault(require("joi"));
|
|
18
18
|
const namirasoft_core_1 = require("namirasoft-core");
|
|
19
|
+
const ControllerSchema_1 = require("./Schema/ControllerSchema");
|
|
20
|
+
const VariableSchema_1 = require("./Schema/VariableSchema");
|
|
19
21
|
class BaseController {
|
|
20
22
|
constructor(app, req, res) {
|
|
21
23
|
this.showLogAtTheBeginning = false;
|
|
@@ -28,8 +30,9 @@ class BaseController {
|
|
|
28
30
|
run() {
|
|
29
31
|
return __awaiter(this, void 0, void 0, function* () {
|
|
30
32
|
this.meta = new Meta_1.Meta(this.req);
|
|
31
|
-
//
|
|
32
|
-
this.
|
|
33
|
+
// output
|
|
34
|
+
this.output = null;
|
|
35
|
+
this.result = null;
|
|
33
36
|
try {
|
|
34
37
|
// meta
|
|
35
38
|
this.meta.onStart();
|
|
@@ -70,9 +73,7 @@ class BaseController {
|
|
|
70
73
|
}
|
|
71
74
|
}
|
|
72
75
|
// call controller
|
|
73
|
-
this.
|
|
74
|
-
if (this.result == null)
|
|
75
|
-
this.result = "Success";
|
|
76
|
+
this.output = yield this.handle();
|
|
76
77
|
// postHandle
|
|
77
78
|
yield this.postHandle();
|
|
78
79
|
}
|
|
@@ -99,12 +100,34 @@ class BaseController {
|
|
|
99
100
|
else
|
|
100
101
|
this.result = "Sorry, internl server error.";
|
|
101
102
|
}
|
|
103
|
+
// result
|
|
104
|
+
if (!this.result) {
|
|
105
|
+
if (this.output == null)
|
|
106
|
+
this.result = "Success";
|
|
107
|
+
}
|
|
108
|
+
else
|
|
109
|
+
this.result = this.output;
|
|
110
|
+
// finish
|
|
102
111
|
this.meta.onFinish();
|
|
103
112
|
if (this.showLogAtTheEnd)
|
|
104
113
|
this.logger.info(JSON.stringify(this.meta));
|
|
105
114
|
return this.res.status(this.meta.code).send(this.result);
|
|
106
115
|
});
|
|
107
116
|
}
|
|
117
|
+
getSchema() {
|
|
118
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
119
|
+
let x = this.getInfo();
|
|
120
|
+
let parameter = this.getParameterSchema();
|
|
121
|
+
let body = this.getBodySchema();
|
|
122
|
+
let query = this.getQuerySchema();
|
|
123
|
+
let schema = new ControllerSchema_1.ControllerSchema(x.method, x.path, x.tag, x.summary);
|
|
124
|
+
schema.parameters = yield VariableSchema_1.VariableSchema.parse(parameter);
|
|
125
|
+
schema.body = yield VariableSchema_1.VariableSchema.parse(body);
|
|
126
|
+
schema.queries = yield VariableSchema_1.VariableSchema.parse(query);
|
|
127
|
+
schema.output = this.getOutputSchema();
|
|
128
|
+
return schema;
|
|
129
|
+
});
|
|
130
|
+
}
|
|
108
131
|
}
|
|
109
132
|
exports.BaseController = BaseController;
|
|
110
133
|
//# sourceMappingURL=BaseController.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseController.js","sourceRoot":"","sources":["../src/BaseController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAKA,iCAA8B;AAC9B,8CAAsB;AACtB,qDAA4D;
|
|
1
|
+
{"version":3,"file":"BaseController.js","sourceRoot":"","sources":["../src/BaseController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAKA,iCAA8B;AAC9B,8CAAsB;AACtB,qDAA4D;AAG5D,gEAA6D;AAC7D,4DAAyD;AAEzD,MAAsB,cAAc;IAchC,YAAY,GAAuB,EAAE,GAAoB,EAAE,GAAqB;QAZtE,0BAAqB,GAAY,KAAK,CAAC;QACvC,oBAAe,GAAY,IAAI,CAAC;QAatC,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf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AI,CAAC,eAAe;gBACpB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;YAChD,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC7D,CAAC;KAAA;IACK,SAAS;;YAEX,IAAI,CAAC,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;YACvB,IAAI,SAAS,GAAG,IAAI,CAAC,kBAAkB,EAAE,CAAC;YAC1C,IAAI,IAAI,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;YAChC,IAAI,KAAK,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;YAClC,IAAI,MAAM,GAAG,IAAI,mCAAgB,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC;YACtE,MAAM,CAAC,UAAU,GAAG,MAAM,+BAAc,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;YAC1D,MAAM,CAAC,IAAI,GAAG,MAAM,+BAAc,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAC/C,MAAM,CAAC,OAAO,GAAG,MAAM,+BAAc,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACnD,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;YACvC,OAAO,MAAM,CAAC;QAClB,CAAC;KAAA;CACJ;AArJD,wCAqJC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApplicationSchema = void 0;
|
|
4
|
+
class ApplicationSchema {
|
|
5
|
+
constructor(name) {
|
|
6
|
+
this.controllers = [];
|
|
7
|
+
this.name = name;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.ApplicationSchema = ApplicationSchema;
|
|
11
|
+
//# sourceMappingURL=ApplicationSchema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApplicationSchema.js","sourceRoot":"","sources":["../../src/Schema/ApplicationSchema.ts"],"names":[],"mappings":";;;AAEA,MAAa,iBAAiB;IAI1B,YAAY,IAAY;QADxB,gBAAW,GAAuB,EAAE,CAAC;QAGjC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACrB,CAAC;CACJ;AARD,8CAQC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { HTTPMethod } from "../HTTPMethod";
|
|
2
|
+
import { VariableSchema } from "./VariableSchema";
|
|
3
|
+
export declare class ControllerSchema {
|
|
4
|
+
method: HTTPMethod;
|
|
5
|
+
path: string;
|
|
6
|
+
tag: string;
|
|
7
|
+
summary: string;
|
|
8
|
+
parameters: VariableSchema[];
|
|
9
|
+
body: VariableSchema[];
|
|
10
|
+
queries: VariableSchema[];
|
|
11
|
+
output: VariableSchema | null;
|
|
12
|
+
constructor(method: HTTPMethod, path: string, tag: string, summary: string);
|
|
13
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ControllerSchema = void 0;
|
|
4
|
+
class ControllerSchema {
|
|
5
|
+
constructor(method, path, tag, summary) {
|
|
6
|
+
this.parameters = [];
|
|
7
|
+
this.body = [];
|
|
8
|
+
this.queries = [];
|
|
9
|
+
this.output = null;
|
|
10
|
+
this.method = method;
|
|
11
|
+
this.path = path;
|
|
12
|
+
this.tag = tag;
|
|
13
|
+
this.summary = summary;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.ControllerSchema = ControllerSchema;
|
|
17
|
+
//# sourceMappingURL=ControllerSchema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ControllerSchema.js","sourceRoot":"","sources":["../../src/Schema/ControllerSchema.ts"],"names":[],"mappings":";;;AAGA,MAAa,gBAAgB;IAUzB,YAAY,MAAkB,EAAE,IAAY,EAAE,GAAW,EAAE,OAAe;QAJ1E,eAAU,GAAqB,EAAE,CAAC;QAClC,SAAI,GAAqB,EAAE,CAAC;QAC5B,YAAO,GAAqB,EAAE,CAAC;QAC/B,WAAM,GAA0B,IAAI,CAAC;QAGjC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IAC3B,CAAC;CACJ;AAjBD,4CAiBC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { SchemaLike } from "joi";
|
|
2
|
+
export declare class VariableSchema {
|
|
3
|
+
static parse(schema: SchemaLike | null): Promise<VariableSchema[]>;
|
|
4
|
+
name: string;
|
|
5
|
+
type: string;
|
|
6
|
+
nullable: boolean;
|
|
7
|
+
array: number;
|
|
8
|
+
object: VariableSchema[];
|
|
9
|
+
valids: string[];
|
|
10
|
+
min: number | null;
|
|
11
|
+
max: number | null;
|
|
12
|
+
constructor(name: string, type: string, nullable: boolean);
|
|
13
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.VariableSchema = void 0;
|
|
13
|
+
class VariableSchema {
|
|
14
|
+
static parse(schema) {
|
|
15
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
if (!schema)
|
|
17
|
+
return [];
|
|
18
|
+
return [];
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
constructor(name, type, nullable) {
|
|
22
|
+
this.array = 0;
|
|
23
|
+
this.object = [];
|
|
24
|
+
this.valids = [];
|
|
25
|
+
this.min = null;
|
|
26
|
+
this.max = null;
|
|
27
|
+
this.name = name;
|
|
28
|
+
this.type = type;
|
|
29
|
+
this.nullable = nullable;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.VariableSchema = VariableSchema;
|
|
33
|
+
//# sourceMappingURL=VariableSchema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VariableSchema.js","sourceRoot":"","sources":["../../src/Schema/VariableSchema.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,MAAa,cAAc;IAEvB,MAAM,CAAO,KAAK,CAAC,MAAyB;;YAExC,IAAI,CAAC,MAAM;gBACP,OAAO,EAAE,CAAC;YACd,OAAO,EAAE,CAAC;QACd,CAAC;KAAA;IASD,YAAY,IAAY,EAAE,IAAY,EAAE,QAAiB;QALzD,UAAK,GAAW,CAAC,CAAC;QAClB,WAAM,GAAqB,EAAE,CAAC;QAC9B,WAAM,GAAa,EAAE,CAAC;QACtB,QAAG,GAAkB,IAAI,CAAC;QAC1B,QAAG,GAAkB,IAAI,CAAC;QAGtB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC7B,CAAC;CACJ;AAtBD,wCAsBC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "namirasoft-node",
|
|
3
3
|
"description": "Namira Software Corporation Node NPM Package",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.12",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"scripts": {},
|
|
@@ -9,16 +9,16 @@
|
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@supercharge/request-ip": "^1.2.0",
|
|
12
|
-
"@types/cors": "^2.8.
|
|
12
|
+
"@types/cors": "^2.8.17",
|
|
13
13
|
"@types/express": "^4.17.21",
|
|
14
14
|
"@types/nodemailer": "^6.4.14",
|
|
15
15
|
"@types/nodemailer-smtp-transport": "^2.7.8",
|
|
16
|
-
"@types/swagger-jsdoc": "^6.0.
|
|
16
|
+
"@types/swagger-jsdoc": "^6.0.4",
|
|
17
17
|
"@types/swagger-ui-express": "^4.1.6",
|
|
18
18
|
"cors": "^2.8.5",
|
|
19
19
|
"express": "^4.18.2",
|
|
20
20
|
"joi": "^17.11.0",
|
|
21
|
-
"namirasoft-core": "^1.1.
|
|
21
|
+
"namirasoft-core": "^1.1.7",
|
|
22
22
|
"namirasoft-log": "^1.1.1",
|
|
23
23
|
"nodemailer": "^6.9.7",
|
|
24
24
|
"nodemailer-smtp-transport": "^2.7.4",
|
|
@@ -26,6 +26,6 @@
|
|
|
26
26
|
"sequelize": "^6.35.1",
|
|
27
27
|
"swagger-jsdoc": "^6.2.8",
|
|
28
28
|
"swagger-ui-express": "^5.0.0",
|
|
29
|
-
"@types/node": "^20.9.
|
|
29
|
+
"@types/node": "^20.9.3"
|
|
30
30
|
}
|
|
31
31
|
}
|
package/src/BaseApplication.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { ILogger } from "namirasoft-log";
|
|
|
8
8
|
import { BaseApplicationLink } from './BaseApplicationLink';
|
|
9
9
|
import path from 'path';
|
|
10
10
|
import { PackageService } from 'namirasoft-core';
|
|
11
|
+
import { ApplicationSchema } from './Schema/ApplicationSchema';
|
|
11
12
|
|
|
12
13
|
export abstract class BaseApplication<D extends BaseDatabase>
|
|
13
14
|
{
|
|
@@ -184,4 +185,5 @@ export abstract class BaseApplication<D extends BaseDatabase>
|
|
|
184
185
|
});
|
|
185
186
|
}
|
|
186
187
|
abstract onStart(): Promise<void>;
|
|
188
|
+
abstract getSchema(): Promise<ApplicationSchema>;
|
|
187
189
|
}
|
package/src/BaseController.ts
CHANGED
|
@@ -8,8 +8,10 @@ import Joi from 'joi';
|
|
|
8
8
|
import { ErrorOperation, HTTPError } from 'namirasoft-core';
|
|
9
9
|
import { HTTPMethod } from './HTTPMethod';
|
|
10
10
|
import { BaseApplication } from './BaseApplication';
|
|
11
|
+
import { ControllerSchema } from './Schema/ControllerSchema';
|
|
12
|
+
import { VariableSchema } from './Schema/VariableSchema';
|
|
11
13
|
|
|
12
|
-
export abstract class BaseController<D extends BaseDatabase, State, Props>
|
|
14
|
+
export abstract class BaseController<D extends BaseDatabase, State, Props, Output>
|
|
13
15
|
{
|
|
14
16
|
protected showLogAtTheBeginning: boolean = false;
|
|
15
17
|
protected showLogAtTheEnd: boolean = true;
|
|
@@ -18,7 +20,8 @@ export abstract class BaseController<D extends BaseDatabase, State, Props>
|
|
|
18
20
|
protected res: express.Response;
|
|
19
21
|
protected logger: ILogger;
|
|
20
22
|
protected meta!: Meta;
|
|
21
|
-
protected
|
|
23
|
+
protected output!: Output | null;
|
|
24
|
+
protected result!: any;
|
|
22
25
|
protected database!: D;
|
|
23
26
|
protected state!: State;
|
|
24
27
|
protected props!: Props;
|
|
@@ -33,19 +36,22 @@ export abstract class BaseController<D extends BaseDatabase, State, Props>
|
|
|
33
36
|
abstract getDatabase(): D;
|
|
34
37
|
abstract getLogger(): ILogger;
|
|
35
38
|
abstract getInfo(): { method: HTTPMethod, path: string, tag: string, summary: string };
|
|
39
|
+
abstract getParameterSchema(): SchemaLike | null;
|
|
36
40
|
abstract getBodySchema(): SchemaLike | null;
|
|
37
41
|
abstract getQuerySchema(): SchemaLike | null;
|
|
42
|
+
abstract getOutputSchema(): VariableSchema;
|
|
38
43
|
abstract getState(): Promise<State>;
|
|
39
44
|
abstract getProps(): Promise<Props>;
|
|
40
45
|
abstract preHandle(): Promise<void>;
|
|
41
|
-
abstract handle(): Promise<
|
|
46
|
+
abstract handle(): Promise<Output>;
|
|
42
47
|
abstract postHandle(): Promise<void>;
|
|
43
48
|
|
|
44
49
|
async run()
|
|
45
50
|
{
|
|
46
51
|
this.meta = new Meta(this.req);
|
|
47
|
-
//
|
|
48
|
-
this.
|
|
52
|
+
// output
|
|
53
|
+
this.output = null;
|
|
54
|
+
this.result = null;
|
|
49
55
|
try
|
|
50
56
|
{
|
|
51
57
|
// meta
|
|
@@ -95,9 +101,7 @@ export abstract class BaseController<D extends BaseDatabase, State, Props>
|
|
|
95
101
|
}
|
|
96
102
|
|
|
97
103
|
// call controller
|
|
98
|
-
this.
|
|
99
|
-
if (this.result == null)
|
|
100
|
-
this.result = "Success";
|
|
104
|
+
this.output = await this.handle();
|
|
101
105
|
|
|
102
106
|
// postHandle
|
|
103
107
|
await this.postHandle();
|
|
@@ -129,9 +133,31 @@ export abstract class BaseController<D extends BaseDatabase, State, Props>
|
|
|
129
133
|
else
|
|
130
134
|
this.result = "Sorry, internl server error.";
|
|
131
135
|
}
|
|
136
|
+
// result
|
|
137
|
+
if (!this.result)
|
|
138
|
+
{
|
|
139
|
+
if (this.output == null)
|
|
140
|
+
this.result = "Success";
|
|
141
|
+
}
|
|
142
|
+
else
|
|
143
|
+
this.result = this.output;
|
|
144
|
+
// finish
|
|
132
145
|
this.meta.onFinish();
|
|
133
146
|
if (this.showLogAtTheEnd)
|
|
134
147
|
this.logger.info(JSON.stringify(this.meta));
|
|
135
148
|
return this.res.status(this.meta.code).send(this.result);
|
|
136
149
|
}
|
|
150
|
+
async getSchema(): Promise<ControllerSchema>
|
|
151
|
+
{
|
|
152
|
+
let x = this.getInfo();
|
|
153
|
+
let parameter = this.getParameterSchema();
|
|
154
|
+
let body = this.getBodySchema();
|
|
155
|
+
let query = this.getQuerySchema();
|
|
156
|
+
let schema = new ControllerSchema(x.method, x.path, x.tag, x.summary);
|
|
157
|
+
schema.parameters = await VariableSchema.parse(parameter);
|
|
158
|
+
schema.body = await VariableSchema.parse(body);
|
|
159
|
+
schema.queries = await VariableSchema.parse(query);
|
|
160
|
+
schema.output = this.getOutputSchema();
|
|
161
|
+
return schema;
|
|
162
|
+
}
|
|
137
163
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { HTTPMethod } from "../HTTPMethod";
|
|
2
|
+
import { VariableSchema } from "./VariableSchema";
|
|
3
|
+
|
|
4
|
+
export class ControllerSchema
|
|
5
|
+
{
|
|
6
|
+
method: HTTPMethod;
|
|
7
|
+
path: string;
|
|
8
|
+
tag: string;
|
|
9
|
+
summary: string;
|
|
10
|
+
parameters: VariableSchema[] = [];
|
|
11
|
+
body: VariableSchema[] = [];
|
|
12
|
+
queries: VariableSchema[] = [];
|
|
13
|
+
output: VariableSchema | null = null;
|
|
14
|
+
constructor(method: HTTPMethod, path: string, tag: string, summary: string)
|
|
15
|
+
{
|
|
16
|
+
this.method = method;
|
|
17
|
+
this.path = path;
|
|
18
|
+
this.tag = tag;
|
|
19
|
+
this.summary = summary;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { SchemaLike } from "joi";
|
|
2
|
+
|
|
3
|
+
export class VariableSchema
|
|
4
|
+
{
|
|
5
|
+
static async parse(schema: SchemaLike | null): Promise<VariableSchema[]>
|
|
6
|
+
{
|
|
7
|
+
if (!schema)
|
|
8
|
+
return [];
|
|
9
|
+
return [];
|
|
10
|
+
}
|
|
11
|
+
name: string;
|
|
12
|
+
type: string;
|
|
13
|
+
nullable: boolean;
|
|
14
|
+
array: number = 0;
|
|
15
|
+
object: VariableSchema[] = [];
|
|
16
|
+
valids: string[] = [];
|
|
17
|
+
min: number | null = null;
|
|
18
|
+
max: number | null = null;
|
|
19
|
+
constructor(name: string, type: string, nullable: boolean)
|
|
20
|
+
{
|
|
21
|
+
this.name = name;
|
|
22
|
+
this.type = type;
|
|
23
|
+
this.nullable = nullable;
|
|
24
|
+
}
|
|
25
|
+
}
|