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,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,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* @module api.functional.consumers.sales.articles.comments
|
|
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
|
+
|
|
10
|
+
import type { ISaleArticleComment } from "./../../../../../structures/ISaleArticleComment";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Store a new comment.
|
|
14
|
+
*
|
|
15
|
+
* @param connection connection Information of the remote HTTP(s) server with headers (+encryption password)
|
|
16
|
+
* @param request Instance of the Express.Request
|
|
17
|
+
* @param section Code of the target section
|
|
18
|
+
* @param saleId ID of the target sale
|
|
19
|
+
* @param articleId ID of the target article
|
|
20
|
+
* @param input Content to write
|
|
21
|
+
* @return Newly archived comment
|
|
22
|
+
* @throw 400 bad request error when type of the input data is not valid
|
|
23
|
+
* @throw 401 unauthorized error when you've not logged in yet
|
|
24
|
+
* @throw 403 forbidden error when you're a seller and the sale is not yours
|
|
25
|
+
* @throw 404 not found error when unable to find the matched record
|
|
26
|
+
*
|
|
27
|
+
* @controller MultipleCommentsController.store()
|
|
28
|
+
* @path POST /consumers/:section/sales/:saleId/articles/:articleId/comments
|
|
29
|
+
* @nestia Generated by Nestia - https://github.com/samchon/nestia
|
|
30
|
+
*/
|
|
31
|
+
export function store
|
|
32
|
+
(
|
|
33
|
+
connection: IConnection,
|
|
34
|
+
section: string,
|
|
35
|
+
saleId: number,
|
|
36
|
+
articleId: number,
|
|
37
|
+
input: Primitive<store.Input>
|
|
38
|
+
): Promise<store.Output>
|
|
39
|
+
{
|
|
40
|
+
return Fetcher.fetch
|
|
41
|
+
(
|
|
42
|
+
connection,
|
|
43
|
+
store.ENCRYPTED,
|
|
44
|
+
store.METHOD,
|
|
45
|
+
store.path(section, saleId, articleId),
|
|
46
|
+
input
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
export namespace store
|
|
50
|
+
{
|
|
51
|
+
export type Input = Primitive<ISaleArticleComment.IStore>;
|
|
52
|
+
export type Output = Primitive<ISaleArticleComment>;
|
|
53
|
+
|
|
54
|
+
export const METHOD = "POST" as const;
|
|
55
|
+
export const PATH: string = "/consumers/:section/sales/:saleId/articles/:articleId/comments";
|
|
56
|
+
export const ENCRYPTED: Fetcher.IEncrypted = {
|
|
57
|
+
request: false,
|
|
58
|
+
response: false,
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export function path(section: string, saleId: number, articleId: number): string
|
|
62
|
+
{
|
|
63
|
+
return `/consumers/${encodeURIComponent(section)}/sales/${encodeURIComponent(saleId)}/articles/${encodeURIComponent(articleId)}/comments`;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* @module api.functional.health.alive
|
|
4
|
+
* @nestia Generated by Nestia - https://github.com/samchon/nestia
|
|
5
|
+
*/
|
|
6
|
+
//================================================================
|
|
7
|
+
import { Fetcher } from "nestia-fetcher";
|
|
8
|
+
import type { IConnection } from "nestia-fetcher";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @controller HealthController.check()
|
|
12
|
+
* @path GET /health/alive
|
|
13
|
+
* @nestia Generated by Nestia - https://github.com/samchon/nestia
|
|
14
|
+
*/
|
|
15
|
+
export function check
|
|
16
|
+
(
|
|
17
|
+
connection: IConnection
|
|
18
|
+
): Promise<void>
|
|
19
|
+
{
|
|
20
|
+
return Fetcher.fetch
|
|
21
|
+
(
|
|
22
|
+
connection,
|
|
23
|
+
check.ENCRYPTED,
|
|
24
|
+
check.METHOD,
|
|
25
|
+
check.path()
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
export namespace check
|
|
29
|
+
{
|
|
30
|
+
|
|
31
|
+
export const METHOD = "GET" as const;
|
|
32
|
+
export const PATH: string = "/health/alive";
|
|
33
|
+
export const ENCRYPTED: Fetcher.IEncrypted = {
|
|
34
|
+
request: false,
|
|
35
|
+
response: false,
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export function path(): string
|
|
39
|
+
{
|
|
40
|
+
return `/health/alive`;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* @module api.functional.health
|
|
4
|
+
* @nestia Generated by Nestia - https://github.com/samchon/nestia
|
|
5
|
+
*/
|
|
6
|
+
//================================================================
|
|
7
|
+
import { Fetcher } from "nestia-fetcher";
|
|
8
|
+
import type { IConnection } from "nestia-fetcher";
|
|
9
|
+
|
|
10
|
+
export * as alive from "./alive";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @controller HealthController.check()
|
|
14
|
+
* @path GET /health/check
|
|
15
|
+
* @nestia Generated by Nestia - https://github.com/samchon/nestia
|
|
16
|
+
*/
|
|
17
|
+
export function check
|
|
18
|
+
(
|
|
19
|
+
connection: IConnection
|
|
20
|
+
): Promise<void>
|
|
21
|
+
{
|
|
22
|
+
return Fetcher.fetch
|
|
23
|
+
(
|
|
24
|
+
connection,
|
|
25
|
+
check.ENCRYPTED,
|
|
26
|
+
check.METHOD,
|
|
27
|
+
check.path()
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
export namespace check
|
|
31
|
+
{
|
|
32
|
+
|
|
33
|
+
export const METHOD = "GET" as const;
|
|
34
|
+
export const PATH: string = "/health/check";
|
|
35
|
+
export const ENCRYPTED: Fetcher.IEncrypted = {
|
|
36
|
+
request: false,
|
|
37
|
+
response: false,
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export function path(): string
|
|
41
|
+
{
|
|
42
|
+
return `/health/check`;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* @module api.functional.healthy.alive
|
|
4
|
+
* @nestia Generated by Nestia - https://github.com/samchon/nestia
|
|
5
|
+
*/
|
|
6
|
+
//================================================================
|
|
7
|
+
import { Fetcher } from "nestia-fetcher";
|
|
8
|
+
import type { IConnection } from "nestia-fetcher";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @controller HealthController.check()
|
|
12
|
+
* @path GET /healthy/alive
|
|
13
|
+
* @nestia Generated by Nestia - https://github.com/samchon/nestia
|
|
14
|
+
*/
|
|
15
|
+
export function check
|
|
16
|
+
(
|
|
17
|
+
connection: IConnection
|
|
18
|
+
): Promise<void>
|
|
19
|
+
{
|
|
20
|
+
return Fetcher.fetch
|
|
21
|
+
(
|
|
22
|
+
connection,
|
|
23
|
+
check.ENCRYPTED,
|
|
24
|
+
check.METHOD,
|
|
25
|
+
check.path()
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
export namespace check
|
|
29
|
+
{
|
|
30
|
+
|
|
31
|
+
export const METHOD = "GET" as const;
|
|
32
|
+
export const PATH: string = "/healthy/alive";
|
|
33
|
+
export const ENCRYPTED: Fetcher.IEncrypted = {
|
|
34
|
+
request: false,
|
|
35
|
+
response: false,
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export function path(): string
|
|
39
|
+
{
|
|
40
|
+
return `/healthy/alive`;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* @module api.functional.healthy
|
|
4
|
+
* @nestia Generated by Nestia - https://github.com/samchon/nestia
|
|
5
|
+
*/
|
|
6
|
+
//================================================================
|
|
7
|
+
import { Fetcher } from "nestia-fetcher";
|
|
8
|
+
import type { IConnection } from "nestia-fetcher";
|
|
9
|
+
|
|
10
|
+
export * as alive from "./alive";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @controller HealthController.check()
|
|
14
|
+
* @path GET /healthy/check
|
|
15
|
+
* @nestia Generated by Nestia - https://github.com/samchon/nestia
|
|
16
|
+
*/
|
|
17
|
+
export function check
|
|
18
|
+
(
|
|
19
|
+
connection: IConnection
|
|
20
|
+
): Promise<void>
|
|
21
|
+
{
|
|
22
|
+
return Fetcher.fetch
|
|
23
|
+
(
|
|
24
|
+
connection,
|
|
25
|
+
check.ENCRYPTED,
|
|
26
|
+
check.METHOD,
|
|
27
|
+
check.path()
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
export namespace check
|
|
31
|
+
{
|
|
32
|
+
|
|
33
|
+
export const METHOD = "GET" as const;
|
|
34
|
+
export const PATH: string = "/healthy/check";
|
|
35
|
+
export const ENCRYPTED: Fetcher.IEncrypted = {
|
|
36
|
+
request: false,
|
|
37
|
+
response: false,
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export function path(): string
|
|
41
|
+
{
|
|
42
|
+
return `/healthy/check`;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* @module api.functional
|
|
4
|
+
* @nestia Generated by Nestia - https://github.com/samchon/nestia
|
|
5
|
+
*/
|
|
6
|
+
//================================================================
|
|
7
|
+
export * as health from "./health";
|
|
8
|
+
export * as healthy from "./healthy";
|
|
9
|
+
export * as consumers from "./consumers";
|
|
10
|
+
export * as sellers from "./sellers";
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* @module api.functional.sellers.sales.articles.comments
|
|
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
|
+
|
|
10
|
+
import type { ISaleArticleComment } from "./../../../../../structures/ISaleArticleComment";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Store a new comment.
|
|
14
|
+
*
|
|
15
|
+
* @param connection connection Information of the remote HTTP(s) server with headers (+encryption password)
|
|
16
|
+
* @param request Instance of the Express.Request
|
|
17
|
+
* @param section Code of the target section
|
|
18
|
+
* @param saleId ID of the target sale
|
|
19
|
+
* @param articleId ID of the target article
|
|
20
|
+
* @param input Content to write
|
|
21
|
+
* @return Newly archived comment
|
|
22
|
+
* @throw 400 bad request error when type of the input data is not valid
|
|
23
|
+
* @throw 401 unauthorized error when you've not logged in yet
|
|
24
|
+
* @throw 403 forbidden error when you're a seller and the sale is not yours
|
|
25
|
+
* @throw 404 not found error when unable to find the matched record
|
|
26
|
+
*
|
|
27
|
+
* @controller MultipleCommentsController.store()
|
|
28
|
+
* @path POST /sellers/:section/sales/:saleId/articles/:articleId/comments
|
|
29
|
+
* @nestia Generated by Nestia - https://github.com/samchon/nestia
|
|
30
|
+
*/
|
|
31
|
+
export function store
|
|
32
|
+
(
|
|
33
|
+
connection: IConnection,
|
|
34
|
+
section: string,
|
|
35
|
+
saleId: number,
|
|
36
|
+
articleId: number,
|
|
37
|
+
input: Primitive<store.Input>
|
|
38
|
+
): Promise<store.Output>
|
|
39
|
+
{
|
|
40
|
+
return Fetcher.fetch
|
|
41
|
+
(
|
|
42
|
+
connection,
|
|
43
|
+
store.ENCRYPTED,
|
|
44
|
+
store.METHOD,
|
|
45
|
+
store.path(section, saleId, articleId),
|
|
46
|
+
input
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
export namespace store
|
|
50
|
+
{
|
|
51
|
+
export type Input = Primitive<ISaleArticleComment.IStore>;
|
|
52
|
+
export type Output = Primitive<ISaleArticleComment>;
|
|
53
|
+
|
|
54
|
+
export const METHOD = "POST" as const;
|
|
55
|
+
export const PATH: string = "/sellers/:section/sales/:saleId/articles/:articleId/comments";
|
|
56
|
+
export const ENCRYPTED: Fetcher.IEncrypted = {
|
|
57
|
+
request: false,
|
|
58
|
+
response: false,
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export function path(section: string, saleId: number, articleId: number): string
|
|
62
|
+
{
|
|
63
|
+
return `/sellers/${encodeURIComponent(section)}/sales/${encodeURIComponent(saleId)}/articles/${encodeURIComponent(articleId)}/comments`;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -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";
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Comment wrote on a sale related article.
|
|
3
|
+
*
|
|
4
|
+
* When an article of a sale has been enrolled, all of the participants like consumers and
|
|
5
|
+
* sellers can write a comment on that article. However, when the writer is a consumer, the
|
|
6
|
+
* consumer can hide its name through the annoymous option.
|
|
7
|
+
*
|
|
8
|
+
* Also, writing a reply comment for a specific comment is possible and in that case, the
|
|
9
|
+
* {@link ISaleArticleComment.parent_id} property would be activated.
|
|
10
|
+
*
|
|
11
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
12
|
+
*/
|
|
13
|
+
export interface ISaleArticleComment {
|
|
14
|
+
/**
|
|
15
|
+
* Primary Key.
|
|
16
|
+
*/
|
|
17
|
+
id: number;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Parent comment ID.
|
|
21
|
+
*
|
|
22
|
+
* Only When this comment has been written as a reply.
|
|
23
|
+
*/
|
|
24
|
+
parent_id: number | null;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Type of the writer.
|
|
28
|
+
*/
|
|
29
|
+
writer_type: "seller" | "consumer";
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Name of the writer.
|
|
33
|
+
*
|
|
34
|
+
* When this is a type of anonymous comment, writer name would be hidden.
|
|
35
|
+
*/
|
|
36
|
+
writer_name: string | null;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Contents of the comments.
|
|
40
|
+
*
|
|
41
|
+
* When the comment writer tries to modify content, it would not modify the comment
|
|
42
|
+
* content but would be accumulated. Therefore, all of the people can read how
|
|
43
|
+
* the content has been changed.
|
|
44
|
+
*/
|
|
45
|
+
contents: ISaleArticleComment.IContent[];
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Creation time.
|
|
49
|
+
*/
|
|
50
|
+
created_at: string;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export namespace ISaleArticleComment {
|
|
54
|
+
/**
|
|
55
|
+
* Store info.
|
|
56
|
+
*/
|
|
57
|
+
export interface IStore {
|
|
58
|
+
/**
|
|
59
|
+
* Body of the content.
|
|
60
|
+
*/
|
|
61
|
+
body: string;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Extension, content type (format).
|
|
65
|
+
*/
|
|
66
|
+
extension: "html" | "md" | "txt";
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Whether to hide the writer name or not.
|
|
70
|
+
*/
|
|
71
|
+
annonymous: boolean;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Content info.
|
|
76
|
+
*/
|
|
77
|
+
export interface IContent {
|
|
78
|
+
/**
|
|
79
|
+
* Primary Key.
|
|
80
|
+
*/
|
|
81
|
+
id: string;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Body of the content.
|
|
85
|
+
*/
|
|
86
|
+
body: string;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Creation time.
|
|
90
|
+
*/
|
|
91
|
+
created_at: string;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import * as express from "express";
|
|
2
|
+
import * as nest from "@nestjs/common";
|
|
3
|
+
import helper from "nestia-helper";
|
|
4
|
+
|
|
5
|
+
import { ISaleArticleComment } from "../api/structures/ISaleArticleComment";
|
|
6
|
+
|
|
7
|
+
@nest.Controller({
|
|
8
|
+
path: [
|
|
9
|
+
"consumers/:section/sales/:saleId/articles/:articleId/comments",
|
|
10
|
+
"sellers/:section/sales/:saleId/articles/:articleId/comments",
|
|
11
|
+
],
|
|
12
|
+
})
|
|
13
|
+
export class MultipleCommentsController {
|
|
14
|
+
/**
|
|
15
|
+
* Store a new comment.
|
|
16
|
+
*
|
|
17
|
+
* @param request Instance of the Express.Request
|
|
18
|
+
* @param section Code of the target section
|
|
19
|
+
* @param saleId ID of the target sale
|
|
20
|
+
* @param articleId ID of the target article
|
|
21
|
+
* @param input Content to write
|
|
22
|
+
* @return Newly archived comment
|
|
23
|
+
*
|
|
24
|
+
* @throw 400 bad request error when type of the input data is not valid
|
|
25
|
+
* @throw 401 unauthorized error when you've not logged in yet
|
|
26
|
+
* @throw 403 forbidden error when you're a seller and the sale is not yours
|
|
27
|
+
* @throw 404 not found error when unable to find the matched record
|
|
28
|
+
*/
|
|
29
|
+
@nest.Post([])
|
|
30
|
+
public async store(
|
|
31
|
+
@nest.Request() request: express.Request,
|
|
32
|
+
@helper.TypedParam("section", "string") section: string,
|
|
33
|
+
@helper.TypedParam("saleId", "number") saleId: number,
|
|
34
|
+
@helper.TypedParam("articleId", "number") articleId: number,
|
|
35
|
+
@nest.Body() input: ISaleArticleComment.IStore,
|
|
36
|
+
): Promise<ISaleArticleComment> {
|
|
37
|
+
section;
|
|
38
|
+
saleId;
|
|
39
|
+
articleId;
|
|
40
|
+
|
|
41
|
+
return {
|
|
42
|
+
id: 0,
|
|
43
|
+
parent_id: null,
|
|
44
|
+
writer_type: request.path.indexOf("seller") ? "seller" : "consumer",
|
|
45
|
+
writer_name: input.annonymous ? null : "someone",
|
|
46
|
+
contents: [
|
|
47
|
+
{
|
|
48
|
+
id: "some-id",
|
|
49
|
+
body: input.body,
|
|
50
|
+
created_at: new Date().toString(),
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
created_at: new Date().toString(),
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import TSON from "typescript-json";
|
|
2
|
+
import api from "../../api";
|
|
3
|
+
import { ISaleArticleComment } from "../../api/structures/ISaleArticleComment";
|
|
4
|
+
|
|
5
|
+
export async function test_consumer_sale_article_comment_store(
|
|
6
|
+
connection: api.IConnection,
|
|
7
|
+
): Promise<void> {
|
|
8
|
+
const comment: ISaleArticleComment =
|
|
9
|
+
await api.functional.consumers.sales.articles.comments.store(
|
|
10
|
+
connection,
|
|
11
|
+
"general",
|
|
12
|
+
0,
|
|
13
|
+
0,
|
|
14
|
+
{
|
|
15
|
+
body: "Some body content",
|
|
16
|
+
extension: "md",
|
|
17
|
+
annonymous: true,
|
|
18
|
+
},
|
|
19
|
+
);
|
|
20
|
+
TSON.assertType(comment);
|
|
21
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import api from "../../api";
|
|
2
|
+
|
|
3
|
+
export async function test_health_checks(
|
|
4
|
+
connection: api.IConnection,
|
|
5
|
+
): Promise<void> {
|
|
6
|
+
await api.functional.health.check(connection);
|
|
7
|
+
await api.functional.health.alive.check(connection);
|
|
8
|
+
await api.functional.healthy.check(connection);
|
|
9
|
+
await api.functional.healthy.alive.check(connection);
|
|
10
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import TSON from "typescript-json";
|
|
2
|
+
import api from "../../api";
|
|
3
|
+
import { ISaleArticleComment } from "../../api/structures/ISaleArticleComment";
|
|
4
|
+
|
|
5
|
+
export async function test_consumer_seller_article_comment_store(
|
|
6
|
+
connection: api.IConnection,
|
|
7
|
+
): Promise<void> {
|
|
8
|
+
const comment: ISaleArticleComment =
|
|
9
|
+
await api.functional.sellers.sales.articles.comments.store(
|
|
10
|
+
connection,
|
|
11
|
+
"general",
|
|
12
|
+
0,
|
|
13
|
+
0,
|
|
14
|
+
{
|
|
15
|
+
body: "Some body content",
|
|
16
|
+
extension: "txt",
|
|
17
|
+
annonymous: false,
|
|
18
|
+
},
|
|
19
|
+
);
|
|
20
|
+
TSON.assertType(comment);
|
|
21
|
+
}
|