|
@@ -1,8 +1,7 @@
|
|
|
-import { Request, Response } from "express";
|
|
|
-import { HttpMethod, Route, StatusCodes } from "org.crazydoctor.expressts";
|
|
|
-import ServerApp from "..";
|
|
|
-import { ClassMapEntity, PackageEntity, Sources } from "../sources/Sources";
|
|
|
-import { CommentsManager } from "../comments/CommentsManager";
|
|
|
+import { HttpMethod, Route, StatusCodes, Request, Response } from 'org.crazydoctor.expressts';
|
|
|
+import ServerApp from '..';
|
|
|
+import { ClassMapEntity, PackageEntity, Sources } from '../sources/Sources';
|
|
|
+import { CommentsManager } from '../comments/CommentsManager';
|
|
|
|
|
|
type DocumentedClassInfo = {
|
|
|
documentable: number,
|
|
@@ -14,7 +13,7 @@ type DocumentedPackageInfo = DocumentedClassInfo & {
|
|
|
};
|
|
|
|
|
|
class GetDocumentedInfo extends Route {
|
|
|
- protected action = (req: Request, res: Response) => {
|
|
|
+ protected action = (req: Request, res: Response): any => {
|
|
|
const params = req.body;
|
|
|
|
|
|
if(ServerApp.SourcesUpdating) {
|
|
@@ -51,7 +50,7 @@ class GetDocumentedInfo extends Route {
|
|
|
const roots = Sources.getRepoNames();
|
|
|
const result: { [key: string]: DocumentedClassInfo } = {};
|
|
|
|
|
|
- for(let root of roots) {
|
|
|
+ for(const root of roots) {
|
|
|
let sumDocumentable = 0;
|
|
|
let sumDocumented = 0;
|
|
|
const classes = Sources.findClassesByRoot(root);
|
|
@@ -59,7 +58,7 @@ class GetDocumentedInfo extends Route {
|
|
|
if(!classes)
|
|
|
continue;
|
|
|
|
|
|
- for(let cls of classes) {
|
|
|
+ for(const cls of classes) {
|
|
|
const res = await this.getClassDocumentedInfo(cls);
|
|
|
sumDocumentable += res.documentable;
|
|
|
sumDocumented += res.documented;
|
|
@@ -72,7 +71,7 @@ class GetDocumentedInfo extends Route {
|
|
|
}
|
|
|
|
|
|
private async getPackageDocumentedInfo(pck: PackageEntity): Promise<DocumentedPackageInfo> {
|
|
|
- const results: Map<string, DocumentedPackageInfo> = new Map();
|
|
|
+ const results: Map<string, DocumentedPackageInfo> = new Map();
|
|
|
|
|
|
let sumDocumentable = 0;
|
|
|
let sumDocumented = 0;
|
|
@@ -89,12 +88,12 @@ class GetDocumentedInfo extends Route {
|
|
|
|
|
|
await Promise.all(promises);
|
|
|
|
|
|
- return { documented: sumDocumented, documentable: sumDocumentable, children: Object.fromEntries(results) };
|
|
|
+ return { documented: sumDocumented, documentable: sumDocumentable, children: Object.fromEntries(results) };
|
|
|
}
|
|
|
|
|
|
private async getClassDocumentedInfo(cls: ClassMapEntity): Promise<DocumentedClassInfo> {
|
|
|
const excludeList = ['callParent', 'newInstance'];
|
|
|
- let documentable = cls.documentableProperties;
|
|
|
+ const documentable = cls.documentableProperties;
|
|
|
let documented = 0;
|
|
|
|
|
|
const commentsResult = await CommentsManager.getCommentsByClass(cls.root, cls.name);
|
|
@@ -107,7 +106,7 @@ class GetDocumentedInfo extends Route {
|
|
|
documented++;
|
|
|
});
|
|
|
|
|
|
- return { documentable, documented }
|
|
|
+ return { documentable, documented };
|
|
|
}
|
|
|
|
|
|
protected method = HttpMethod.POST;
|