nestia 3.1.0 → 3.1.1-dev.20221016
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/.eslintrc.cjs +33 -0
- package/.prettierignore +5 -0
- package/.vscode/settings.json +10 -0
- package/demo/encrypted/src/Backend.ts +27 -0
- package/demo/encrypted/src/Configuration.ts +7 -0
- package/demo/encrypted/src/api/HttpError.ts +1 -0
- package/demo/encrypted/src/api/IConnection.ts +1 -0
- package/demo/encrypted/src/api/Primitive.ts +1 -0
- package/demo/encrypted/src/api/__internal/AesPkcs5.ts +1 -0
- package/demo/encrypted/src/api/__internal/Fetcher.ts +1 -0
- package/demo/encrypted/src/api/functional/index.ts +7 -0
- package/demo/encrypted/src/api/functional/sellers/authenticate/index.ts +136 -0
- package/demo/encrypted/src/api/functional/sellers/authenticate/password/index.ts +53 -0
- package/demo/encrypted/src/api/functional/sellers/index.ts +7 -0
- package/demo/encrypted/src/api/index.ts +9 -0
- package/demo/encrypted/src/api/module.ts +10 -0
- package/demo/encrypted/src/api/structures/ISeller.ts +56 -0
- package/demo/encrypted/src/controllers/SellerAuthenticateController.ts +70 -0
- package/demo/encrypted/src/test/features/test_seller_exit.ts +18 -0
- package/demo/encrypted/src/test/features/test_seller_join.ts +19 -0
- package/demo/encrypted/src/test/features/test_seller_login.ts +16 -0
- package/demo/encrypted/src/test/features/test_seller_password_change.ts +18 -0
- package/demo/encrypted/src/test/index.ts +24 -0
- package/demo/encrypted/src/test/internal/DynamicImportIterator.ts +109 -0
- package/demo/encrypted/src/test/internal/StopWatch.ts +15 -0
- package/demo/encrypted/swagger.json +257 -0
- package/demo/encrypted/tsconfig.json +8 -0
- package/demo/generic/nestia.config.ts +10 -0
- package/demo/generic/src/Backend.ts +27 -0
- package/demo/generic/src/Configuration.ts +7 -0
- package/demo/generic/src/api/HttpError.ts +1 -0
- package/demo/generic/src/api/IConnection.ts +1 -0
- package/demo/generic/src/api/Primitive.ts +1 -0
- package/demo/generic/src/api/__internal/AesPkcs5.ts +1 -0
- package/demo/generic/src/api/__internal/Fetcher.ts +1 -0
- package/demo/generic/src/api/functional/consumers/index.ts +7 -0
- package/demo/generic/src/api/functional/consumers/sales/index.ts +8 -0
- package/demo/generic/src/api/functional/consumers/sales/questions/index.ts +136 -0
- package/demo/generic/src/api/functional/consumers/sales/reviews/index.ts +136 -0
- package/demo/generic/src/api/functional/index.ts +7 -0
- package/demo/generic/src/api/index.ts +9 -0
- package/demo/generic/src/api/module.ts +10 -0
- package/demo/generic/src/api/structures/IAttachmentFile.ts +21 -0
- package/demo/generic/src/api/structures/ISaleArticle.ts +79 -0
- package/demo/generic/src/api/structures/ISaleInquiry.ts +34 -0
- package/demo/generic/src/api/structures/ISaleInquiryAnswer.ts +23 -0
- package/demo/generic/src/api/structures/ISaleQuestion.ts +22 -0
- package/demo/generic/src/api/structures/ISaleReview.ts +32 -0
- package/demo/generic/src/controllers/ConsumerSaleQuestionsController.ts +33 -0
- package/demo/generic/src/controllers/ConsumerSaleReviewsController.ts +34 -0
- package/demo/generic/src/controllers/SaleInquiriesController.ts +87 -0
- package/demo/generic/src/test/features/test_question_store.ts +21 -0
- package/demo/generic/src/test/features/test_question_update.ts +42 -0
- package/demo/generic/src/test/features/test_review_store.ts +22 -0
- package/demo/generic/src/test/features/test_review_update.ts +44 -0
- package/demo/generic/src/test/index.ts +24 -0
- package/demo/generic/src/test/internal/DynamicImportIterator.ts +109 -0
- package/demo/generic/src/test/internal/StopWatch.ts +15 -0
- package/demo/generic/swagger.json +736 -0
- package/demo/generic/tsconfig.json +9 -0
- package/demo/multiple-paths/src/Backend.ts +27 -0
- package/demo/multiple-paths/src/Configuration.ts +7 -0
- package/demo/multiple-paths/src/api/HttpError.ts +1 -0
- package/demo/multiple-paths/src/api/IConnection.ts +1 -0
- package/demo/multiple-paths/src/api/Primitive.ts +1 -0
- package/demo/multiple-paths/src/api/__internal/AesPkcs5.ts +1 -0
- package/demo/multiple-paths/src/api/__internal/Fetcher.ts +1 -0
- package/demo/multiple-paths/src/api/functional/consumers/index.ts +7 -0
- package/demo/multiple-paths/src/api/functional/consumers/sales/articles/comments/index.ts +65 -0
- package/demo/multiple-paths/src/api/functional/consumers/sales/articles/index.ts +7 -0
- package/demo/multiple-paths/src/api/functional/consumers/sales/index.ts +7 -0
- package/demo/multiple-paths/src/api/functional/health/alive/index.ts +42 -0
- package/demo/multiple-paths/src/api/functional/health/index.ts +44 -0
- package/demo/multiple-paths/src/api/functional/healthy/alive/index.ts +42 -0
- package/demo/multiple-paths/src/api/functional/healthy/index.ts +44 -0
- package/demo/multiple-paths/src/api/functional/index.ts +10 -0
- package/demo/multiple-paths/src/api/functional/sellers/index.ts +7 -0
- package/demo/multiple-paths/src/api/functional/sellers/sales/articles/comments/index.ts +65 -0
- package/demo/multiple-paths/src/api/functional/sellers/sales/articles/index.ts +7 -0
- package/demo/multiple-paths/src/api/functional/sellers/sales/index.ts +7 -0
- package/demo/multiple-paths/src/api/index.ts +9 -0
- package/demo/multiple-paths/src/api/module.ts +10 -0
- package/demo/multiple-paths/src/api/structures/ISaleArticleComment.ts +93 -0
- package/demo/multiple-paths/src/controllers/HealthController.ts +7 -0
- package/demo/multiple-paths/src/controllers/MultipleController.ts +56 -0
- package/demo/multiple-paths/src/test/features/test_consumer_sale_article_comment_store.ts +21 -0
- package/demo/multiple-paths/src/test/features/test_health_checks.ts +10 -0
- package/demo/multiple-paths/src/test/features/test_seller_sale_article_store.ts +21 -0
- package/demo/multiple-paths/src/test/index.ts +24 -0
- package/demo/multiple-paths/src/test/internal/DynamicImportIterator.ts +109 -0
- package/demo/multiple-paths/src/test/internal/StopWatch.ts +15 -0
- package/demo/multiple-paths/swagger.json +338 -0
- package/demo/multiple-paths/tsconfig.json +3 -0
- package/demo/recursive/src/Backend.ts +27 -0
- package/demo/recursive/src/Configuration.ts +7 -0
- package/demo/recursive/src/api/HttpError.ts +1 -0
- package/demo/recursive/src/api/IConnection.ts +1 -0
- package/demo/recursive/src/api/Primitive.ts +1 -0
- package/demo/recursive/src/api/__internal/AesPkcs5.ts +1 -0
- package/demo/recursive/src/api/__internal/Fetcher.ts +1 -0
- package/demo/recursive/src/api/functional/consumers/index.ts +7 -0
- package/demo/recursive/src/api/functional/consumers/systematic/categories/index.ts +117 -0
- package/demo/recursive/src/api/functional/consumers/systematic/index.ts +7 -0
- package/demo/recursive/src/api/functional/index.ts +7 -0
- package/demo/recursive/src/api/index.ts +9 -0
- package/demo/recursive/src/api/module.ts +10 -0
- package/demo/recursive/src/api/structures/ICategory.ts +49 -0
- package/demo/recursive/src/consumer.categories.controller.ts +59 -0
- package/demo/recursive/src/test/features/test_category_at.ts +11 -0
- package/demo/recursive/src/test/features/test_category_invert.ts +14 -0
- package/demo/recursive/src/test/features/test_category_top.ts +11 -0
- package/demo/recursive/src/test/index.ts +24 -0
- package/demo/recursive/src/test/internal/DynamicImportIterator.ts +109 -0
- package/demo/recursive/src/test/internal/StopWatch.ts +15 -0
- package/demo/recursive/swagger.json +216 -0
- package/demo/recursive/tsconfig.json +3 -0
- package/demo/safe/nestia.config.ts +13 -0
- package/demo/safe/src/Backend.ts +27 -0
- package/demo/safe/src/Configuration.ts +7 -0
- package/demo/safe/src/api/HttpError.ts +1 -0
- package/demo/safe/src/api/IConnection.ts +1 -0
- package/demo/safe/src/api/Primitive.ts +1 -0
- package/demo/safe/src/api/__internal/AesPkcs5.ts +1 -0
- package/demo/safe/src/api/__internal/Fetcher.ts +1 -0
- package/demo/safe/src/api/functional/consumers/index.ts +7 -0
- package/demo/safe/src/api/functional/consumers/sales/articles/comments/index.ts +69 -0
- package/demo/safe/src/api/functional/consumers/sales/articles/index.ts +7 -0
- package/demo/safe/src/api/functional/consumers/sales/index.ts +7 -0
- package/demo/safe/src/api/functional/index.ts +7 -0
- package/demo/safe/src/api/index.ts +9 -0
- package/demo/safe/src/api/module.ts +10 -0
- package/demo/safe/src/api/structures/ISaleArticleComment.ts +93 -0
- package/demo/safe/src/controllers/ConsumerSaleArticleCommentsController.ts +63 -0
- package/demo/safe/src/test/features/test_comment_store.ts +23 -0
- package/demo/safe/src/test/index.ts +24 -0
- package/demo/safe/src/test/internal/DynamicImportIterator.ts +109 -0
- package/demo/safe/src/test/internal/StopWatch.ts +15 -0
- package/demo/safe/swagger.json +217 -0
- package/demo/safe/tsconfig.json +3 -0
- package/demo/tsconfig.base.json +70 -0
- package/demo/union/nestia.config.ts +9 -0
- package/demo/union/src/Backend.ts +27 -0
- package/demo/union/src/Configuration.ts +7 -0
- package/demo/union/src/api/HttpError.ts +1 -0
- package/demo/union/src/api/IConnection.ts +1 -0
- package/demo/union/src/api/Primitive.ts +1 -0
- package/demo/union/src/api/__internal/AesPkcs5.ts +1 -0
- package/demo/union/src/api/__internal/Fetcher.ts +1 -0
- package/demo/union/src/api/functional/consumers/index.ts +7 -0
- package/demo/union/src/api/functional/consumers/sales/entire_articles/index.ts +121 -0
- package/demo/union/src/api/functional/consumers/sales/index.ts +9 -0
- package/demo/union/src/api/functional/consumers/sales/questions/index.ts +57 -0
- package/demo/union/src/api/functional/consumers/sales/reviews/index.ts +54 -0
- package/demo/union/src/api/functional/index.ts +7 -0
- package/demo/union/src/api/index.ts +9 -0
- package/demo/union/src/api/module.ts +10 -0
- package/demo/union/src/api/structures/IAttachmentFile.ts +26 -0
- package/demo/union/src/api/structures/IPage.ts +80 -0
- package/demo/union/src/api/structures/ISaleArticle.ts +107 -0
- package/demo/union/src/api/structures/ISaleEntireArticle.ts +22 -0
- package/demo/union/src/api/structures/ISaleInquiry.ts +56 -0
- package/demo/union/src/api/structures/ISaleInquiryAnswer.ts +23 -0
- package/demo/union/src/api/structures/ISaleQuestion.ts +27 -0
- package/demo/union/src/api/structures/ISaleReview.ts +42 -0
- package/demo/union/src/controllers/ConsumerSaleEntireArticlesController.ts +109 -0
- package/demo/union/src/controllers/ConsumerSaleQuestionsController.ts +45 -0
- package/demo/union/src/controllers/ConsumerSaleReviewsController.ts +44 -0
- package/demo/union/src/test/features/test_sale_entire_articles_at.ts +16 -0
- package/demo/union/src/test/features/test_sale_entire_articles_index.ts +27 -0
- package/demo/union/src/test/index.ts +24 -0
- package/demo/union/src/test/internal/DynamicImportIterator.ts +109 -0
- package/demo/union/src/test/internal/StopWatch.ts +15 -0
- package/demo/union/swagger.json +991 -0
- package/demo/union/tsconfig.json +3 -0
- package/lib/test/TestBuilder.d.ts +4 -0
- package/lib/test/TestBuilder.js +60 -0
- package/lib/test/TestBuilder.js.map +1 -0
- package/lib/test/index.d.ts +1 -0
- package/lib/test/index.js +61 -0
- package/lib/test/index.js.map +1 -0
- package/lib/test/test.builder.executor.d.ts +1 -0
- package/lib/test/test.builder.executor.js +24 -0
- package/lib/test/test.builder.executor.js.map +1 -0
- package/package.json +1 -1
- package/prettier.config.js +7 -0
- package/src/IConfiguration.ts +119 -0
- package/src/NestiaApplication.ts +185 -0
- package/src/analyses/ControllerAnalyzer.ts +204 -0
- package/src/analyses/GenericAnalyzer.ts +53 -0
- package/src/analyses/ImportAnalyzer.ts +144 -0
- package/src/analyses/PathAnalyzer.ts +58 -0
- package/src/analyses/ReflectAnalyzer.ts +280 -0
- package/src/analyses/SourceFinder.ts +59 -0
- package/src/executable/internal/CompilerOptions.ts +18 -0
- package/src/executable/internal/NestiaCommand.ts +174 -0
- package/src/executable/internal/NestiaConfig.ts +36 -0
- package/src/executable/internal/NestiaStarter.ts +45 -0
- package/src/executable/internal/nestia.config.getter.ts +11 -0
- package/src/executable/nestia.ts +55 -0
- package/src/generates/FileGenerator.ts +156 -0
- package/src/generates/FunctionGenerator.ts +287 -0
- package/src/generates/SdkGenerator.ts +49 -0
- package/src/generates/SwaggerGenerator.ts +381 -0
- package/src/index.ts +2 -0
- package/src/module.ts +2 -0
- package/src/structures/IController.ts +27 -0
- package/src/structures/IRoute.ts +28 -0
- package/src/structures/ISwagger.ts +55 -0
- package/src/structures/ITypeTuple.ts +6 -0
- package/src/structures/MethodType.ts +11 -0
- package/src/structures/ParamCategory.ts +1 -0
- package/src/structures/TypeEntry.ts +22 -0
- package/src/test/TestBuilder.ts +49 -0
- package/src/test/index.ts +59 -0
- package/src/test/test.builder.executor.ts +11 -0
- package/src/utils/ArrayUtil.ts +26 -0
- package/src/utils/DirectoryUtil.ts +44 -0
- package/src/utils/ImportDictionary.ts +57 -0
- package/src/utils/MapUtil.ts +14 -0
- package/src/utils/StripEnums.ts +10 -0
- package/template/.eslintrc.cjs +22 -0
- package/template/.prettierignore +6 -0
- package/template/prettier.config.js +18 -0
- package/template/tsconfig.json +118 -0
- package/tsconfig.json +82 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export namespace StopWatch {
|
|
2
|
+
export type Task = () => Promise<void>;
|
|
3
|
+
|
|
4
|
+
export async function measure(task: Task): Promise<number> {
|
|
5
|
+
const time: number = Date.now();
|
|
6
|
+
await task();
|
|
7
|
+
return Date.now() - time;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export async function trace(title: string, task: Task): Promise<void> {
|
|
11
|
+
process.stdout.write(title);
|
|
12
|
+
const time: number = await measure(task);
|
|
13
|
+
console.log(`: ${time.toLocaleString()} ms`);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
{
|
|
2
|
+
"openapi": "3.0.1",
|
|
3
|
+
"servers": [
|
|
4
|
+
{
|
|
5
|
+
"url": "https://github.com/samchon/nestia",
|
|
6
|
+
"description": "insert your server url"
|
|
7
|
+
}
|
|
8
|
+
],
|
|
9
|
+
"info": {
|
|
10
|
+
"version": "0.1.0",
|
|
11
|
+
"title": "Generated by nestia - https://github.com/samchon/nestia"
|
|
12
|
+
},
|
|
13
|
+
"paths": {
|
|
14
|
+
"/sellers/authenticate/join": {
|
|
15
|
+
"post": {
|
|
16
|
+
"tags": [],
|
|
17
|
+
"summary": "encrypted",
|
|
18
|
+
"parameters": [],
|
|
19
|
+
"requestBody": {
|
|
20
|
+
"description": "## Warning\nRequest body must be encrypted.\n\nThe request body data would be encrypted as \"AES-128(256) / CBC mode / PKCS#5 Padding / Base64 Encoding\", through the [EncryptedBody](https://github.com/samchon/nestia-helper#encryptedbody) component.\n\nTherefore, just utilize this swagger editor only for referencing. If you need to call the real API, using [SDK](https://github.com/samchon/nestia#software-development-kit) would be much better.\n\n-----------------\n\nInformation of yours",
|
|
21
|
+
"content": {
|
|
22
|
+
"application/json": {
|
|
23
|
+
"schema": {
|
|
24
|
+
"$ref": "#/components/schemas/ISeller.IJoin"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"required": true
|
|
29
|
+
},
|
|
30
|
+
"responses": {
|
|
31
|
+
"201": {
|
|
32
|
+
"description": "## Warning\nResponse data have been encrypted.\n\nThe response body data would be encrypted as \"AES-128(256) / CBC mode / PKCS#5 Padding / Base64 Encoding\", through the [EncryptedRoute.P.ost](https://github.com/samchon/nestia-helper#encryptedroute) component.\n\nTherefore, just utilize this swagger editor only for referencing. If you need to call the real API, using [SDK](https://github.com/samchon/nestia#software-development-kit) would be much better.\n\n-----------------\n\nInformation of newly joined seller",
|
|
33
|
+
"content": {
|
|
34
|
+
"application/json": {
|
|
35
|
+
"schema": {
|
|
36
|
+
"$ref": "#/components/schemas/ISeller"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"description": "Join as a seller."
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"/sellers/authenticate/login": {
|
|
46
|
+
"post": {
|
|
47
|
+
"tags": [],
|
|
48
|
+
"summary": "encrypted",
|
|
49
|
+
"parameters": [],
|
|
50
|
+
"requestBody": {
|
|
51
|
+
"description": "## Warning\nRequest body must be encrypted.\n\nThe request body data would be encrypted as \"AES-128(256) / CBC mode / PKCS#5 Padding / Base64 Encoding\", through the [EncryptedBody](https://github.com/samchon/nestia-helper#encryptedbody) component.\n\nTherefore, just utilize this swagger editor only for referencing. If you need to call the real API, using [SDK](https://github.com/samchon/nestia#software-development-kit) would be much better.\n\n-----------------\n\nEmail and password",
|
|
52
|
+
"content": {
|
|
53
|
+
"application/json": {
|
|
54
|
+
"schema": {
|
|
55
|
+
"$ref": "#/components/schemas/ISeller.ILogin"
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"required": true
|
|
60
|
+
},
|
|
61
|
+
"responses": {
|
|
62
|
+
"201": {
|
|
63
|
+
"description": "## Warning\nResponse data have been encrypted.\n\nThe response body data would be encrypted as \"AES-128(256) / CBC mode / PKCS#5 Padding / Base64 Encoding\", through the [EncryptedRoute.P.ost](https://github.com/samchon/nestia-helper#encryptedroute) component.\n\nTherefore, just utilize this swagger editor only for referencing. If you need to call the real API, using [SDK](https://github.com/samchon/nestia#software-development-kit) would be much better.\n\n-----------------\n\nInformation of the seller",
|
|
64
|
+
"content": {
|
|
65
|
+
"application/json": {
|
|
66
|
+
"schema": {
|
|
67
|
+
"$ref": "#/components/schemas/ISeller"
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
"description": "Log-in as a seller."
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
"/sellers/authenticate/password/change": {
|
|
77
|
+
"patch": {
|
|
78
|
+
"tags": [],
|
|
79
|
+
"summary": "encrypted",
|
|
80
|
+
"parameters": [],
|
|
81
|
+
"requestBody": {
|
|
82
|
+
"description": "## Warning\nRequest body must be encrypted.\n\nThe request body data would be encrypted as \"AES-128(256) / CBC mode / PKCS#5 Padding / Base64 Encoding\", through the [EncryptedBody](https://github.com/samchon/nestia-helper#encryptedbody) component.\n\nTherefore, just utilize this swagger editor only for referencing. If you need to call the real API, using [SDK](https://github.com/samchon/nestia#software-development-kit) would be much better.\n\n-----------------\n\nOld and new passwords",
|
|
83
|
+
"content": {
|
|
84
|
+
"application/json": {
|
|
85
|
+
"schema": {
|
|
86
|
+
"$ref": "#/components/schemas/ISeller.IChangePassword"
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
"required": true
|
|
91
|
+
},
|
|
92
|
+
"responses": {
|
|
93
|
+
"201": {
|
|
94
|
+
"description": "Empty object"
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
"description": "Change password."
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
"/sellers/authenticate/exit": {
|
|
101
|
+
"delete": {
|
|
102
|
+
"tags": [],
|
|
103
|
+
"parameters": [],
|
|
104
|
+
"responses": {
|
|
105
|
+
"200": {
|
|
106
|
+
"description": ""
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
"description": "Erase the seller by itself."
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
"components": {
|
|
114
|
+
"securitySchemes": {
|
|
115
|
+
"bearerAuth": {
|
|
116
|
+
"type": "apiKey",
|
|
117
|
+
"name": "Authorization",
|
|
118
|
+
"in": "header"
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
"schemas": {
|
|
122
|
+
"ISeller.IJoin": {
|
|
123
|
+
"type": "object",
|
|
124
|
+
"properties": {
|
|
125
|
+
"email": {
|
|
126
|
+
"type": "string",
|
|
127
|
+
"nullable": false
|
|
128
|
+
},
|
|
129
|
+
"password": {
|
|
130
|
+
"type": "string",
|
|
131
|
+
"nullable": false
|
|
132
|
+
},
|
|
133
|
+
"name": {
|
|
134
|
+
"type": "string",
|
|
135
|
+
"nullable": false
|
|
136
|
+
},
|
|
137
|
+
"mobile": {
|
|
138
|
+
"type": "string",
|
|
139
|
+
"nullable": false
|
|
140
|
+
},
|
|
141
|
+
"company": {
|
|
142
|
+
"type": "string",
|
|
143
|
+
"nullable": false
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
"nullable": false,
|
|
147
|
+
"required": [
|
|
148
|
+
"email",
|
|
149
|
+
"password",
|
|
150
|
+
"name",
|
|
151
|
+
"mobile",
|
|
152
|
+
"company"
|
|
153
|
+
],
|
|
154
|
+
"jsDocTags": []
|
|
155
|
+
},
|
|
156
|
+
"ISeller": {
|
|
157
|
+
"type": "object",
|
|
158
|
+
"properties": {
|
|
159
|
+
"id": {
|
|
160
|
+
"type": "number",
|
|
161
|
+
"nullable": false,
|
|
162
|
+
"description": "Primary key."
|
|
163
|
+
},
|
|
164
|
+
"email": {
|
|
165
|
+
"type": "string",
|
|
166
|
+
"nullable": false,
|
|
167
|
+
"description": "Email address."
|
|
168
|
+
},
|
|
169
|
+
"name": {
|
|
170
|
+
"type": "string",
|
|
171
|
+
"nullable": false,
|
|
172
|
+
"description": "Name of the seller."
|
|
173
|
+
},
|
|
174
|
+
"mobile": {
|
|
175
|
+
"type": "string",
|
|
176
|
+
"nullable": false,
|
|
177
|
+
"description": "Mobile number of the seller."
|
|
178
|
+
},
|
|
179
|
+
"company": {
|
|
180
|
+
"type": "string",
|
|
181
|
+
"nullable": false,
|
|
182
|
+
"description": "Belonged company name."
|
|
183
|
+
},
|
|
184
|
+
"created_at": {
|
|
185
|
+
"type": "string",
|
|
186
|
+
"nullable": false,
|
|
187
|
+
"description": "Joined time."
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
"nullable": false,
|
|
191
|
+
"required": [
|
|
192
|
+
"id",
|
|
193
|
+
"email",
|
|
194
|
+
"name",
|
|
195
|
+
"mobile",
|
|
196
|
+
"company",
|
|
197
|
+
"created_at"
|
|
198
|
+
],
|
|
199
|
+
"description": "Seller information.",
|
|
200
|
+
"jsDocTags": [
|
|
201
|
+
{
|
|
202
|
+
"name": "author",
|
|
203
|
+
"text": [
|
|
204
|
+
{
|
|
205
|
+
"text": "Jeongho Nam - https://github.com/samchon",
|
|
206
|
+
"kind": "text"
|
|
207
|
+
}
|
|
208
|
+
]
|
|
209
|
+
}
|
|
210
|
+
]
|
|
211
|
+
},
|
|
212
|
+
"ISeller.ILogin": {
|
|
213
|
+
"type": "object",
|
|
214
|
+
"properties": {
|
|
215
|
+
"email": {
|
|
216
|
+
"type": "string",
|
|
217
|
+
"nullable": false
|
|
218
|
+
},
|
|
219
|
+
"password": {
|
|
220
|
+
"type": "string",
|
|
221
|
+
"nullable": false
|
|
222
|
+
}
|
|
223
|
+
},
|
|
224
|
+
"nullable": false,
|
|
225
|
+
"required": [
|
|
226
|
+
"email",
|
|
227
|
+
"password"
|
|
228
|
+
],
|
|
229
|
+
"jsDocTags": []
|
|
230
|
+
},
|
|
231
|
+
"ISeller.IChangePassword": {
|
|
232
|
+
"type": "object",
|
|
233
|
+
"properties": {
|
|
234
|
+
"old_password": {
|
|
235
|
+
"type": "string",
|
|
236
|
+
"nullable": false
|
|
237
|
+
},
|
|
238
|
+
"new_password": {
|
|
239
|
+
"type": "string",
|
|
240
|
+
"nullable": false
|
|
241
|
+
}
|
|
242
|
+
},
|
|
243
|
+
"nullable": false,
|
|
244
|
+
"required": [
|
|
245
|
+
"old_password",
|
|
246
|
+
"new_password"
|
|
247
|
+
],
|
|
248
|
+
"jsDocTags": []
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
},
|
|
252
|
+
"security": [
|
|
253
|
+
{
|
|
254
|
+
"bearerAuth": []
|
|
255
|
+
}
|
|
256
|
+
]
|
|
257
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import helper from "nestia-helper";
|
|
2
|
+
import * as nest from "@nestjs/common";
|
|
3
|
+
import { NestFactory } from "@nestjs/core";
|
|
4
|
+
import { Configuration } from "./Configuration";
|
|
5
|
+
|
|
6
|
+
export class Backend {
|
|
7
|
+
private application_?: nest.INestApplication;
|
|
8
|
+
|
|
9
|
+
public async open(): Promise<void> {
|
|
10
|
+
this.application_ = await NestFactory.create(
|
|
11
|
+
await helper.EncryptedModule.dynamic(
|
|
12
|
+
__dirname + "/controllers",
|
|
13
|
+
Configuration.ENCRYPTION_PASSWORD,
|
|
14
|
+
),
|
|
15
|
+
{ logger: false },
|
|
16
|
+
);
|
|
17
|
+
await this.application_.listen(Configuration.PORT);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
public async close(): Promise<void> {
|
|
21
|
+
if (this.application_ === undefined) return;
|
|
22
|
+
|
|
23
|
+
const app = this.application_;
|
|
24
|
+
delete this.application_;
|
|
25
|
+
await app.close();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { HttpError } from "nestia-fetcher";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { IConnection } from "nestia-fetcher";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Primitive } from "nestia-fetcher";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { AesPkcs5 } from "nestia-fetcher";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Fetcher } from "nestia-fetcher";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* @module api.functional.consumers.sales
|
|
4
|
+
* @nestia Generated by Nestia - https://github.com/samchon/nestia
|
|
5
|
+
*/
|
|
6
|
+
//================================================================
|
|
7
|
+
export * as questions from "./questions";
|
|
8
|
+
export * as reviews from "./reviews";
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* @module api.functional.consumers.sales.questions
|
|
4
|
+
* @nestia Generated by Nestia - https://github.com/samchon/nestia
|
|
5
|
+
*/
|
|
6
|
+
//================================================================
|
|
7
|
+
import { Fetcher, Primitive } from "nestia-fetcher";
|
|
8
|
+
import type { IConnection } from "nestia-fetcher";
|
|
9
|
+
import TSON from "typescript-json";
|
|
10
|
+
|
|
11
|
+
import type { ISaleArticle } from "./../../../../structures/ISaleArticle";
|
|
12
|
+
import type { ISaleInquiry } from "./../../../../structures/ISaleInquiry";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Store a new inquiry.
|
|
16
|
+
*
|
|
17
|
+
* Write a new article inquirying about a sale.
|
|
18
|
+
*
|
|
19
|
+
* @param connection connection Information of the remote HTTP(s) server with headers (+encryption password)
|
|
20
|
+
* @param request Instance of the Express.Request
|
|
21
|
+
* @param section Code of the target section
|
|
22
|
+
* @param saleId ID of the target sale
|
|
23
|
+
* @param input Content to archive
|
|
24
|
+
* @return Newly archived inquiry
|
|
25
|
+
* @throw 400 bad request error when type of the input data is not valid
|
|
26
|
+
* @throw 401 unauthorized error when you've not logged in yet
|
|
27
|
+
*
|
|
28
|
+
* @controller ConsumerSaleQuestionsController.store()
|
|
29
|
+
* @path POST /consumers/:section/sales/:saleId/questions
|
|
30
|
+
* @nestia Generated by Nestia - https://github.com/samchon/nestia
|
|
31
|
+
*/
|
|
32
|
+
export function store
|
|
33
|
+
(
|
|
34
|
+
connection: IConnection,
|
|
35
|
+
section: string,
|
|
36
|
+
saleId: string,
|
|
37
|
+
input: Primitive<store.Input>
|
|
38
|
+
): Promise<store.Output>
|
|
39
|
+
{
|
|
40
|
+
TSON.assertType<typeof section>(section);
|
|
41
|
+
TSON.assertType<typeof saleId>(saleId);
|
|
42
|
+
TSON.assertType<typeof input>(input);
|
|
43
|
+
|
|
44
|
+
return Fetcher.fetch
|
|
45
|
+
(
|
|
46
|
+
connection,
|
|
47
|
+
store.ENCRYPTED,
|
|
48
|
+
store.METHOD,
|
|
49
|
+
store.path(section, saleId),
|
|
50
|
+
input,
|
|
51
|
+
store.stringify
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
export namespace store
|
|
55
|
+
{
|
|
56
|
+
export type Input = Primitive<ISaleArticle.IStore>;
|
|
57
|
+
export type Output = Primitive<ISaleInquiry<ISaleArticle.IContent>>;
|
|
58
|
+
|
|
59
|
+
export const METHOD = "POST" as const;
|
|
60
|
+
export const PATH: string = "/consumers/:section/sales/:saleId/questions";
|
|
61
|
+
export const ENCRYPTED: Fetcher.IEncrypted = {
|
|
62
|
+
request: false,
|
|
63
|
+
response: false,
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export function path(section: string, saleId: string): string
|
|
67
|
+
{
|
|
68
|
+
return `/consumers/${encodeURIComponent(section)}/sales/${encodeURIComponent(saleId)}/questions`;
|
|
69
|
+
}
|
|
70
|
+
export const stringify = (input: Input) => TSON.stringify(input);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Update an inquiry.
|
|
75
|
+
*
|
|
76
|
+
* Update ordinary inquiry article. However, it would not modify the content reocrd
|
|
77
|
+
* {@link ISaleInquiry.IContent}, but be accumulated into the {@link ISaleInquiry.contents}.
|
|
78
|
+
* Therefore, all of the poeple can read how the content has been changed.
|
|
79
|
+
*
|
|
80
|
+
* @param connection connection Information of the remote HTTP(s) server with headers (+encryption password)
|
|
81
|
+
* @param request Instance of the Express.Request
|
|
82
|
+
* @param section Code of the target section
|
|
83
|
+
* @param saleId ID of the target sale
|
|
84
|
+
* @param id ID of the target article to be updated
|
|
85
|
+
* @param input New content to be overwritten
|
|
86
|
+
* @return The newly created content record
|
|
87
|
+
* @throw 400 bad request error when type of the input data is not valid
|
|
88
|
+
* @throw 401 unauthorized error when you've not logged in yet
|
|
89
|
+
* @throw 403 forbidden error when the article is not yours
|
|
90
|
+
*
|
|
91
|
+
* @controller ConsumerSaleQuestionsController.update()
|
|
92
|
+
* @path PUT /consumers/:section/sales/:saleId/questions/:id
|
|
93
|
+
* @nestia Generated by Nestia - https://github.com/samchon/nestia
|
|
94
|
+
*/
|
|
95
|
+
export function update
|
|
96
|
+
(
|
|
97
|
+
connection: IConnection,
|
|
98
|
+
section: string,
|
|
99
|
+
saleId: string,
|
|
100
|
+
id: number,
|
|
101
|
+
input: Primitive<update.Input>
|
|
102
|
+
): Promise<update.Output>
|
|
103
|
+
{
|
|
104
|
+
TSON.assertType<typeof section>(section);
|
|
105
|
+
TSON.assertType<typeof saleId>(saleId);
|
|
106
|
+
TSON.assertType<typeof id>(id);
|
|
107
|
+
TSON.assertType<typeof input>(input);
|
|
108
|
+
|
|
109
|
+
return Fetcher.fetch
|
|
110
|
+
(
|
|
111
|
+
connection,
|
|
112
|
+
update.ENCRYPTED,
|
|
113
|
+
update.METHOD,
|
|
114
|
+
update.path(section, saleId, id),
|
|
115
|
+
input,
|
|
116
|
+
update.stringify
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
export namespace update
|
|
120
|
+
{
|
|
121
|
+
export type Input = Primitive<ISaleArticle.IStore>;
|
|
122
|
+
export type Output = Primitive<ISaleInquiry<ISaleArticle.IContent>>;
|
|
123
|
+
|
|
124
|
+
export const METHOD = "PUT" as const;
|
|
125
|
+
export const PATH: string = "/consumers/:section/sales/:saleId/questions/:id";
|
|
126
|
+
export const ENCRYPTED: Fetcher.IEncrypted = {
|
|
127
|
+
request: false,
|
|
128
|
+
response: false,
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export function path(section: string, saleId: string, id: number): string
|
|
132
|
+
{
|
|
133
|
+
return `/consumers/${encodeURIComponent(section)}/sales/${encodeURIComponent(saleId)}/questions/${encodeURIComponent(id)}`;
|
|
134
|
+
}
|
|
135
|
+
export const stringify = (input: Input) => TSON.stringify(input);
|
|
136
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* @module api.functional.consumers.sales.reviews
|
|
4
|
+
* @nestia Generated by Nestia - https://github.com/samchon/nestia
|
|
5
|
+
*/
|
|
6
|
+
//================================================================
|
|
7
|
+
import { Fetcher, Primitive } from "nestia-fetcher";
|
|
8
|
+
import type { IConnection } from "nestia-fetcher";
|
|
9
|
+
import TSON from "typescript-json";
|
|
10
|
+
|
|
11
|
+
import type { ISaleReview } from "./../../../../structures/ISaleReview";
|
|
12
|
+
import type { ISaleInquiry } from "./../../../../structures/ISaleInquiry";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Store a new inquiry.
|
|
16
|
+
*
|
|
17
|
+
* Write a new article inquirying about a sale.
|
|
18
|
+
*
|
|
19
|
+
* @param connection connection Information of the remote HTTP(s) server with headers (+encryption password)
|
|
20
|
+
* @param request Instance of the Express.Request
|
|
21
|
+
* @param section Code of the target section
|
|
22
|
+
* @param saleId ID of the target sale
|
|
23
|
+
* @param input Content to archive
|
|
24
|
+
* @return Newly archived inquiry
|
|
25
|
+
* @throw 400 bad request error when type of the input data is not valid
|
|
26
|
+
* @throw 401 unauthorized error when you've not logged in yet
|
|
27
|
+
*
|
|
28
|
+
* @controller ConsumerSaleReviewsController.store()
|
|
29
|
+
* @path POST /consumers/:section/sales/:saleId/reviews
|
|
30
|
+
* @nestia Generated by Nestia - https://github.com/samchon/nestia
|
|
31
|
+
*/
|
|
32
|
+
export function store
|
|
33
|
+
(
|
|
34
|
+
connection: IConnection,
|
|
35
|
+
section: string,
|
|
36
|
+
saleId: string,
|
|
37
|
+
input: Primitive<store.Input>
|
|
38
|
+
): Promise<store.Output>
|
|
39
|
+
{
|
|
40
|
+
TSON.assertType<typeof section>(section);
|
|
41
|
+
TSON.assertType<typeof saleId>(saleId);
|
|
42
|
+
TSON.assertType<typeof input>(input);
|
|
43
|
+
|
|
44
|
+
return Fetcher.fetch
|
|
45
|
+
(
|
|
46
|
+
connection,
|
|
47
|
+
store.ENCRYPTED,
|
|
48
|
+
store.METHOD,
|
|
49
|
+
store.path(section, saleId),
|
|
50
|
+
input,
|
|
51
|
+
store.stringify
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
export namespace store
|
|
55
|
+
{
|
|
56
|
+
export type Input = Primitive<ISaleReview.IStore>;
|
|
57
|
+
export type Output = Primitive<ISaleInquiry<ISaleReview.IContent>>;
|
|
58
|
+
|
|
59
|
+
export const METHOD = "POST" as const;
|
|
60
|
+
export const PATH: string = "/consumers/:section/sales/:saleId/reviews";
|
|
61
|
+
export const ENCRYPTED: Fetcher.IEncrypted = {
|
|
62
|
+
request: false,
|
|
63
|
+
response: false,
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export function path(section: string, saleId: string): string
|
|
67
|
+
{
|
|
68
|
+
return `/consumers/${encodeURIComponent(section)}/sales/${encodeURIComponent(saleId)}/reviews`;
|
|
69
|
+
}
|
|
70
|
+
export const stringify = (input: Input) => TSON.stringify(input);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Update an inquiry.
|
|
75
|
+
*
|
|
76
|
+
* Update ordinary inquiry article. However, it would not modify the content reocrd
|
|
77
|
+
* {@link ISaleInquiry.IContent}, but be accumulated into the {@link ISaleInquiry.contents}.
|
|
78
|
+
* Therefore, all of the poeple can read how the content has been changed.
|
|
79
|
+
*
|
|
80
|
+
* @param connection connection Information of the remote HTTP(s) server with headers (+encryption password)
|
|
81
|
+
* @param request Instance of the Express.Request
|
|
82
|
+
* @param section Code of the target section
|
|
83
|
+
* @param saleId ID of the target sale
|
|
84
|
+
* @param id ID of the target article to be updated
|
|
85
|
+
* @param input New content to be overwritten
|
|
86
|
+
* @return The newly created content record
|
|
87
|
+
* @throw 400 bad request error when type of the input data is not valid
|
|
88
|
+
* @throw 401 unauthorized error when you've not logged in yet
|
|
89
|
+
* @throw 403 forbidden error when the article is not yours
|
|
90
|
+
*
|
|
91
|
+
* @controller ConsumerSaleReviewsController.update()
|
|
92
|
+
* @path PUT /consumers/:section/sales/:saleId/reviews/:id
|
|
93
|
+
* @nestia Generated by Nestia - https://github.com/samchon/nestia
|
|
94
|
+
*/
|
|
95
|
+
export function update
|
|
96
|
+
(
|
|
97
|
+
connection: IConnection,
|
|
98
|
+
section: string,
|
|
99
|
+
saleId: string,
|
|
100
|
+
id: number,
|
|
101
|
+
input: Primitive<update.Input>
|
|
102
|
+
): Promise<update.Output>
|
|
103
|
+
{
|
|
104
|
+
TSON.assertType<typeof section>(section);
|
|
105
|
+
TSON.assertType<typeof saleId>(saleId);
|
|
106
|
+
TSON.assertType<typeof id>(id);
|
|
107
|
+
TSON.assertType<typeof input>(input);
|
|
108
|
+
|
|
109
|
+
return Fetcher.fetch
|
|
110
|
+
(
|
|
111
|
+
connection,
|
|
112
|
+
update.ENCRYPTED,
|
|
113
|
+
update.METHOD,
|
|
114
|
+
update.path(section, saleId, id),
|
|
115
|
+
input,
|
|
116
|
+
update.stringify
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
export namespace update
|
|
120
|
+
{
|
|
121
|
+
export type Input = Primitive<ISaleReview.IStore>;
|
|
122
|
+
export type Output = Primitive<ISaleInquiry<ISaleReview.IContent>>;
|
|
123
|
+
|
|
124
|
+
export const METHOD = "PUT" as const;
|
|
125
|
+
export const PATH: string = "/consumers/:section/sales/:saleId/reviews/:id";
|
|
126
|
+
export const ENCRYPTED: Fetcher.IEncrypted = {
|
|
127
|
+
request: false,
|
|
128
|
+
response: false,
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export function path(section: string, saleId: string, id: number): string
|
|
132
|
+
{
|
|
133
|
+
return `/consumers/${encodeURIComponent(section)}/sales/${encodeURIComponent(saleId)}/reviews/${encodeURIComponent(id)}`;
|
|
134
|
+
}
|
|
135
|
+
export const stringify = (input: Input) => TSON.stringify(input);
|
|
136
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* @module api
|
|
4
|
+
*/
|
|
5
|
+
//================================================================
|
|
6
|
+
export * from "./IConnection";
|
|
7
|
+
export * from "./Primitive";
|
|
8
|
+
export * from "./HttpError";
|
|
9
|
+
|
|
10
|
+
export * as functional from "./functional";
|