rez_core 1.0.10 → 1.0.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/.env +3 -1
- package/data/master.xlsx +0 -0
- package/dist/config/config.module.js +1 -1
- package/dist/config/config.module.js.map +1 -1
- package/dist/decorators/roles.decorator.js.map +1 -1
- package/dist/module/enterprise/enterprise.module.js +1 -1
- package/dist/module/enterprise/enterprise.module.js.map +1 -1
- package/dist/module/enterprise/service/organization.service.js.map +1 -1
- package/dist/module/master/controller/master.controller.js +1 -1
- package/dist/module/master/controller/master.controller.js.map +1 -1
- package/dist/module/meta/controller/entity.controller.d.ts +1 -0
- package/dist/module/meta/controller/entity.controller.js +38 -2
- package/dist/module/meta/controller/entity.controller.js.map +1 -1
- package/dist/module/meta/entity/base-entity.entity.js.map +1 -1
- package/dist/module/meta/entity/entity-table-column.entity.js.map +1 -1
- package/dist/module/meta/entity/entity-table.entity.d.ts +1 -0
- package/dist/module/meta/entity/entity-table.entity.js +4 -0
- package/dist/module/meta/entity/entity-table.entity.js.map +1 -1
- package/dist/module/meta/entity.module.js +8 -1
- package/dist/module/meta/entity.module.js.map +1 -1
- package/dist/module/meta/repository/entity-table-column.repository.js +2 -2
- package/dist/module/meta/repository/entity-table.repository.d.ts +1 -0
- package/dist/module/meta/repository/entity-table.repository.js +9 -0
- package/dist/module/meta/repository/entity-table.repository.js.map +1 -1
- package/dist/module/meta/service/entity-list.service.d.ts +2 -1
- package/dist/module/meta/service/entity-list.service.js +12 -1
- package/dist/module/meta/service/entity-list.service.js.map +1 -1
- package/dist/module/meta/service/entity-service-impl.service.d.ts +11 -4
- package/dist/module/meta/service/entity-service-impl.service.js +67 -9
- package/dist/module/meta/service/entity-service-impl.service.js.map +1 -1
- package/dist/module/meta/service/entity-table-column.service.d.ts +1 -0
- package/dist/module/meta/service/entity-table-column.service.js +4 -0
- package/dist/module/meta/service/entity-table-column.service.js.map +1 -1
- package/dist/module/meta/service/entity-table.service.d.ts +1 -0
- package/dist/module/meta/service/entity-table.service.js +3 -0
- package/dist/module/meta/service/entity-table.service.js.map +1 -1
- package/dist/module/meta/service/entity.service.d.ts +1 -0
- package/dist/module/meta/service/preference.service.d.ts +1 -5
- package/dist/module/meta/service/preference.service.js +3 -11
- package/dist/module/meta/service/preference.service.js.map +1 -1
- package/dist/module/module/controller/menu.controller.js +1 -1
- package/dist/module/module/controller/menu.controller.js.map +1 -1
- package/dist/module/module/controller/module-access.controller.js +1 -1
- package/dist/module/module/controller/module-access.controller.js.map +1 -1
- package/dist/module/module/entity/menu.entity.js.map +1 -1
- package/dist/module/module/entity/module.entity.js.map +1 -1
- package/dist/module/module/module.module.js +2 -2
- package/dist/module/module/module.module.js.map +1 -1
- package/dist/module/module/repository/menu.repository.js +3 -3
- package/dist/module/module/repository/menu.repository.js.map +1 -1
- package/dist/module/module/repository/module-access.repository.js +31 -20
- package/dist/module/module/repository/module-access.repository.js.map +1 -1
- package/dist/module/module/service/menu.service.js +2 -2
- package/dist/module/module/service/menu.service.js.map +1 -1
- package/dist/module/module/service/module-access.service.js.map +1 -1
- package/dist/module/notification/controller/otp.controller.d.ts +15 -0
- package/dist/module/notification/controller/otp.controller.js +59 -0
- package/dist/module/notification/controller/otp.controller.js.map +1 -0
- package/dist/module/notification/entity/otp.entity.d.ts +10 -0
- package/dist/module/notification/entity/otp.entity.js +52 -0
- package/dist/module/notification/entity/otp.entity.js.map +1 -0
- package/dist/module/notification/notification.module.d.ts +2 -0
- package/dist/module/notification/notification.module.js +27 -0
- package/dist/module/notification/notification.module.js.map +1 -0
- package/dist/module/notification/repository/otp.repository.d.ts +9 -0
- package/dist/module/notification/repository/otp.repository.js +44 -0
- package/dist/module/notification/repository/otp.repository.js.map +1 -0
- package/dist/module/notification/service/otp.service.d.ts +12 -0
- package/dist/module/notification/service/otp.service.js +61 -0
- package/dist/module/notification/service/otp.service.js.map +1 -0
- package/dist/module/user/controller/login.controller.js +1 -1
- package/dist/module/user/controller/login.controller.js.map +1 -1
- package/dist/module/user/controller/user.controller.js +1 -1
- package/dist/module/user/controller/user.controller.js.map +1 -1
- package/dist/module/user/dto/create-user.dto.js.map +1 -1
- package/dist/module/user/entity/role.entity.js.map +1 -1
- package/dist/module/user/repository/user-role-mapping.repository.js +4 -1
- package/dist/module/user/repository/user-role-mapping.repository.js.map +1 -1
- package/dist/module/user/repository/user.repository.js.map +1 -1
- package/dist/module/user/service/role.service.d.ts +1 -5
- package/dist/module/user/service/role.service.js +3 -10
- package/dist/module/user/service/role.service.js.map +1 -1
- package/dist/module/user/service/user.service.d.ts +1 -5
- package/dist/module/user/service/user.service.js +3 -11
- package/dist/module/user/service/user.service.js.map +1 -1
- package/dist/module/user/user.module.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utils/dto/excel-data.dto.d.ts +7 -0
- package/dist/utils/dto/excel-data.dto.js +16 -0
- package/dist/utils/dto/excel-data.dto.js.map +1 -0
- package/dist/utils/dto/excelsheet-data.dto.d.ts +5 -0
- package/dist/utils/dto/excelsheet-data.dto.js +3 -0
- package/dist/utils/dto/excelsheet-data.dto.js.map +1 -0
- package/dist/utils/service/excel-helper.service.d.ts +3 -1
- package/dist/utils/service/excel-helper.service.js +12 -3
- package/dist/utils/service/excel-helper.service.js.map +1 -1
- package/dist/utils/service/loggingUtil.service.js +6 -6
- package/dist/utils/service/loggingUtil.service.js.map +1 -1
- package/dist/utils/utils.module.js.map +1 -1
- package/package.json +1 -1
- package/src/app.controller.ts +12 -12
- package/src/app.service.ts +8 -8
- package/src/config/config.module.ts +1 -1
- package/src/decorators/roles.decorator.ts +5 -2
- package/src/module/auth/guards/google-auth.guard.ts +1 -1
- package/src/module/enterprise/enterprise.module.ts +2 -3
- package/src/module/enterprise/service/organization.service.ts +8 -5
- package/src/module/master/controller/master.controller.ts +1 -1
- package/src/module/meta/controller/entity.controller.ts +57 -4
- package/src/module/meta/entity/base-entity.entity.ts +1 -1
- package/src/module/meta/entity/entity-table-column.entity.ts +1 -1
- package/src/module/meta/entity/entity-table.entity.ts +4 -2
- package/src/module/meta/entity.module.ts +8 -1
- package/src/module/meta/repository/entity-table-column.repository.ts +3 -3
- package/src/module/meta/repository/entity-table.repository.ts +14 -0
- package/src/module/meta/service/entity-list.service.ts +15 -5
- package/src/module/meta/service/entity-service-impl.service.ts +98 -8
- package/src/module/meta/service/entity-table-column.service.ts +14 -1
- package/src/module/meta/service/entity-table.service.ts +8 -1
- package/src/module/meta/service/entity.service.ts +12 -1
- package/src/module/meta/service/preference.service.ts +2 -17
- package/src/module/module/controller/menu.controller.ts +1 -1
- package/src/module/module/controller/module-access.controller.ts +2 -2
- package/src/module/module/entity/menu.entity.ts +9 -9
- package/src/module/module/entity/module.entity.ts +8 -8
- package/src/module/module/module.module.ts +2 -4
- package/src/module/module/repository/menu.repository.ts +7 -10
- package/src/module/module/repository/module-access.repository.ts +57 -42
- package/src/module/module/service/menu.service.ts +9 -10
- package/src/module/module/service/module-access.service.ts +8 -3
- package/src/module/notification/controller/otp.controller.ts +27 -0
- package/src/module/notification/entity/otp.entity.ts +28 -0
- package/src/module/notification/notification.module.ts +14 -0
- package/src/module/notification/repository/otp.repository.ts +27 -0
- package/src/module/notification/service/otp.service.ts +50 -0
- package/src/module/user/controller/login.controller.ts +1 -1
- package/src/module/user/controller/user.controller.ts +1 -1
- package/src/module/user/dto/create-user.dto.ts +43 -43
- package/src/module/user/entity/role.entity.ts +1 -1
- package/src/module/user/repository/user-role-mapping.repository.ts +9 -3
- package/src/module/user/repository/user.repository.ts +2 -2
- package/src/module/user/service/role.service.ts +2 -13
- package/src/module/user/service/user-role-mapping.service.ts +1 -1
- package/src/module/user/service/user-session.service.ts +1 -1
- package/src/module/user/service/user.service.ts +4 -17
- package/src/module/user/user.module.ts +0 -1
- package/src/utils/dto/excel-data.dto.ts +14 -0
- package/src/utils/dto/excelsheet-data.dto.ts +5 -0
- package/src/utils/service/clockIDGenUtil.service.ts +1 -1
- package/src/utils/service/dateUtil.service.ts +1 -1
- package/src/utils/service/excel-helper.service.ts +14 -1
- package/src/utils/service/loggingUtil.service.ts +48 -48
- package/src/utils/utils.module.ts +7 -7
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExcelData = void 0;
|
|
4
|
+
class ExcelData {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.sheetList = [];
|
|
7
|
+
}
|
|
8
|
+
addSheet(sheetData) {
|
|
9
|
+
this.sheetList.push(sheetData);
|
|
10
|
+
}
|
|
11
|
+
addSheetAt(sheetData, position) {
|
|
12
|
+
this.sheetList.splice(position, 0, sheetData);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.ExcelData = ExcelData;
|
|
16
|
+
//# sourceMappingURL=excel-data.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"excel-data.dto.js","sourceRoot":"","sources":["../../../src/utils/dto/excel-data.dto.ts"],"names":[],"mappings":";;;AAEA,MAAa,SAAS;IAAtB;QAEE,cAAS,GAAqB,EAAE,CAAC;IASnC,CAAC;IAPC,QAAQ,CAAC,SAAyB;QAChC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACjC,CAAC;IAED,UAAU,CAAC,SAAyB,EAAE,QAAgB;QACpD,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,EAAE,SAAS,CAAC,CAAC;IAChD,CAAC;CACF;AAXD,8BAWC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"excelsheet-data.dto.js","sourceRoot":"","sources":["../../../src/utils/dto/excelsheet-data.dto.ts"],"names":[],"mappings":""}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import { ExcelData } from '../dto/excel-data.dto';
|
|
2
|
+
export declare class ExcelHelper {
|
|
2
3
|
static getHeader(filePath: string, sheetName: string): string[];
|
|
3
4
|
static readExcel(filePath: string, rowLevel: string, sheetName: string): string[][];
|
|
4
5
|
static getRowData(filePath: string, sheetName: string): string[][];
|
|
5
6
|
static getJSONStringFromList(header: string[], rowData: string[][]): string;
|
|
6
7
|
static getDataObjectListFromXLS<T>(filePath: string, sheetName: string, classType: new () => T): T[];
|
|
8
|
+
static writeExcel(excelData: ExcelData): void;
|
|
7
9
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.ExcelHelper = void 0;
|
|
4
4
|
const ExcelJS = require("exceljs");
|
|
5
|
-
|
|
5
|
+
const XLSX = require("xlsx");
|
|
6
|
+
class ExcelHelper {
|
|
6
7
|
static getHeader(filePath, sheetName) {
|
|
7
8
|
const rows = this.readExcel(filePath, 'HEADER', sheetName);
|
|
8
9
|
return rows.length > 0 ? rows[0] : [];
|
|
@@ -39,6 +40,14 @@ class ExcelHelperService {
|
|
|
39
40
|
const jsonString = this.getJSONStringFromList(header, rowData);
|
|
40
41
|
return JSON.parse(jsonString);
|
|
41
42
|
}
|
|
43
|
+
static writeExcel(excelData) {
|
|
44
|
+
const wb = XLSX.utils.book_new();
|
|
45
|
+
for (const sheetData of excelData.sheetList) {
|
|
46
|
+
const ws = XLSX.utils.aoa_to_sheet([sheetData.headers, ...sheetData.rowList]);
|
|
47
|
+
XLSX.utils.book_append_sheet(wb, ws, sheetData.sheetName || 'Sheet1');
|
|
48
|
+
}
|
|
49
|
+
XLSX.writeFile(wb, excelData.filePath);
|
|
50
|
+
}
|
|
42
51
|
}
|
|
43
|
-
exports.
|
|
52
|
+
exports.ExcelHelper = ExcelHelper;
|
|
44
53
|
//# sourceMappingURL=excel-helper.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"excel-helper.service.js","sourceRoot":"","sources":["../../../src/utils/service/excel-helper.service.ts"],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EAAE,CAAC;YAC5C,MAAM,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,SAAS,CAAC,OAAO,EAAE,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;YAC9E,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,EAAE,EAAE,EAAE,EAAE,SAAS,CAAC,SAAS,IAAI,QAAQ,CAAC,CAAC;QACxE,CAAC;QAED,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;IACzC,CAAC;CACF;AAhED,kCAgEC"}
|
|
@@ -20,21 +20,21 @@ let LoggingService = class LoggingService {
|
|
|
20
20
|
let levelInfo = level.toLowerCase().trim();
|
|
21
21
|
let logger = new common_1.Logger(serviceName);
|
|
22
22
|
const fileConfiguration = {
|
|
23
|
-
format: winston.format.combine(winston.format.errors({ stzack: true }), winston.format.timestamp({ format: 'DD/MM/YYYY HH:mm:ss' }), winston.format.printf(info => `${info.timestamp} : ${info.level}: ${serviceName}: ${methodName} : ${message} : ${JSON.stringify(parameters) ||
|
|
23
|
+
format: winston.format.combine(winston.format.errors({ stzack: true }), winston.format.timestamp({ format: 'DD/MM/YYYY HH:mm:ss' }), winston.format.printf((info) => `${info.timestamp} : ${info.level}: ${serviceName}: ${methodName} : ${message} : ${JSON.stringify(parameters) || ''} : ${JSON.stringify(debuginfo) || ''}`)),
|
|
24
24
|
transports: [
|
|
25
25
|
new winston_1.transports.File({
|
|
26
|
-
dirname: `/data01/logs/${moment().format(
|
|
26
|
+
dirname: `/data01/logs/${moment().format('DD-MM-YYYY')}/activity/${moment().format('HH dddd')}`,
|
|
27
27
|
filename: 'activity.log',
|
|
28
|
-
level: `${level}
|
|
29
|
-
})
|
|
28
|
+
level: `${level}`,
|
|
29
|
+
}),
|
|
30
30
|
],
|
|
31
31
|
};
|
|
32
32
|
const filelogger = winston.createLogger(fileConfiguration);
|
|
33
33
|
let data = `${message} -- Parameters: ${JSON.stringify(parameters)}`;
|
|
34
|
-
if (levelInfo ==
|
|
34
|
+
if (levelInfo == 'debug' || levelInfo == 'info') {
|
|
35
35
|
logger.debug(`${methodName} : ${message} : Parameters :${JSON.stringify(parameters)}: Debug Info: ${JSON.stringify(debuginfo)}`);
|
|
36
36
|
}
|
|
37
|
-
else if (levelInfo ==
|
|
37
|
+
else if (levelInfo == 'error') {
|
|
38
38
|
logger.error(`${methodName} : ${message} : Parameters :${JSON.stringify(parameters)}: Debug Info: ${JSON.stringify(debuginfo)}`);
|
|
39
39
|
}
|
|
40
40
|
filelogger.on('finish', () => { });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loggingUtil.service.js","sourceRoot":"","sources":["../../../src/utils/service/loggingUtil.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAoD;AACpD,qCAAqC;
|
|
1
|
+
{"version":3,"file":"loggingUtil.service.js","sourceRoot":"","sources":["../../../src/utils/service/loggingUtil.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAoD;AACpD,qCAAqC;AAErC,MAAM,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AACnC,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAG1B,IAAM,cAAc,GAApB,MAAM,cAAc;IACzB,gBAAe,CAAC;IAEhB,KAAK,CAAC,GAAG,CACP,KAAa,EACb,WAAmB,EACnB,UAAkB,EAClB,OAAe,EACf,UAAsB,EACtB,SAAqB;QAErB,IAAI,SAAS,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC;QAC3C,IAAI,MAAM,GAAG,IAAI,eAAM,CAAC,WAAW,CAAC,CAAC;QAErC,MAAM,iBAAiB,GAAG;YACxB,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,OAAO,CAC5B,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EACvC,OAAO,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CAAC;QACD,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;QAClC,UAAU,CAAC,GAAG,EAAE,CAAC;IACnB,CAAC;CACF,CAAA;AAhDY,wCAAc;yBAAd,cAAc;IAD1B,IAAA,mBAAU,GAAE;;GACA,cAAc,CAgD1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.module.js","sourceRoot":"","sources":["../../src/utils/utils.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"utils.module.js","sourceRoot":"","sources":["../../src/utils/utils.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAgD;AAChD,uEAA+D;AAC/D,mFAAuE;AACvE,mEAAwD;AACxD,6EAAqE;AAO9D,IAAM,WAAW,GAAjB,MAAM,WAAW;CAAG,CAAA;AAAd,kCAAW;sBAAX,WAAW;IALvB,IAAA,eAAM,GAAE;IACR,IAAA,eAAM,EAAC;QACN,SAAS,EAAE,CAAC,oCAAc,EAAE,4CAAgB,EAAE,6BAAS,EAAE,0CAAiB,CAAC;QAC3E,OAAO,EAAE,CAAC,oCAAc,EAAE,4CAAgB,EAAE,6BAAS,EAAE,0CAAiB,CAAC;KAC1E,CAAC;GACW,WAAW,CAAG"}
|
package/package.json
CHANGED
package/src/app.controller.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { Controller, Get } from '@nestjs/common';
|
|
2
|
-
import { AppService } from './app.service';
|
|
3
|
-
|
|
4
|
-
@Controller()
|
|
5
|
-
export class AppController {
|
|
6
|
-
constructor(private readonly appService: AppService) {}
|
|
7
|
-
|
|
8
|
-
@Get()
|
|
9
|
-
getHello(): string {
|
|
10
|
-
return this.appService.getHello();
|
|
11
|
-
}
|
|
12
|
-
}
|
|
1
|
+
import { Controller, Get } from '@nestjs/common';
|
|
2
|
+
import { AppService } from './app.service';
|
|
3
|
+
|
|
4
|
+
@Controller()
|
|
5
|
+
export class AppController {
|
|
6
|
+
constructor(private readonly appService: AppService) {}
|
|
7
|
+
|
|
8
|
+
@Get()
|
|
9
|
+
getHello(): string {
|
|
10
|
+
return this.appService.getHello();
|
|
11
|
+
}
|
|
12
|
+
}
|
package/src/app.service.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Injectable } from '@nestjs/common';
|
|
2
|
-
|
|
3
|
-
@Injectable()
|
|
4
|
-
export class AppService {
|
|
5
|
-
getHello(): string {
|
|
6
|
-
return 'Hello World!';
|
|
7
|
-
}
|
|
8
|
-
}
|
|
1
|
+
import { Injectable } from '@nestjs/common';
|
|
2
|
+
|
|
3
|
+
@Injectable()
|
|
4
|
+
export class AppService {
|
|
5
|
+
getHello(): string {
|
|
6
|
+
return 'Hello World!';
|
|
7
|
+
}
|
|
8
|
+
}
|
|
@@ -10,7 +10,7 @@ import { MySqlConfiguration } from './database.config';
|
|
|
10
10
|
TypeOrmModule.forRootAsync({
|
|
11
11
|
useClass: MySqlConfiguration,
|
|
12
12
|
}),
|
|
13
|
-
ConfigModule.forRoot({isGlobal: true})
|
|
13
|
+
ConfigModule.forRoot({ isGlobal: true }),
|
|
14
14
|
],
|
|
15
15
|
// providers: [MySqlConfiguration],
|
|
16
16
|
exports: [TypeOrmModule],
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {applyDecorators, SetMetadata} from
|
|
1
|
+
import { applyDecorators, SetMetadata } from '@nestjs/common';
|
|
2
2
|
|
|
3
3
|
export const Roles = (moduleCode: string, actions: string) =>
|
|
4
|
-
|
|
4
|
+
applyDecorators(
|
|
5
|
+
SetMetadata('moduleCode', moduleCode),
|
|
6
|
+
SetMetadata('actions', actions),
|
|
7
|
+
);
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { Module } from '@nestjs/common';
|
|
2
2
|
import { TypeOrmModule } from '@nestjs/typeorm';
|
|
3
|
-
import { UserData } from '../user/entity/user.entity';
|
|
4
3
|
import { OrganizationService } from './service/organization.service';
|
|
5
4
|
import { OrganizationData } from './entity/organization.entity';
|
|
6
5
|
|
|
7
6
|
@Module({
|
|
8
7
|
imports: [TypeOrmModule.forFeature([OrganizationData])],
|
|
9
|
-
providers:[OrganizationService],
|
|
10
|
-
exports:[OrganizationService]
|
|
8
|
+
providers: [OrganizationService],
|
|
9
|
+
exports: [OrganizationService],
|
|
11
10
|
})
|
|
12
11
|
export class EnterpriseModule {}
|
|
@@ -9,8 +9,8 @@ export class OrganizationService {
|
|
|
9
9
|
constructor(
|
|
10
10
|
@InjectRepository(OrganizationData)
|
|
11
11
|
private readonly organizationRepository: Repository<OrganizationData>,
|
|
12
|
-
private readonly idGen: ClockIDGenService
|
|
13
|
-
) {
|
|
12
|
+
private readonly idGen: ClockIDGenService,
|
|
13
|
+
) {}
|
|
14
14
|
|
|
15
15
|
async create(
|
|
16
16
|
organizationDto: Partial<OrganizationData>,
|
|
@@ -21,8 +21,8 @@ export class OrganizationService {
|
|
|
21
21
|
: this.organizationRepository;
|
|
22
22
|
|
|
23
23
|
organizationDto.code = this.idGen.idGenerator('ORG');
|
|
24
|
-
organizationDto.status = 'ACTIVE'
|
|
25
|
-
organizationDto.created_date = new Date();
|
|
24
|
+
organizationDto.status = 'ACTIVE';
|
|
25
|
+
organizationDto.created_date = new Date();
|
|
26
26
|
const organization = repo.create(organizationDto);
|
|
27
27
|
return await repo.save(organization);
|
|
28
28
|
}
|
|
@@ -35,7 +35,10 @@ export class OrganizationService {
|
|
|
35
35
|
return await repo.find();
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
async findOne(
|
|
38
|
+
async findOne(
|
|
39
|
+
id: number,
|
|
40
|
+
manager?: EntityManager,
|
|
41
|
+
): Promise<OrganizationData | null> {
|
|
39
42
|
const repo = manager
|
|
40
43
|
? manager.getRepository(OrganizationData)
|
|
41
44
|
: this.organizationRepository;
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
import { FileInterceptor } from '@nestjs/platform-express';
|
|
8
8
|
import { MasterService } from '../service/master.service';
|
|
9
9
|
|
|
10
|
-
@Controller('master')
|
|
10
|
+
@Controller('api/master')
|
|
11
11
|
export class MasterController {
|
|
12
12
|
constructor(private readonly masterService: MasterService) {}
|
|
13
13
|
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
BadRequestException,
|
|
3
3
|
Body,
|
|
4
4
|
Controller,
|
|
5
|
-
Get,
|
|
5
|
+
Get, HttpCode,
|
|
6
6
|
HttpStatus,
|
|
7
7
|
Param,
|
|
8
8
|
Post,
|
|
@@ -16,9 +16,11 @@ import { Response } from 'express';
|
|
|
16
16
|
import { EntityMasterService } from '../service/entity-master.service';
|
|
17
17
|
import { BaseEntity } from '../entity/base-entity.entity';
|
|
18
18
|
import { JwtAuthGuard } from '../../auth/guards/jwt.guard';
|
|
19
|
+
import * as fs from 'fs';
|
|
20
|
+
import * as path from 'path';
|
|
19
21
|
|
|
20
22
|
@UseGuards(JwtAuthGuard)
|
|
21
|
-
@Controller('entity')
|
|
23
|
+
@Controller('api/entity')
|
|
22
24
|
export class EntityController {
|
|
23
25
|
constructor(
|
|
24
26
|
private entityService: EntityServiceImpl,
|
|
@@ -120,8 +122,59 @@ export class EntityController {
|
|
|
120
122
|
@Query('page') page: number = 0,
|
|
121
123
|
@Query('size') size: number = 1,
|
|
122
124
|
) {
|
|
125
|
+
return res
|
|
126
|
+
.status(HttpStatus.OK)
|
|
127
|
+
.json(
|
|
128
|
+
await this.entityService.getFilterDataWithTabs(
|
|
129
|
+
entityType,
|
|
130
|
+
listType,
|
|
131
|
+
filters,
|
|
132
|
+
sortColumn,
|
|
133
|
+
sortOrder,
|
|
134
|
+
page,
|
|
135
|
+
size,
|
|
136
|
+
),
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
@HttpCode(HttpStatus.OK)
|
|
141
|
+
@Post('download-excel/:entity_type')
|
|
142
|
+
@HttpCode(HttpStatus.OK)
|
|
143
|
+
async downloadExcel(
|
|
144
|
+
@Param('entity_type') entityType: string,
|
|
145
|
+
@Query('list_entity_type') listEntityType: string,
|
|
146
|
+
@Query('display_type') displayType: string,
|
|
147
|
+
@Query() filterCriteria: Record<string, any>,
|
|
148
|
+
@Res() res: Response, // Express Response for file handling
|
|
149
|
+
) {
|
|
150
|
+
try {
|
|
151
|
+
const filePath = await this.entityService.generateExcelReport(
|
|
152
|
+
entityType,
|
|
153
|
+
filterCriteria,
|
|
154
|
+
listEntityType,
|
|
155
|
+
displayType,
|
|
156
|
+
);
|
|
123
157
|
|
|
124
|
-
|
|
125
|
-
|
|
158
|
+
if (!filePath || !fs.existsSync(filePath)) {
|
|
159
|
+
return res.status(404).json({ message: 'File not found' });
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
res.setHeader(
|
|
163
|
+
'Content-Disposition',
|
|
164
|
+
`attachment; filename=${path.basename(filePath)}`,
|
|
165
|
+
);
|
|
166
|
+
res.setHeader('Content-Type', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
|
167
|
+
|
|
168
|
+
const fileStream = fs.createReadStream(filePath);
|
|
169
|
+
fileStream.pipe(res);
|
|
170
|
+
|
|
171
|
+
// Optional: Delete file after sending response
|
|
172
|
+
fileStream.on('end', () => {
|
|
173
|
+
fs.unlinkSync(filePath);
|
|
174
|
+
});
|
|
175
|
+
} catch (error) {
|
|
176
|
+
console.error('Error downloading Excel file:', error);
|
|
177
|
+
res.status(500).json({ message: 'Internal server error' });
|
|
178
|
+
}
|
|
126
179
|
}
|
|
127
180
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { Column, Entity } from 'typeorm';
|
|
2
2
|
import { BaseEntity } from './base-entity.entity';
|
|
3
|
-
import {ENTITYTYPE_ENTITYTABLE} from
|
|
3
|
+
import { ENTITYTYPE_ENTITYTABLE } from '../../../constant/global.constant';
|
|
4
4
|
|
|
5
5
|
@Entity({ name: 'cr_entity_table' })
|
|
6
6
|
export class EntityTable extends BaseEntity {
|
|
7
|
-
|
|
8
7
|
constructor() {
|
|
9
8
|
super();
|
|
10
9
|
this.entity_type = ENTITYTYPE_ENTITYTABLE;
|
|
@@ -48,4 +47,7 @@ export class EntityTable extends BaseEntity {
|
|
|
48
47
|
|
|
49
48
|
@Column({ name: 'is_proc', nullable: true })
|
|
50
49
|
is_proc: number;
|
|
50
|
+
|
|
51
|
+
@Column({ name: 'display_type', nullable: true})
|
|
52
|
+
display_type: string;
|
|
51
53
|
}
|
|
@@ -44,7 +44,14 @@ import { EntityListService } from './service/entity-list.service';
|
|
|
44
44
|
EntityTableColumnService,
|
|
45
45
|
EntityListService,
|
|
46
46
|
],
|
|
47
|
-
exports: [
|
|
47
|
+
exports: [
|
|
48
|
+
EntityMasterService,
|
|
49
|
+
EntityServiceImpl,
|
|
50
|
+
PreferenceService,
|
|
51
|
+
EntityListService,
|
|
52
|
+
EntityTableService,
|
|
53
|
+
EntityTableColumnService
|
|
54
|
+
],
|
|
48
55
|
controllers: [EntityController, MasterController],
|
|
49
56
|
})
|
|
50
57
|
export class EntityModule {}
|
|
@@ -10,12 +10,12 @@ export class EntityTableColumnRepository {
|
|
|
10
10
|
private entityTableColumnRepository: Repository<EntityTableColumn>,
|
|
11
11
|
) {}
|
|
12
12
|
|
|
13
|
-
async findByParentIdAndParentType(parentId: number, parentType: string){
|
|
13
|
+
async findByParentIdAndParentType(parentId: number, parentType: string) {
|
|
14
14
|
return await this.entityTableColumnRepository.find({
|
|
15
15
|
where: {
|
|
16
16
|
parent_id: parentId,
|
|
17
|
-
parent_type: parentType
|
|
18
|
-
}
|
|
17
|
+
parent_type: parentType,
|
|
18
|
+
},
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
21
|
}
|
|
@@ -15,4 +15,18 @@ export class EntityTableRepository {
|
|
|
15
15
|
where: { mapped_entity_type: entityType, list_type: listType },
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
|
+
|
|
19
|
+
async findByEntityTypeAndListTypeAndDisplayType(
|
|
20
|
+
entityType: string,
|
|
21
|
+
listType: string,
|
|
22
|
+
displayType: string,
|
|
23
|
+
) {
|
|
24
|
+
return await this.entityTableRepository.findOne({
|
|
25
|
+
where: {
|
|
26
|
+
mapped_entity_type: entityType,
|
|
27
|
+
list_type: listType,
|
|
28
|
+
display_type: displayType,
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
}
|
|
18
32
|
}
|
|
@@ -49,13 +49,13 @@ export class EntityListService {
|
|
|
49
49
|
return entityListData;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
public async getFilteredList(
|
|
53
53
|
entityTable: EntityTable,
|
|
54
54
|
filters: Record<string, any>,
|
|
55
55
|
sortColumn: string | undefined,
|
|
56
56
|
sortOrder: string | undefined,
|
|
57
|
-
pageNumber: number,
|
|
58
|
-
pageSize: number,
|
|
57
|
+
pageNumber: number | undefined,
|
|
58
|
+
pageSize: number | undefined,
|
|
59
59
|
) {
|
|
60
60
|
let query = this.getQuery(entityTable.data_source, null);
|
|
61
61
|
let whereClause = await this.getWhereClause(entityTable, filters);
|
|
@@ -75,13 +75,23 @@ export class EntityListService {
|
|
|
75
75
|
entityTable: EntityTable,
|
|
76
76
|
filters: Record<string, any>,
|
|
77
77
|
) {
|
|
78
|
-
let query =
|
|
78
|
+
let query = this.getQuery(entityTable.data_source, entityTable.tab_column);
|
|
79
79
|
let whereClause = await this.getWhereClause(entityTable, filters);
|
|
80
80
|
if (whereClause.query) {
|
|
81
81
|
query += whereClause.query;
|
|
82
82
|
}
|
|
83
83
|
query += ' GROUP BY ' + entityTable.tab_column;
|
|
84
|
-
|
|
84
|
+
let tabs = await this.entityManager.query(query, whereClause.argumentList);
|
|
85
|
+
let all = 0;
|
|
86
|
+
for (const i in tabs) {
|
|
87
|
+
let tab = tabs[i] as EntityTab;
|
|
88
|
+
all += parseInt(String(tab.tab_value_count));
|
|
89
|
+
}
|
|
90
|
+
let entityTab = new EntityTab();
|
|
91
|
+
entityTab.tab_value = 'ALL';
|
|
92
|
+
entityTab.tab_value_count = all;
|
|
93
|
+
tabs.push(entityTab);
|
|
94
|
+
return tabs;
|
|
85
95
|
}
|
|
86
96
|
|
|
87
97
|
private getQuery(source: string, groupByColumn: string | null) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EntityService } from './entity.service';
|
|
2
|
-
import { Injectable } from '@nestjs/common';
|
|
2
|
+
import { Inject, Injectable } from '@nestjs/common';
|
|
3
3
|
import { UserData } from '../../user/entity/user.entity';
|
|
4
4
|
import { EntityMasterService } from './entity-master.service';
|
|
5
5
|
import { ReflectionHelper } from '../../../utils/service/reflection-helper.service';
|
|
@@ -8,20 +8,30 @@ import { LoggingService } from '../../../utils/service/loggingUtil.service';
|
|
|
8
8
|
import { EntityListData } from '../dto/entity-list-data.dto';
|
|
9
9
|
import { EntityListService } from './entity-list.service';
|
|
10
10
|
import { EntityManager } from 'typeorm';
|
|
11
|
+
import { ExcelData } from '../../../utils/dto/excel-data.dto';
|
|
12
|
+
import * as fs from 'fs';
|
|
13
|
+
import * as path from 'path';
|
|
14
|
+
import { ExcelHelper } from '../../../utils/service/excel-helper.service';
|
|
15
|
+
import { ExcelsheetData } from '../../../utils/dto/excelsheet-data.dto';
|
|
16
|
+
import { EntityTableService } from './entity-table.service';
|
|
17
|
+
import { EntityTableColumnService } from './entity-table-column.service';
|
|
11
18
|
|
|
12
19
|
@Injectable()
|
|
13
20
|
export class EntityServiceImpl implements EntityService<BaseEntity> {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
)
|
|
21
|
+
@Inject() protected readonly entityMasterService: EntityMasterService;
|
|
22
|
+
@Inject()
|
|
23
|
+
protected readonly entityTableColumnService: EntityTableColumnService;
|
|
24
|
+
@Inject() protected readonly entityTableService: EntityTableService;
|
|
25
|
+
@Inject() protected readonly reflectionHelper: ReflectionHelper;
|
|
26
|
+
@Inject() protected readonly entityListService: EntityListService;
|
|
27
|
+
@Inject() protected readonly loggingService: LoggingService;
|
|
28
|
+
|
|
29
|
+
constructor() {}
|
|
20
30
|
|
|
21
31
|
async createEntity(
|
|
22
32
|
entityData: BaseEntity,
|
|
23
33
|
loggedInUser: UserData | null,
|
|
24
|
-
manager?: EntityManager
|
|
34
|
+
manager?: EntityManager,
|
|
25
35
|
): Promise<BaseEntity> {
|
|
26
36
|
const entityMaster = await this.entityMasterService.getEntityData(
|
|
27
37
|
entityData.entity_type,
|
|
@@ -154,4 +164,84 @@ export class EntityServiceImpl implements EntityService<BaseEntity> {
|
|
|
154
164
|
pageSize,
|
|
155
165
|
);
|
|
156
166
|
}
|
|
167
|
+
|
|
168
|
+
async generateExcelReport(
|
|
169
|
+
entityType: string,
|
|
170
|
+
filterCriteria: Record<string, any>,
|
|
171
|
+
listEntityType: string,
|
|
172
|
+
displayType: string,
|
|
173
|
+
): Promise<string | null> {
|
|
174
|
+
let fileName: string;
|
|
175
|
+
try {
|
|
176
|
+
const excelData = new ExcelData();
|
|
177
|
+
await this.populateExcelData(
|
|
178
|
+
excelData,
|
|
179
|
+
entityType,
|
|
180
|
+
filterCriteria,
|
|
181
|
+
listEntityType,
|
|
182
|
+
displayType,
|
|
183
|
+
);
|
|
184
|
+
|
|
185
|
+
const modifiedDate = new Date().toISOString().replace(/[-T:.Z]/g, '');
|
|
186
|
+
const tempDir = path.join(__dirname, '../../temp');
|
|
187
|
+
if (!fs.existsSync(tempDir)) {
|
|
188
|
+
fs.mkdirSync(tempDir, { recursive: true });
|
|
189
|
+
}
|
|
190
|
+
fileName = path.join(tempDir, `export_${modifiedDate}.xlsx`);
|
|
191
|
+
excelData.filePath = fileName;
|
|
192
|
+
ExcelHelper.writeExcel(excelData);
|
|
193
|
+
} catch (error) {
|
|
194
|
+
throw error;
|
|
195
|
+
}
|
|
196
|
+
return fileName;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
private async populateExcelData(
|
|
200
|
+
excelData: ExcelData,
|
|
201
|
+
entityType: string,
|
|
202
|
+
filterCriteria: Record<string, any>,
|
|
203
|
+
listEntityType: string,
|
|
204
|
+
displayType: string,
|
|
205
|
+
) {
|
|
206
|
+
const sheet: ExcelsheetData = {
|
|
207
|
+
sheetName: entityType,
|
|
208
|
+
headers: [],
|
|
209
|
+
rowList: [],
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
const entityTable =
|
|
213
|
+
await this.entityTableService.findByEntityTypeAndListTypeAndDisplayType(
|
|
214
|
+
entityType,
|
|
215
|
+
listEntityType,
|
|
216
|
+
displayType,
|
|
217
|
+
);
|
|
218
|
+
if (entityTable) {
|
|
219
|
+
const entityTableColumnList =
|
|
220
|
+
await this.entityTableColumnService.findByParentIdAndParentType(
|
|
221
|
+
entityTable.id,
|
|
222
|
+
entityTable.entity_type,
|
|
223
|
+
);
|
|
224
|
+
|
|
225
|
+
sheet.headers = entityTableColumnList.map((col) => col.name);
|
|
226
|
+
const attributeList = entityTableColumnList.map(
|
|
227
|
+
(col) => col.attribute_key,
|
|
228
|
+
);
|
|
229
|
+
|
|
230
|
+
const filteredList = await this.entityListService.getFilteredList(
|
|
231
|
+
entityTable,
|
|
232
|
+
filterCriteria,
|
|
233
|
+
undefined,
|
|
234
|
+
undefined,
|
|
235
|
+
undefined,
|
|
236
|
+
undefined,
|
|
237
|
+
);
|
|
238
|
+
|
|
239
|
+
sheet.rowList = filteredList.map((item) =>
|
|
240
|
+
attributeList.map((attr) =>
|
|
241
|
+
item[attr] !== undefined ? item[attr] : null,
|
|
242
|
+
),
|
|
243
|
+
);
|
|
244
|
+
excelData.addSheet(sheet);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
157
247
|
}
|